home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_16_1987_Transactor_Publishing.d64
/
time-of-day
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
492b
|
24 lines
100 rem tod clock example
110 gosub 150: print chr$(147)
120 gosub 260: print t$;chr$(19)
130 goto 120
140 :
150 rem set and start the clock
160 ba=56331: rem cia#1
170 input"enter the time (hhmmss)";t$
180 if len(t$)<>6 then 170
190 for x=0 to 5 step 2
200 y=val(mid$(t$,x+1,2))
210 y=int(y/10)*16+(y-int(y/10)*10)
220 poke ba-x/2,y: next x
230 poke ba-3,0
240 return
250 :
260 rem read the time
270 t$="":m$=" am":for x=0 to 5 step 2
280 t2$=str$((peek(ba-x/2)and 112)/16) + str$(peek(ba-x/2)and 15)
290 t$=t$+mid$(t2$,2,1)+mid$(t2$,4,1)
300 if x<>4 then t$=t$+":"
310 next x: x=peek(ba-3)
320 return