home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_16_1987_Transactor_Publishing.d64 / time-of-day (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  492b  |  24 lines

  1. 100 rem tod clock example
  2. 110 gosub 150: print chr$(147)
  3. 120 gosub 260: print t$;chr$(19)
  4. 130 goto 120
  5. 140 :
  6. 150 rem set and start the clock
  7. 160 ba=56331: rem cia#1
  8. 170 input"enter the time (hhmmss)";t$
  9. 180 if len(t$)<>6 then 170
  10. 190 for x=0 to 5 step 2
  11. 200 y=val(mid$(t$,x+1,2))
  12. 210 y=int(y/10)*16+(y-int(y/10)*10)
  13. 220 poke ba-x/2,y: next x
  14. 230 poke ba-3,0
  15. 240 return
  16. 250 :
  17. 260 rem read the time
  18. 270 t$="":m$=" am":for x=0 to 5 step 2
  19. 280 t2$=str$((peek(ba-x/2)and 112)/16) + str$(peek(ba-x/2)and 15)
  20. 290 t$=t$+mid$(t2$,2,1)+mid$(t2$,4,1)
  21. 300 if x<>4 then t$=t$+":"
  22. 310 next x: x=peek(ba-3)
  23. 320 return
  24.