home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disk User Volume 4 #8
/
Commodore_Disk_User_Vol.4_8_1991_-.d64
/
bb.eg#1
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
1KB
|
63 lines
5 rem *** real time digital clock ***
6 rem *** 12 hour and alarm ***
7 :
8 rem setup and initialise clock ***
9 :
10 poke53281,0:poke53280,0:an=0
20 gosub200
30 ti$ = h$+m$+s$
40 gosub300
50 gosub500
97 :
98 rem *** main processing loop ***
99 :
100 if left$(ti$,2)="13" then gosub 400
110 h1$=left$(ti$,2)
120 m1$=mid$(ti$,3,2)
130 s1$=right$(ti$,2)
140 print "[145][145][150]" spc(14) h1$ spc(1) m1$ spc(1) s1$ spc(1) am$ ""
150 if al then if al$=ti$ then al=2
160 if al=2 then gosub450
170 geta$:if a$<>"" then al=0:poke53280,0
180 goto100
196 :
197 rem *** input section ***
198 rem *** am/pm hours/mins/secs ***
199 :
200 input"[147]am/pm";am$:if len(am$)>2 then 200
210 am$=""+am$
220 input "[147]hours";h$: if len(h$)>2 then 220
230 input "[147]minutes";m$:if len(m$)>2 then 230
240 input "[147]seconds";s$:if len(s$)>2 then 240
250 return
297 :
298 rem *** set alarm ****
299 :
300 print "[147]set alarm <y or n>?"
310 get k$:if k$="" then 310
320 if k$="y" then 350
330 if k$<>"n" then 310
340 return
350 gosub 220
360 al$ = h$+m$+s$: al=1
370 return
397 :
398 rem *** switch am - pm ***
399 :
400 n$ = "01" + mid$(ti$,3,4): ti$=n$
410 if am$="am" then am$="pm":return
420 am$="am"
430 return
440 :
441 rem *** execute alarm ***
442 :
450 poke53280,x:x=x+1:if x>15 then x=0
460 return
497 :
498 rem *** print clock display ***
499 :
500 print "[147]"tab(13) "[213][192][192][178][192][192][178][192][192][178][192][192][201]"
510 print tab(13) "[221] : : [221] [221]"
520 print tab(13) "[202][192][192][177][192][192][177][192][192][177][192][192][203]"
530 return