[comp.sys.apple2] Applesoft memory help

aq696@cleveland.Freenet.Edu (Charles Perlingiero) (05/24/91)

I have a couple questions...

First, the locations in ProDOS that contain the minute and the hour will
not change while a program is running, why?  I wanted to have a clock
routine in my program, but these locations (49042=minute, 49043=hour) do not
update when the program is running.  Also, does anyone know if there is
a second location?  I'm sure ProDOS reads the clock continuously, but how
can I access it?

Second, does anyone know if there is direct memory location that will send
a byte directly to slot 2 (modem)?  And if there is one that will read the
buffer (like the keyboard scan)?

H E L P  M E  P L E A S E

--
-------------------------------------------------------------------------------
| Charles Perlingiero                 | Interests: Apple II's & Guitars       |
| Cleveland Freenet ID: aq696         | Location: Philadelphia, Pennsylvania  |
-------------------------------------------------------------------------------

parkern@ (Neil Parker) (05/24/91)

In article <26276@know.pws.bull.com> aq696@cleveland.Freenet.Edu (Charles Perlingiero) writes:
>
>I have a couple questions...
>
>First, the locations in ProDOS that contain the minute and the hour will
>not change while a program is running, why?  I wanted to have a clock
>routine in my program, but these locations (49042=minute, 49043=hour) do not
>update when the program is running.  Also, does anyone know if there is
>a second location?  I'm sure ProDOS reads the clock continuously, but how
>can I access it?

ProDOS doesn't read the clock continuously.  It reads the clock whenever it
gets asked to do something for which a time might be necessary.

You can force ProDOS to read the clock and update the time locations by
calling the MLI routine GET_TIME from machine language:

     JSR $BF00     ;Call ProDOS MLI
     DFB $82       ;$82 = GET_TIME
     DW  $0000     ;GET_TIME doesn't use a parameter list
     ...           ;Your code continues here

Thus, to read the clock from BASIC, first POKE the following machine
language routine into memory (put it anywhere you have a few free bytes--it's
relocatable):

     32,0,191,130,0,0,96

Then, whenever you need to read the time, CALL the machine language
routine, and PEEK the time out of the ProDOS global page.

Of course, this won't work if you don't have a clock in your Apple.

>Second, does anyone know if there is direct memory location that will send
>a byte directly to slot 2 (modem)?  And if there is one that will read the
>buffer (like the keyboard scan)?

Well...after you do a PRINT D$;"PR#2", everything you PRINT will go to the
modem, and GET and INPUT will read from the modem (assuming your modem is
in slot 2).

		    - Neil Parker
--
Neil Parker                 No cute ASCII art...no cute quote...no cute
parkern@jacobs.cs.orst.edu  disclaimer...no deposit, no return...
parker@corona.uoregon.edu   (This space intentionally left blank:           )

mattd@Apple.COM (Matt Deatherage) (05/25/91)

In article <26276@know.pws.bull.com> aq696@cleveland.Freenet.Edu (Charles Perlingiero) writes:
>
>First, the locations in ProDOS that contain the minute and the hour will
>not change while a program is running, why?  I wanted to have a clock
>routine in my program, but these locations (49042=minute, 49043=hour) do not
>update when the program is running.  Also, does anyone know if there is
>a second location?  I'm sure ProDOS reads the clock continuously, but how
>can I access it?
>
>| Charles Perlingiero                 | Interests: Apple II's & Guitars       |

It doesn't read the clock continuously -- to do so would be a waste of CPU
time because ProDOS only needs the time when a ProDOS call is made.  It updates
the time in the global page whenever a ProDOS MLI call is made.  In assembly,
the easiest thing to use is the GET_TIME call which does nothing but update
the time on the global page.  From BASIC, PRINT CHR$(4)"FLUSH" will accomplish
the same thing (even if no files are open).
-- 
============================================================================
Matt Deatherage, Developer Technical  | The opinions expressed herein are
Support, Apple Computer, Inc.         | not those of Apple Computer, and
Personal mail only, please.  Thanks.  | shame on you for thinking otherwise.
^^^^^^^^ Technical questions are not personal. Please post them instead.
============================================================================

ericmcg@pnet91.cts.com (Eric Mcgillicuddy) (05/25/91)

The time values are updated when writing to disk, amongst others. Verify a
file and read the time, I think this will do the trick. Create a known file in
assembler if you are doing it that way and ignore the error message (works for
me :). 

There might be a Time function included in a later version of Basic.System, I
know ther are several add-on cammands that do this.

UUCP: bkj386!pnet91!ericmcg
INET: ericmcg@pnet91.cts.com