Advertisement
Guest User

msk_pf_rd_demo.bas

a guest
Jun 12th, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. rem msk_pf_rd demo
  2.  
  3. includesfile multisprite.inc
  4. set kernel multisprite
  5. set romsize 4k
  6.  
  7. dim sc0 = score
  8. dim sc1 = score + 1
  9. dim sc2 = score + 2
  10. dim sf = f
  11.  
  12. player0x=25
  13. player0y=50
  14. COLUBK = $A2
  15. COLUPF = $00
  16.  
  17.  
  18. pfheight=7
  19. playfield:
  20. XXXXXXXXXXXXXXXX
  21. X...............
  22. X........X......
  23. X...............
  24. X...............
  25. X.......X.......
  26. X...............
  27. X...............
  28. X..X............
  29. X...............
  30. XXXXXXXXXXXXXXXX
  31. end
  32.  
  33. player0:
  34. %00000000
  35. %00000000
  36. %00000000
  37. %00000000
  38. %00000000
  39. %00000000
  40. %00000000
  41. %00000000
  42. %10000000
  43. end
  44.  
  45. main
  46.  
  47. temp2 = ((SWCHA ^ $FF) & sf)/16 : sf = SWCHA
  48.  
  49. temp3 = temp2 & 3 : player0y = player0y + dtbl[temp3]
  50. temp3 = (temp2/4) ^ 3 : player0x = player0x + dtbl[temp3]
  51.  
  52. temp1 = player0x
  53. temp2 = player0y
  54.  
  55. gosub update_scr
  56.  
  57. temp1 = (player0x - 16)/4
  58. temp2 = (player0y-3)/8
  59. temp1 = msk_pf_rd(temp1, temp2)
  60. if temp1 then COLUP0 = $1A else COLUP0 = $44
  61.  
  62. drawscreen
  63. goto main
  64.  
  65. data dtbl
  66. 0, 1, -1, 0
  67. end
  68.  
  69. function msk_pf_rd()
  70. if temp1 & 8 then temp1 = temp1 ^ 7
  71. if temp1 > 15 then temp1 = temp1 ^ 8
  72. if temp1 & 8 then skip_PF1
  73.  
  74. asm
  75. ldy temp2
  76. lda (PF1pointer),y
  77. sta temp2
  78. end
  79. goto skip_PF2
  80.  
  81. skip_PF1
  82. asm
  83. ldy temp2
  84. lda (PF2pointer),y
  85. sta temp2
  86. end
  87.  
  88. skip_PF2
  89.  
  90. temp1 = temp1 & 7
  91. temp1 = bits[temp1] & temp2
  92. if temp1 then temp1 = 255
  93.  
  94. return
  95.  
  96. data bits
  97. $80,$40,$20,$10,8,4,2,1
  98. end
  99.  
  100. update_scr
  101. sc0 = 0 : sc1 = sc1 & 15
  102. if temp1 >= 100 then sc0 = sc0 + 16 : temp1 = temp1 - 100
  103. if temp1 >= 100 then sc0 = sc0 + 16 : temp1 = temp1 - 100
  104. if temp1 >= 50 then sc0 = sc0 + 5 : temp1 = temp1 - 50
  105. if temp1 >= 30 then sc0 = sc0 + 3 : temp1 = temp1 - 30
  106. if temp1 >= 20 then sc0 = sc0 + 2 : temp1 = temp1 - 20
  107. if temp1 >= 10 then sc0 = sc0 + 1 : temp1 = temp1 - 10
  108. sc1 = (temp1 * 4 * 4) | sc1
  109.  
  110. sc1 = sc1 & 240 : sc2 = 0
  111. if temp2 >= 100 then sc1 = sc1 + 1 : temp2 = temp2 - 100
  112. if temp2 >= 100 then sc1 = sc1 + 1 : temp2 = temp2 - 100
  113. if temp2 >= 50 then sc2 = sc2 + 80 : temp2 = temp2 - 50
  114. if temp2 >= 30 then sc2 = sc2 + 48 : temp2 = temp2 - 30
  115. if temp2 >= 20 then sc2 = sc2 + 32 : temp2 = temp2 - 20
  116. if temp2 >= 10 then sc2 = sc2 + 16 : temp2 = temp2 - 10
  117. sc2 = sc2 | temp2
  118. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement