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 >
Commodore BASIC  |  2022-10-26  |  1KB  |  63 lines

  1. 5 rem *** real time digital clock ***
  2. 6 rem ***   12 hour and alarm     ***
  3. 7 :
  4. 8 rem setup and initialise clock ***
  5. 9 :
  6. 10 poke53281,0:poke53280,0:an=0
  7. 20 gosub200
  8. 30 ti$ = h$+m$+s$
  9. 40 gosub300
  10. 50 gosub500
  11. 97 :
  12. 98 rem *** main processing loop ***
  13. 99 :
  14. 100 if left$(ti$,2)="13" then gosub 400
  15. 110 h1$=left$(ti$,2)
  16. 120 m1$=mid$(ti$,3,2)
  17. 130 s1$=right$(ti$,2)
  18. 140 print "[145][145][150]" spc(14) h1$ spc(1) m1$ spc(1) s1$ spc(1) am$ ""
  19. 150 if al then if al$=ti$ then al=2
  20. 160 if al=2 then gosub450
  21. 170 geta$:if a$<>"" then al=0:poke53280,0
  22. 180 goto100
  23. 196 :
  24. 197 rem     *** input section ***
  25. 198 rem *** am/pm hours/mins/secs ***
  26. 199 :
  27. 200 input"[147]am/pm";am$:if len(am$)>2 then 200
  28. 210 am$=""+am$
  29. 220 input "[147]hours";h$:  if len(h$)>2 then 220
  30. 230 input "[147]minutes";m$:if len(m$)>2 then 230
  31. 240 input "[147]seconds";s$:if len(s$)>2 then 240
  32. 250 return
  33. 297 :
  34. 298 rem *** set alarm ****
  35. 299 :
  36. 300 print "[147]set alarm <y or n>?"
  37. 310 get k$:if k$="" then 310
  38. 320 if k$="y" then 350
  39. 330 if k$<>"n" then 310
  40. 340 return
  41. 350 gosub 220
  42. 360 al$ = h$+m$+s$: al=1
  43. 370 return
  44. 397 :
  45. 398 rem ***  switch am - pm  ***
  46. 399 :
  47. 400 n$ = "01" + mid$(ti$,3,4): ti$=n$
  48. 410 if am$="am" then am$="pm":return
  49. 420 am$="am"
  50. 430 return
  51. 440 :
  52. 441 rem *** execute alarm ***
  53. 442 :
  54. 450 poke53280,x:x=x+1:if x>15 then x=0
  55. 460 return
  56. 497 :
  57. 498 rem *** print clock display ***
  58. 499 :
  59. 500 print "[147]"tab(13) "[213][192][192][178][192][192][178][192][192][178][192][192][201]"
  60. 510 print tab(13) "[221]  :  :  [221]  [221]"
  61. 520 print tab(13) "[202][192][192][177][192][192][177][192][192][177][192][192][203]"
  62. 530 return
  63.