SHARE
TWEET

snake.asm

a guest Dec 28th, 2013 292 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. ifn c, 0
  34. mul [t], c
  35. xor [t], 0xFFFF
  36. set a, [dir]
  37. ife c, 0x0080  
  38. set [dir], 65504  
  39. ife c, 0x0081  
  40. set [dir], 32  
  41. ife c, 0x0082  
  42. set [dir], 65535  
  43. ife c, 0x0083  
  44. set [dir], 1  
  45. set b, a
  46. add b, [dir]
  47. ife b, 0
  48. set [dir], a
  49. ifn [snakel], [snakelength]  
  50. add [snakel], 1              
  51. set i, [snakel]
  52. add i, 0x5000  
  53. set j, [i]
  54. add j, 0x8000
  55. ife j, 0x8000
  56. set pc, _l1
  57. ifn [j], 0x504f
  58. set [j], 0
  59. :_l1  
  60. set [i], [i+0xFFFF]  
  61. sub i, 1  
  62. ife i, 0x5000  
  63. set pc, _b1  
  64. set pc, _l1
  65. :_b1
  66. add [0x5000], [dir]  
  67. set a, [0x5000]  
  68. set b, a
  69. mod b, 32
  70. ife b, 0
  71. set pc, die
  72. ife b, 31  
  73. set pc, die  
  74. set b, a
  75. div b, 32
  76. ife b, 0
  77. set pc, die
  78. ife b, 11  
  79. set pc, die  
  80. set i, 0x5000
  81. add i, [snakel]  
  82. :_l2  
  83. ife a, [i]  
  84. set pc, die  
  85. sub i, 1  
  86. ife i, 0x5000  
  87. set pc, _b2  
  88. set pc, _l2
  89. :_b2
  90. ifn a, [food]  
  91. set pc, _e0
  92. add [snakelength], 1  
  93. jsr genfood  
  94. :_e0
  95. set a, [0x5000]  
  96. add a, 0x8000
  97. set [a], 0xA053
  98. jsr wait  
  99. set pc, _l0
  100. :wait  
  101. set i, 0x05FF  
  102. :_l4  
  103. ife i, 0  
  104. set pc, pop  
  105. sub i, 1  
  106. set pc, _l4
  107. :rand  
  108. set a, [t]  
  109. set b, a
  110. xor a, [0x5000]  
  111. add a, [snakelength]  
  112. set b, a
  113. mod b, 0x180
  114. set b, [b+0x8000]
  115. add b, 1
  116. mul a, b
  117. set c, a
  118. shl c, 8
  119. shr a, 8
  120. bor a, c  
  121. set [t], a
  122. set z, a
  123. set pc, pop  
  124. :die  
  125. set i, 0x8000  
  126. :_l3  
  127. jsr rand
  128. set [i], z  
  129. add i, 1  
  130. ife i, 0x8180
  131. set i, 0x8000
  132. set pc, _l3
  133. :genfood  
  134. jsr rand  
  135. mod z, 384
  136. set x, z
  137. mod x, 32  
  138. set y, z
  139. div y, 32  
  140. ife x, 0  
  141. add z, 1  
  142. ife x, 31  
  143. sub z, 1  
  144. ife y, 0  
  145. add z, 32  
  146. ife y, 11  
  147. sub z, 32  
  148. set [food], z  
  149. add z, 0x8000
  150. set [z], 0x504f  
  151. set pc, pop
  152. :snakelength
  153. dat 2  
  154. :snakel
  155. dat 0  
  156. :food
  157. dat 0x6000  
  158. :dir
  159. dat 0x0001  
  160. :t
  161. 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