home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1993 July / 1993-07.d64 / userport.bb (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  1KB  |  48 lines

  1. 10 p=56577:rem user port
  2. 20 pokep+2,255:rem all pins output
  3. 30 pokep,0:rem all pins low
  4. 40 printchr$(147):poke53281,14:poke646,6
  5. 50 print"set clock at:"
  6. 60 r=8:gosub290:k=43200:rem 43200 seconds in 12 hours
  7. 70 ifi$="pm"thenx=k
  8. 80 fori=1to3:h=int(t(i)/10):l=t(i)-10*h:t(i)=16*h+l:next
  9. 90 c=56331:pokec,t(1):pokec-1,t(2):pokec-2,t(3)
  10. 100 print"activate user port at:"
  11. 110 r=18:gosub290
  12. 120 ifi$="pm"theny=k
  13. 130 b=y+t(1)*3600+t(2)*60+t(3)
  14. 140 print"press any key to start clock.
  15. 150 [161]a$:[139]a$[178]""[167]150
  16. 160 [151]c[171]3,0
  17. 170 h[178][194](c):m[178][194](c[171]1):s[178][194](c[171]2):t[178][194](c[171]3)
  18. 180 c1$[178][199]((16[175]h)[173]16[170]48)[170][199]((15[175]h)[170]48)
  19. 190 h[178][197](c1$)[172]3600
  20. 200 [139]c1$[178]"00"[167]c1$[178]"12"
  21. 210 c2$[178][199]((240[175]m)[173]16[170]48)[170][199]((15[175]m)[170]48):m[178][197](c2$)[172]60
  22. 220 c3$[178][199]((240[175]s)[173]16[170]48)[170][199]((15[175]s)[170]48):s[178][197](c3$)
  23. 230 a[178]x[170]h[170]m[170]s:[139]a[178]2[172]k[167][151]c,0:[151]c[171]3,0:x[178]0
  24. 240 [139]a[178]b[167]420
  25. 250 [139]a[179]k[167]j$[178]"am":[137]270
  26. 260 j$[178]"pm"
  27. 270 [153]"time is "c1$[170]":"[170]c2$[170]":"[170]c3$[170]":"t;j$[170]"on"
  28. 280 [137]170
  29. 290 h$[178]"":[133]"hours";h$:[139]h$[179]"0"[176]h$[177]"9"[167][153]"onon":[137]290
  30. 300 t(1)[178][197](h$):[139]t(1)[179]0[176]t(1)[177]12[167][153]"onon":[137]290
  31. 310 [139]t(1)[178]12[167]t(1)[178]0
  32. 320 m$[178]"":[133]"minutes";m$:[139]m$[179]"0"[176]m$[177]"9"[167][153]"ononon":[137]320
  33. 330 t(2)[178][197](m$):[139]t(2)[179]0[176]t(2)[177]59[167][153]"ononon":[137]320
  34. 340 s$[178]"":[133]"seconds";s$:[139]s$[179]"0"[176]s$[177]"9"[167][153]"ononon":[137]340
  35. 350 t(3)[178][197](s$):[139]t(3)[179]0[176]t(3)[177]59[167][153]"ononon":[137]340
  36. 360 [153]"am or pm (press a or p)"
  37. 370 [161]i$:[139]i$[179][177]"a"[167][139]i$[179][177]"p"[167]370
  38. 380 [139]i$[178]"a"[167]i$[178]"am":[137]400
  39. 390 i$[178]"pm"
  40. 400 [151]214,r:[153]:[151]211,24:[153]i$
  41. 410 [142]
  42. 420 [153]"loaduser port pin c on."
  43. 430 [153]"press any key to turn off.
  44. 440 pokep,1:rem turns on pin c
  45. 450 geta$:ifa$=""then450
  46. 460 pokep,0
  47. 470 print"user port pin c off."
  48.