SHARE
TWEET

snake.asm

a guest Dec 28th, 2013 204 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set [0x5000], 76  
  2. jsr genfood  
  3. set a, 0
  4. set b, 0x8000
  5. hwi 0  
  6. set i, 351
  7. :_l8
  8. set [i+0x8000], 0x4023
  9. add i, 1
  10. ifn i, 384
  11. set pc, _l8
  12. set i, 31
  13. :_l7
  14. set [i+0x8000], 0x4023
  15. add i, 32
  16. ifn i, 415
  17. set pc, _l7
  18. set i, 0
  19. :_l5
  20. set [i+0x8000], 0x4023
  21. add i, 1
  22. ifn i, 32
  23. set pc, _l5
  24. set i, 0
  25. :_l6
  26. set [i+0x8000], 0x4023
  27. add i, 32
  28. ifn i, 384
  29. set pc, _l6
  30. :_l0  
  31. set a, 1
  32. hwi 1  
  33. set a, [dir]
  34. ife c, 0x0080  
  35. set [dir], 65504  
  36. ife c, 0x0081  
  37. set [dir], 32  
  38. ife c, 0x0082  
  39. set [dir], 65535  
  40. ife c, 0x0083  
  41. set [dir], 1  
  42. set b, a
  43. add b, [dir]
  44. ife b, 0
  45. set [dir], a
  46. ifn [snakel], [snakelength]  
  47. add [snakel], 1              
  48. set i, [snakel]
  49. add i, 0x5000  
  50. set j, [i]
  51. add j, 0x8000
  52. ifn j, 0x8000
  53. set [j], 0  
  54. :_l1  
  55. set [i], [i+0xFFFF]  
  56. sub i, 1  
  57. ife i, 0x5000  
  58. set pc, _b1  
  59. set pc, _l1
  60. :_b1
  61. add [0x5000], [dir]  
  62. set a, [0x5000]  
  63. set b, a
  64. mod b, 32
  65. ife b, 0
  66. set pc, die
  67. ife b, 31  
  68. set pc, die  
  69. set b, a
  70. div b, 32
  71. ife b, 0
  72. set pc, die
  73. ife b, 11  
  74. set pc, die  
  75. set i, 0x5000
  76. add i, [snakel]  
  77. :_l2  
  78. ife a, [i]  
  79. set pc, die  
  80. sub i, 1  
  81. ife i, 0x5000  
  82. set pc, _b2  
  83. set pc, _l2
  84. :_b2
  85. ifn a, [food]  
  86. set pc, _e0
  87. add [snakelength], 1  
  88. jsr genfood  
  89. :_e0
  90. set a, [0x5000]  
  91. add a, 0x8000
  92. set [a], 0xA053
  93. jsr wait  
  94. set pc, _l0
  95. :wait  
  96. set i, 0x00FF  
  97. :_l4  
  98. ife i, 0  
  99. set pc, pop  
  100. sub i, 1  
  101. set pc, _l4
  102. :rand  
  103. set a, [t]  
  104. set b, a
  105. xor a, [0x5000]  
  106. add a, [snakelength]  
  107. set b, a
  108. mod b, 0x180
  109. set b, [b+0x8000]
  110. add b, 1
  111. mul a, b
  112. set c, a
  113. shl c, 8
  114. shr a, 8
  115. bor a, c  
  116. set [t], a
  117. set z, a
  118. set pc, pop  
  119. :die  
  120. set i, 0x8000  
  121. :_l3  
  122. jsr rand
  123. set [i], z  
  124. add i, 1  
  125. ife i, 0x8180
  126. set i, 0x8000
  127. set pc, _l3
  128. :genfood  
  129. jsr rand  
  130. mod z, 384
  131. set x, z
  132. mod x, 32  
  133. set y, z
  134. div y, 32  
  135. ife x, 0  
  136. add z, 1  
  137. ife x, 31  
  138. sub z, 1  
  139. ife y, 0  
  140. add z, 32  
  141. ife y, 11  
  142. sub z, 32  
  143. set [food], z  
  144. add z, 0x8000
  145. set [z], 0x504f  
  146. set pc, pop
  147. :snakelength
  148. dat 2  
  149. :snakel
  150. dat 0  
  151. :food
  152. dat 0x6000  
  153. :dir
  154. dat 0x0001  
  155. :t
  156. dat 0xAC71DCF1
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top