Advertisement
Guest User

plothash.bas

a guest
Mar 30th, 2014
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.49 KB | None | 0 0
  1.  
  2. set optimization noinlinedata
  3.  
  4. dim counter = z
  5. dim current = b
  6. dim combined = c
  7. dim r16lo = d
  8. dim r16hi = e
  9. dim jflag = f
  10. dim sflags = g
  11. dim previous = p
  12. dim save_switches = s
  13. dim column = temp1
  14. dim row = temp2
  15. dim sc1 = score
  16. dim sc2 = score+1
  17. dim sc3 = score+2
  18. dim p0plo = player0pointerlo
  19. dim p0phi = player0pointerhi
  20. dim p1plo = player1pointerlo
  21. dim p1phi = player1pointerhi
  22. dim p0ptr = p0phi.p0plo
  23. dim p1ptr = p1phi.p1plo
  24. dim dtmp = temp2.temp1
  25.  
  26. const p0datlo = <p0dat
  27. const p0dathi = >p0dat
  28. const p1datlo = <p1dat
  29. const p1dathi = >p1dat
  30.  
  31.  
  32. COLUBK = 0
  33. COLUPF = $64
  34. COLUP0 = $28
  35. COLUP1 = $28
  36. scorecolor = $1E
  37. counter = 0
  38. r16lo = 7
  39.  
  40.  
  41. player0y = 88 : player1y = 88
  42. player0x = 144 : player1x = 152
  43.  
  44.  
  45. p0plo = p0datlo
  46. p0phi = p0dathi
  47. player0height = 4
  48.  
  49. p1plo = p1datlo
  50. p1phi = p1dathi
  51. player1height = 4
  52.  
  53. previous = rand
  54. sflags = $F0
  55. jflag = 0
  56.  
  57. main
  58. counter=counter+1
  59.  
  60. if !joy0fire then fire_up
  61. if jflag then skip_fire
  62. jflag = 1
  63. gosub cycle : goto skip_fire
  64.  
  65. fire_up
  66. if jflag then jflag = 0
  67.  
  68. skip_fire
  69. a = ((SWCHA ^ $F0) & sflags) & $F0 : sflags = SWCHA
  70.  
  71. if !a then skip_switches
  72.  
  73. if a{4} then y = y - 1
  74. if a{5} then y = y + 1
  75. if a{6} then x = x - 1
  76. if a{7} then x = x + 1
  77.  
  78. gosub do_scor
  79. gosub plot
  80.  
  81. skip_switches
  82. COLUP0 = $28
  83. COLUP1 = $28
  84.  
  85. drawscreen
  86.  
  87. goto main
  88.  
  89.  
  90. plot
  91.  
  92. combined = x + y : combined = (combined * 8 ^ combined) * 4 ^ combined
  93.  
  94. on r gosub r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 rA rB rC rD rE rF
  95.  
  96. column = current / 8
  97. row = current & 7
  98.  
  99. pfpixel column row on
  100. previous = current
  101. return
  102.  
  103. r0
  104. current = combined
  105. return
  106.  
  107. r1
  108. r2
  109. r3
  110. r4
  111. r5
  112. r6
  113. r7
  114. r8
  115. rand = combined
  116.  
  117. for i=1 to r
  118. current = rand
  119. next
  120. return
  121.  
  122. r9
  123. rand = x + y
  124. rand = rand + y
  125. current = rand
  126. return
  127.  
  128. rA
  129. current = current
  130. return
  131.  
  132. rB
  133. current = current
  134. return
  135.  
  136. rC
  137. current = current
  138. return
  139.  
  140. rD
  141. current = current
  142. return
  143.  
  144. rE
  145. asm
  146. lda r16lo
  147. lsr
  148. rol r16hi
  149. bcc *+4
  150. eor #$B4
  151. sta r16lo
  152. eor r16hi
  153. sta current
  154. end
  155.  
  156. var36 = r16lo
  157. var40 = r16hi
  158. return
  159.  
  160. rF
  161.  
  162. current = pearson[x] ^ y : current = pearson[current]
  163. return
  164.  
  165.  
  166. cycle
  167.  
  168. r = r + 1 : if r = 16 then r = 0
  169.  
  170. p0plo = p0datlo
  171. p1plo = p1datlo
  172.  
  173. temp2 = 0 : temp1 = r * 5
  174. p0ptr = p0ptr + dtmp
  175. p1ptr = p1ptr + dtmp
  176.  
  177. pfclear
  178. return
  179.  
  180.  
  181.  
  182. do_scor
  183.  
  184. temp6 = x
  185.  
  186. sc1 = 0 : sc2 = sc2 & 15
  187. if temp6 >= 100 then sc1 = sc1 + 16 : temp6 = temp6 - 100
  188. if temp6 >= 100 then sc1 = sc1 + 16 : temp6 = temp6 - 100
  189. if temp6 >= 50 then sc1 = sc1 + 5 : temp6 = temp6 - 50
  190. if temp6 >= 30 then sc1 = sc1 + 3 : temp6 = temp6 - 30
  191. if temp6 >= 20 then sc1 = sc1 + 2 : temp6 = temp6 - 20
  192. if temp6 >= 10 then sc1 = sc1 + 1 : temp6 = temp6 - 10
  193. sc2 = (temp6 * 4 * 4) | sc2
  194.  
  195. temp6 = y
  196.  
  197. sc2 = sc2 & 240 : sc3 = 0
  198. if temp6 >= 100 then sc2 = sc2 + 1 : temp6 = temp6 - 100
  199. if temp6 >= 100 then sc2 = sc2 + 1 : temp6 = temp6 - 100
  200. if temp6 >= 50 then sc3 = sc3 + 80 : temp6 = temp6 - 50
  201. if temp6 >= 30 then sc3 = sc3 + 48 : temp6 = temp6 - 30
  202. if temp6 >= 20 then sc3 = sc3 + 32 : temp6 = temp6 - 20
  203. if temp6 >= 10 then sc3 = sc3 + 16 : temp6 = temp6 - 10
  204. sc3 = sc3 | temp6
  205. return
  206.  
  207. asm
  208. align 256
  209. end
  210.  
  211. data pearson
  212. 98, 6, 85, 150, 36, 23, 112, 164, 135, 207, 169, 5, 26, 64, 165, 219
  213. 61, 20, 68, 89, 130, 63, 52, 102, 24, 229, 132, 245, 80, 216, 195, 115
  214. 90, 168, 156, 203, 177, 120, 2, 190, 188, 7, 100, 185, 174, 243, 162, 10
  215. 237, 18, 253, 225, 8, 208, 172, 244, 255, 126, 101, 79, 145, 235, 228, 121
  216. 123, 251, 67, 250, 161, 0, 107, 97, 241, 111, 181, 82, 249, 33, 69, 55
  217. 59, 153, 29, 9, 213, 167, 84, 93, 30, 46, 94, 75, 151, 114, 73, 22
  218. 197, 96, 210, 45, 16, 227, 248, 202, 51, 152, 252, 125, 81, 206, 215, 186
  219. 39, 158, 178, 187, 131, 136, 1, 49, 50, 17, 141, 91, 47, 129, 60, 99
  220. 154, 35, 86, 171, 105, 34, 38, 200, 147, 58, 77, 118, 173, 246, 76, 254
  221. 133, 232, 196, 144, 198, 124, 53, 4, 108, 74, 223, 234, 134, 230, 157, 139
  222. 189, 205, 199, 128, 176, 19, 211, 236, 127, 192, 231, 70, 233, 88, 146, 44
  223. 183, 201, 22, 83, 13, 214, 116, 109, 159, 32, 95, 226, 140, 220, 57, 12
  224. 221, 31, 209, 182, 143, 92, 149, 184, 148, 62, 113, 65, 37, 27, 106, 166
  225. 3, 14, 204, 72, 21, 41, 56, 66, 28, 193, 40, 217, 25, 54, 179, 117
  226. 238, 87, 240, 155, 180, 170, 242, 212, 191, 163, 78, 218, 137, 194, 175, 110
  227. 43, 119, 224, 71, 122, 142, 42, 160, 104, 48, 247, 103, 15, 11, 138, 239
  228. end
  229.  
  230. data p0dat
  231. $64, $8A, $8A, $8A, $64, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
  232. $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
  233. $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
  234. $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
  235. $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $8E, $C8, $AC, $A8, $CE
  236. end
  237.  
  238. data p1dat
  239. $AC, $AA, $AC, $EA, $AC, $AE, $A4, $C4, $AC, $C4, $AE, $A8, $C4, $A2, $CC, $AC
  240. $A2, $C4, $A2, $CC, $A2, $A2, $CE, $AA, $CA, $AC, $A2, $CC, $A8, $CE, $A4, $AA
  241. $CC, $A8, $C6, $A8, $A8, $C4, $A2, $CE, $A4, $AA, $C4, $AA, $C4, $0C, $02, $06
  242. $0A, $04, $0A, $0A, $0E, $0A, $04, $0C, $0A, $0C, $0A, $0C, $06, $08, $08, $08
  243. $06, $0C, $0A, $0A, $0A, $0C, $0E, $08, $0C, $08, $0E, $AA, $EC, $AA, $AA, $4C
  244. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement