
Apple II Computer Info
#############################################################################
### FILE : clocks
#############################################################################
### Created : Friday, September 27, 1996 Modified: Friday, September 27, 1996
### File Type: "TEXT" File Creator: "LMAN"
### File Size: 3460 bytes 3 KB
#############################################################################
Path: news.uiowa.edu!chi-news.cic.net!uwm.edu!lll-
winken.llnl.gov!enews.sgi.com!news.mathworks.com!newsfeed.internetmci.com!news.uor
egon.edu!cie-2.uoregon.edu!nparker
Newsgroups: comp.sys.apple2
Subject: Re: Clock, BASIC, and IIgs
Date: 12 Jun 1996 07:52:02 GMT
Organization: University of Oregon Campus Information Exchange
Lines: 86
NNTP-Posting-Host: cie-2.uoregon.edu
>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
Then you can PEEK the time and date out of the ProDOS global page. The
minute is PEEK(49042), and the hour is PEEK(49043). The date is in
PEEK(49040) and PEEK(49041), but after PEEKing it, you have to unpack it
before you can use it (see the example below).
10 FOR X = 0 TO 6: READ Y: POKE 768 + X,Y: NEXT
20 DATA 32,0,191,130,0,0,96: REM Machine code
30 CALL 768
40 HR = PEEK (49043): REM Hour (0..23)
50 MI = PEEK (49042): REM Minute (0..59)
60 D = PEEK (49040) + 256 * PEEK (49041)
70 X = INT (D / 32)
80 DA = D - 32 * X: REM Day (1..31)
90 D = X:X = INT (D / 16)
100 MO = D - 16 * X: REM Month (1..12)
110 YR = X + 1940: REM Year (1940..2039)
If the day and the month are both zero, then either no clock is available,
Apple II Computer Technical Information : Apple II Family Hardware Info
ftp://ground.ecn.uiowa.edu/2/apple2/miscinfo/hardware : May 2001 : 67 of 572
Kommentare zu diesen Handbüchern