[comp.binaries.apple2] set time in prodos with no clock ALL ]['s

nakada@husc7.HARVARD.EDU (Paul Nakada) (04/18/88)

From APPLE2-L@BROWNVM.BITNET Sun Apr 17 21:58:38 1988
Received: from husc6.harvard.edu (husc6.ARPA) by husc4.HARVARD.EDU; Sun, 17 Apr 88 21:57:04 est
Received: from BROWNVM by husc6.harvard.edu with BITNET; Sun, 17 Apr 88 21:49:05 EDT
Received: by BOSTONU (Mailer X1.25) id 4229; Sun, 17 Apr 88 21:48:17 EDT
Date:         Sun, 17 Apr 88 21:46:52 EDT
Reply-To: Apple II List <APPLE2-L@brownvm>
Sender: Apple II List <APPLE2-L@brownvm>
Comments:     Resent-From: Christopher Chung <CHRIS@BROWNVM>
Comments:     Originally-From: Grant Delaney <delaney@wnre.aecl.cdn>
From: Christopher Chung <CHRIS@brownvm>
Subject:      Set time in prodos without a clock
To: Paul Nakada <NAKADA@harvunxu>
Status: R

Here is a program in basic to set you clock time it contains the revisions
by Brown in Aug 86 InSider and Feb 88 by paris in Call A.P.P.L.E. .

edit it first line 105 was too long to mail so I added an unwanted carrage
return so the servers could handle it


NEW
5DD=PEEK(49040):IFDD<>0THEN1345
10BL$="                                      "
20S1$="***************************************"
30S2$="*                                     *"
35MO$="???JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC"
40HOME
50?S1$:?S2$
60?"*     SYSTEM DATE AND TIME UTILITY    *"
70?S2$:?S1$
80VTAB10
90REM
100REM- READ SYSTEM DATE
110REM
120DD=PEEK(49040)-INT(PEEK(49040)/32)*32
130YY=INT(PEEK(49041)/2)
140MM=(PEEK(49041)-YY*2)*8+INT(PEEK(49040)/32)
145MM$=MID$(MO$,MM*3+1,3)
150REM
160REM- READ SYSTEM TIME
170REM
180MI=PEEK(49042)
190HH=PEEK(49043)
200REM
210REM- CONVERT 24 HOURS TO 12
220REM
230IFHH>11THENPM=1
240IFHH>12THENHH=HH-12
250IFHH=0THENHH=12
260?"       THE CURRENT SETTINGS ARE:"
270?:?
280REM
290REM- PRINT DATE AND TIME
300REM
310?"             DATE: ";
320IFDD=0THEN?"<NO DATE>":GOTO380
340IFDD<10THEN?"0";
350?DD;"-";
355?MM$;"-";
360IFYY<10THEN?"0";
370?YY
380?
390?"             TIME: ";
393IFHH=12ANDMI=0ANDDD=0THEN?"<NO TIME>":GOTO460
400IFHH<10THEN?"0";
410?HH;":";
420IFMI<10THEN?"0";
430?MI;
440IFPM=1THEN?"  PM"
450IFPM=0THEN?"  AM"
460VTAB18
470?"<ESC> FOR DEFAULT:JAN 1 00"
475?"    SET SYSTEM DATE AND TIME? Y/N/ESC";
480GETA$
490VTAB18:HTAB2:?BL$:?BL$
500IFA$="N"ORA$="n"THENVTAB22:END
505IFA$=CHR$(27)THENSP=1:GOTO1345
510VTAB13
520?"       ENTER DATE: DD-MMM-YY";
530REM
535REM -READ DAY INTO DD
540REM
545HTAB20:?"DD";:HTAB20
550GETA$:IF(A$<"0")OR(A$>"3")GOTO545
555DD=VAL(A$):?A$;
560GETA$:IF(A$<"0")OR(A$>"9")GOTO545
565DD=DD*10+VAL(A$):?A$;
570IFDD>31ORDD<1GOTO545
572REM
574REM GET MONTH INTO M1$
576REM
580HTAB23:?"MMM";:HTAB23:COUNT=1:M1$=""
585GETA$:IFASC(A$)>90THENA$=CHR$(ASC(A$)-32)
586M1$=M1$+A$:?A$;:MM=4
587IFM1$=MID$(MO$,MM,COUNT)THENGOTO595
588MM=MM+3:IFMM<39THENGOTO587
589GOTO580
595COUNT=COUNT+1:IFCOUNT<4THENGOTO585
600MM=(MM-1)/3
710REM
720REM-READ YEAR INTO YY
730REM
740HTAB27:?"YY";:HTAB27
750GETA$:IF(A$<"0")OR(A$>"9")GOTO740
760YY=VAL(A$):?A$;
770GETA$:IF(A$<"0")OR(A$>"9")GOTO740
780YY=YY*10+VAL(A$):?A$
790REM
800REM-REPEAT UNTIL CORRECT
810REM
820VTAB18:?"             CORRECT? Y/N ";
830GETA$
840VTAB18:HTAB2:?BL$
850IFA$="N"ORA$="n"GOTO510
860VTAB13:HTAB8:?"     ":VTAB15:HTAB8
870?"ENTER TIME: HH:MM  AM";
880REM
890REM-READ HOUR INTO HH
900REM
910HTAB20:?"HH";:HTAB20
920GETA$:IFA$=CHR$(27)THENSKP=1:GOTO1240
925IF(A$<"0")OR(A$>"1")GOTO910
930HH=VAL(A$):?A$;
940GETA$:IF(A$<"0")OR(A$>"9")GOTO910
950HH=10*HH+VAL(A$):?A$;
960IFHH>12ORHH<1GOTO910
970REM
980REM-READ MINUTE INTO MI
990REM
1000HTAB23:?"MM";:HTAB23
1010GETA$:IF(A$<"0")OR(A$>"5")GOTO1000
1020MI=VAL(A$):?A$;
1030GETA$:IF(A$<"0")OR(A$>"9")GOTO1000
1040MI=10*MI+VAL(A$):?A$;
1050IFMI>59GOTO1000
1060REM
1070REM-GET AM OR PM
1080REM
1090HTAB27
1100GETP$
1105IF(P$<>"A")AND(P$<>"a")AND(P$<>"P")AND(P$<>"p")AND(P$<>" ")
AND(P$<>CHR$(13))GOTO1090
1110IF(P$="P")OR(P$="p")THEN?"P";
1120REM
1130REM-REPEAT UNTIL CORRECT
1140REM
1150VTAB18:HTAB2:?"            CORRECT? Y/N ";
1160GETA$
1170VTAB18:HTAB2:?BL$
1180IF(A$<>"N")AND(A$<>"n")GOTO1200
1190GOTO860
1200VTAB15:HTAB8:?"     "
1210REM
1220REM-UPDATE SYSTEM DATE
1230REM
1240POKE49041,YY*2+(MM>7)
1250IFMM>7THENPOKE49040,(MM-8)*32+DD
1260IFMM<8THENPOKE49040,MM*32+DD
1265IFSKTHENGOT1345
1270REM
1280REM-UPDATE SYSTEM TIME (24 HOUR CLOCK)
1290REM
1300IFHH=12THENHH=0
1310IFP$="P"ORP$="p"THENHH=HH+12
1320POKE49043,HH:POKE49042,MI
1330?:VTAB20:?"      SYSTEM DATE AND TIME UPDATED":?
1340?"  (DOES NOT SET CLOCK/CALENDAR CARDS)"
1345POKE48902,76:POKE48903,214:POKE48904,3:REM VECTOR TO USER ROUTINE AT $3D6
1346POKE982,238:POKE983,146:POKE984,191:POKE985,173:POKE986,146:POKE987,191
1347POKE988,201:POKE989,60:POKE990,208:POKE991,8:POKE992,169:POKE993,0
1348POKE994,141:POKE995,146:POKE996,191:POKE997,238:POKE998,147:POKE999,191
1349POKE1000,96
1350IFSP=1THENPOKE49040,33:POKE49041,0
1351?CHR$(4);"CATALOG"
1352END
SAVE TIME.SET