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

Re: Clock, BASIC, and IIgs



In article <4plsv2$rml@pith.uoregon.edu>,
Neil Parker <nparker@cie-2.uoregon.edu> wrote:
> In article <4plje3$2td@news.nevada.edu> snit@nevada.edu (Snit) writes:
> >Does anybody know how to access the clock from BASIC on a IIgs?  Is
> >there a way of doing something similaron a IIe (obviosly not wth the
> >real time, unless you have a clock added).  Specificly, I am trying to
> >record the times of a photosensor attached to PDL (0) into a text file
> >that can be imported into a spreadsheet or stats program.  Thanks...
> 
> There are no BASIC commands for accessing the clock--the only good way to
> do it is to call a machine-language routine.
> 
> The most portable way to access the clock is through ProDOS.  Your BASIC
> program calls this machine-language routine:
> 
>      JSR $BF00
>      DFB $82     ; GET_TIME
>      DW  0
>      RTS

It is much easier than that - ANY ProDOS MLI call will read the time
from the clock.  The GET_TIME call is just a dummy routine that
doesn't do anything else.

You can get ProDOS to read the clock by issuing any disk command in
the BASIC program which will call the MLI.  A simple "FLUSH" is
probably sufficient.

This doesn't change the second part - you still have to peek the time
out of the global page, and you still have to use a clock-specific
method if you want time to better than one minute resolution.
-- 
David Empson
dempson@actrix.gen.nz
Snail mail: P.O. Box 27-103, Wellington, New Zealand