' datetime ' HAPPY NEW YEAR! ' PRINT "Welcome to the Digital Insanity" PRINT "experience..." PRINT t%=(XBIOS(23))/65536 dag%=(t% AND 31) mnd%=(t% AND 480)/32 jaar%=(t% AND 65024)/512 IF (dag%<=0 OR dag%>31) OR (mnd%<=0 OR mnd%>12) OR (jaar%<=0 OR jaar%>119) @invoer ELSE ADD jaar%,80 PRINT "According to some internal clocks" PRINT "and other stuff, I know the following:" PRINT IF dag%<10 d\$="0" ENDIF d\$=d\$+STR\$(dag%)+"-" IF mnd%<10 d\$=d\$+"0" ENDIF d\$=d\$+STR\$(mnd%)+"-"+STR\$(jaar%) PRINT "Date:"'d\$ PRINT AT(1,10);"Press RETURN to change these values," PRINT AT(1,11);"any other key to exit" REPEAT t%=XBIOS(23) sec%=(t% AND 31)*2 min%=(t% AND 2016)/32 uur%=(t% AND 63488)/2048 IF uur%<10 t\$="0"+STR\$(uur%)+":" ELSE t\$=STR\$(uur%)+":" ENDIF IF min%<10 t\$=t\$+"0" ENDIF t\$=t\$+STR\$(min%)+":" IF sec%<10 t\$=t\$+"0" ENDIF t\$=t\$+STR\$(sec%) PRINT AT(1,8);"Time: ";t\$ k\$=INKEY\$ UNTIL k\$<>"" IF k\$=CHR\$(13) @invoer ENDIF ENDIF ' set keyboard date and time (reset-resistant) t%=1 DPOKE VARPTR(t%),dag% OR mnd%*32 OR (jaar%-80)*512 DPOKE VARPTR(t%)+2,(sec%/2) OR (min%*32) OR (uur%*2048) VOID XBIOS(22,L:t%) ' set GEMDOS date and time (for our files) t%=dag% OR mnd%*32 OR (jaar%-80)*512 VOID GEMDOS(&H2B,t%) t%=(sec%/2) OR (min%*32) OR (uur%*2048) VOID GEMDOS(&H2D,t%) ' PROCEDURE invoer PRINT AT(1,4);"Please enter the values " PRINT AT(1,5);"for the date and the time: " PRINT AT(1,10);STRING\$(39," ") PRINT AT(1,11);STRING\$(39," ") REPEAT PRINT AT(1,7);"Date: "; FORM INPUT 8 AS d\$ ok!=TRUE x\$=d\$ @getdigit dag%=VAL(dig\$) IF dag%>0 AND dag%<32 @getdigit mnd%=VAL(dig\$) IF mnd%>0 AND mnd%<13 @getdigit jaar%=VAL(dig\$) IF jaar%<80 OR jaar%>99 ok!=FALSE ENDIF ELSE ok!=FALSE ENDIF ELSE ok!=FALSE ENDIF d\$="" PRINT AT(1,7);"Date: "; UNTIL ok!=TRUE IF dag%<10 d\$="0" ENDIF d\$=d\$+STR\$(dag%)+"-" IF mnd%<10 d\$=d\$+"0" ENDIF d\$=d\$+STR\$(mnd%)+"-"+STR\$(jaar%) PRINT AT(1,7);"Date: ";d\$ REPEAT PRINT AT(1,8);"Time: "; FORM INPUT 8 AS t\$ ok!=TRUE x\$=t\$ @getdigit uur%=VAL(dig\$) IF uur%>=0 AND uur%<25 @getdigit min%=VAL(dig\$) IF min%>0 AND min%<60 @getdigit sec%=VAL(dig\$) IF sec%<0 OR sec%>59 ok!=FALSE ENDIF ELSE ok!=FALSE ENDIF ELSE ok!=FALSE ENDIF t\$="" PRINT AT(1,8);"Time: "; UNTIL ok!=TRUE IF uur%<10 t\$="0"+STR\$(uur%)+":" ELSE t\$=STR\$(uur%)+":" ENDIF IF min%<10 t\$=t\$+"0" ENDIF t\$=t\$+STR\$(min%)+":" IF sec%<10 t\$=t\$+"0" ENDIF t\$=t\$+STR\$(sec%) PRINT AT(1,8);"Time: ";t\$ RETURN ' PROCEDURE getdigit dig\$="" c\$=LEFT\$(x\$) IF INSTR("0123456789",LEFT\$(x\$,1))<>0 dig\$=c\$ x\$=RIGHT\$(x\$,LEN(x\$)-1) c\$=LEFT\$(x\$) IF INSTR(" :;-./\|'",c\$)=0 IF INSTR("0123456789",c\$)<>0 dig\$=dig\$+c\$ x\$=RIGHT\$(x\$,LEN(x\$)-1) ELSE dig\$="" ENDIF ENDIF WHILE INSTR(" :;-./\|'",LEFT\$(x\$))<>0 x\$=RIGHT\$(x\$,LEN(x\$)-1) WEND ENDIF RETURN