Advertisement
Guest User

debounce.bas

a guest
Jun 11th, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1.  
  2. dim rand16 = z
  3.  
  4. dim sw = d
  5. dim debounce = e
  6. dim jf = f
  7. dim cntr = g
  8.  
  9. gosub clear
  10.  
  11. COLUPF = $4A
  12. COLUBK = $42
  13.  
  14. debounce = $00
  15.  
  16. main
  17.  
  18. if cntr <> 32 then skip_fire
  19.  
  20. temp1 = ((jf ^ $80) | INPT4) & $80 : jf = INPT4
  21. if temp1 then goto draw
  22. cntr = 0
  23.  
  24. skip_fire
  25. sw = 0
  26. if cntr & $08 then sw = sw - 1
  27. temp1 = (cntr ^ $04) & $04
  28. if temp1 then sw = rand
  29. gosub debounce
  30.  
  31. if cntr & $08 then pfpixel cntr 0 on else pfpixel cntr 0 off
  32. if sw & 1 then pfpixel cntr 1 on else pfpixel cntr 1 off
  33. if debounce & 1 then pfpixel cntr 2 off else pfpixel cntr 2 on
  34.  
  35. if c & 1 then pfpixel cntr 4 on else pfpixel cntr 4 off
  36. if b & 1 then pfpixel cntr 5 on else pfpixel cntr 5 off
  37. if a & 1 then pfpixel cntr 6 on else pfpixel cntr 6 off
  38.  
  39. cntr = cntr + 1
  40.  
  41. draw
  42. drawscreen
  43. goto main
  44.  
  45.  
  46.  
  47.  
  48. debounce
  49. temp1 = sw ^ debounce
  50.  
  51. rem reset counter
  52. b = b | temp1
  53. a = a | temp1
  54.  
  55. rem increment counter
  56. b = b ^ a
  57. a = a ^ $FF
  58.  
  59. rem if the counter has counted to three toggle debounce
  60. debounce = (b & a) ^ debounce
  61. return
  62.  
  63. clear
  64. playfield:
  65. ................................
  66. ................................
  67. ................................
  68. ................................
  69. ................................
  70. ................................
  71. ................................
  72. ................................
  73. ................................
  74. ................................
  75. ................................
  76. ................................
  77. end
  78. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement