[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to Read Clock/Calendar



Tim Aaronson writes ...
> 
> Can someone tell me how to read the  Clock Calendar on a IIgs?
> I want to access it via BASIC.
> This may be a hardware address or a memory address utilized by ProDos.
> 
> I want to time an application without having to use a timing loop. Just
> want to check the clock to the nearest second.,


     This short program (entered via the monitor at $0300) uses the
ReadAsciiTime tool to obtain and display the time and date:

300:18 FB C2 30 F4 00 00 F4 20 70 A2 03 0F 22 00 00 E1 38 FB A2
00 BD 20 70 9D 00 05 E8 E0 14 D0 F5 60


i.e.

 18
 FB
 C2 30
 F4 00 00
 F4 20 70
 A2 03 0F
 22 00 00 E1
 38
 FB
 A2 00 
 BD 20 70
 9D 00 05
 E8
 E0 14
 D0 F5
 60



     The program switches to Native (16-bit) mode, pushes the address
$00/7020 onto the stack, calls the READ ASCII TIME tool, exits Native mode,
and copies the Time info from $7020-$7033 to the screen starting at location
$00/0500. ($00/7020 sets the start of the Results workspace. Some other
location could be specified.)

     After entering the program from the monitor, get back to the BASIC
prompt (do a RESET or CTRL-B and RETURN).  Enter HOME to clear the screen.
If in 80-col mode enter ESC followed by CTRL-Q to get to 40-col mode.
Enter CALL 768. The date and time (at the moment you do the CALL) should be
displayed.

     The Seconds result from this program is at $702F-7030. It is in ASCII
with the Hi bit set. For example, 27 seconds would be "B2 B7". If you do not
want to display the date/time info, you would omit the code at the end which
moves the result to the Text screen area:

A2 00 BD 20 70 9D 00 05 E8 E0 14 D0 F5 



     There is a program selector/date/time/speed STARTUP program named
"SpeedGS" which illustrates the use of tools to read the clock in order to
provide a continuous time/date display and to obtain a loop timing value.
SpeedGS is a BASIC program which BLOADs and uses a small machine code file.
It is in a ShrinkIt file on Uni-kl.de at ...

ftp://ftp.uni-kl.de/pub/apple2/gs/utils/launchers/  .



Rubywand