Newsgroups: comp.sys.apple2.programmer
Path: news.weeg.uiowa.edu!nexus.uiowa.edu!uunet!europa.eng.gtefsd.com!howland.reston.ans.net!agate!dog.ee.lbl.gov!newshub.nosc.mil!crash!pro-ict!shack
From: shack@pro-ict.cts.com (Randy Shackelford)
Subject: Re: How to read GS clock in BASIC?
Organization: ProLine [pro-ict] -- Wichita, KS
Date: Thu, 23 Dec 93 22:23:44 CDT
Message-ID: <ln82172@pro-ict.cts.com>
In-Reply-To: dempson@swell.actrix.gen.nz (David Empson)
Lines: 56

dempson@swell.actrix.gen.nz (David Empson) writes:

>This program is reading the current time from ProDOS.  Strictly
>speaking, you should make a call to ProDOS first, so that it re-reads
>the clock.  (It would be fine if you ran the program from disk, but if
>you waited a minute and ran it again using RUN without a filename,
>then it would report the same time.)  The addition of a "FLUSH" or some
>other simple call fixes this, as I've shown above.
>
>The "IF" on the end of line 20 is unnecessary, since it is also done
>on line 40.
>
>Reading the date involves a copule of other peeks, but the data is
>harder to decode.  I don't have time to describe this right now, so
>I'll post another message shortly.
>
>ProDOS doesn't provide the seconds or day of week.  If you want those,
>you'll have to read the IIgs clock more directly (making a toolbox
>call).  This requires using a machine code routine.

Try this BASIC program. It pokes a routine for reading the internal clock into
memory and calls it repeatedly and displays the result. Here it is in binSCII:
 
FiLeStArTfIlEsTaRt
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789()
JBASICCLOCK     AEAFAAAABw)4BEAC6eEAXOAHW4wuAEAFAML3
KggCxALAAADMUgAEAcJAegQG3wIAAgjNogwJirLApIDKiojI6AwOAIDCoIerRnSM
EDTMwIiuAsjI8gASirLApEDKiojIbBwOAYECoIerRnCMEDTMwIiuAsjIQhQZirLA
pADKIMHAWCgWiqTMrqTMAAzMkhQjJFIA2cD04EMO6UDM6g1hskUuCqDWNAQSA4WC
2UzgyMDLxMDL1IDLxwCNsYzNsEzMsQjMxUjM5EDL0wCNxwCOxwSMxwSMxwSMxwSM
sIjNxwyMzwyMwwCNsADL1IjMwEDLxwCNsMzMxwCMsQDMzMTMsIDL0ATMzEDL0wyM
wEDLxwCNsMzMywiNsYjMsgDNsYTNxUjM2kDLJMBAxCAeAAAAAAAAAAAAAAAAAAAA
AMvg
 
Here's a listing too:
 
 10  GOSUB 100
 20  HOME
 30  CALL 768
 40  PRINT  PEEK (2)":";
 50  IF  PEEK (1) < 10 THEN  PRINT "0";
 60  PRINT  PEEK (1)":";
 70  IF  PEEK (0) < 10 THEN  PRINT "0";
 80  PRINT  PEEK (0)
 90  HTAB 1: VTAB 1: GOTO 30
 100  FOR I = 768 TO 805: READ X: POKE I,X: NEXT I
 110  DATA
56,32,31,254,176,31,24,251,194,48,11,11,11,11,162,3,13,34,0,0,225,104,133,0,104
133,2,104,133,4,104,133,6,226,48,56,251,96
 120  RETURN
 

--
Randy Shackelford                              "That's right, keep dancing
shack@pro-ict.cts.com                           on the minefield"
                                                                 -Al Bundy
