ZERODEF.S 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. .title "Desert Falcon"
  2. .6502
  3. .list
  4. **** ZERODEF.S ZERO PAGE RAM MACRO *****
  5. ********************************************************************************
  6. * ZERO PAGE RAM 40-7F *
  7. ********************************************************************************
  8. * GAME STATE AND ASSOCIATED RAM
  9. * LEVEL 1 RAM
  10. org $40
  11. ;
  12. HANDLER: .ds.b 1 ;HAS A 40 (JMP OPCODE) TO JMP TO DLIPT
  13. DLIPTR: .ds.b 2 ;AND E4
  14. TITLMENU: .ds.b 1 ;FLAGS FOR STATES ACTIVE LOW
  15. AUTOPLAY: .ds.b 1 ;ACTIVE HIGH
  16. USEME: .ds.b 1 ;FREE BYTE
  17. DMA: .ds.b 1 ;ACTIVE HIGH
  18. HSC: .ds.b 1 ;ACTIVE HIGH
  19. GAMEU: .ds.b 1 ;ACTIVE HIGH
  20. STATEPTR: .ds.b 2 ;STATEPTR FOR GAME STATE (i.e. PAUSE..
  21. DIFCULTY: .ds.b 1 ;DIFFICULTY LEVEL
  22. PAUSE: .ds.b 1 ;PAUSE STATE FLAG
  23. NUMPLYRS: .ds.b 1 ;NUMBER OF PLAYERS
  24. RNDOM: .ds.b 1 ;RANDOM NUMBER
  25. RNDOM1: .ds.b 1 ;RANDOM NUMBER
  26. FUTEXP1: .ds.b 2 ;NO ROOM FOR FUTURE EXPANSION
  27. * LEVEL 2 RAM
  28. RACK: .ds.b 2 ;SPHINX LEVEL
  29. FREEZEP: .ds.b 1 ;FREEZE FRAMER VARIABLE ACTIVE HIGH
  30. PAWSTWID: .ds.b 1 ;PAUSE TWIDDLE FLAG
  31. GAMEOVR: .ds.b 1 ;ACTIVE HIGH
  32. NEWPLYR: .ds.b 1 ;SWITCHING BETWEEN PLAYERS FLAG
  33. PLAYER: .ds.b 1 ;WHICH PLAYER IS UP 0 >> 1, 1>> 2
  34. PL1SCORE: .ds.b 4 ;PLAYER 0'S SCORE
  35. PL2SCORE: .ds.b 4 ;PLAYER 1'S SCORE
  36. PL1LIVES: .ds.b 1 ;PLAYER 0'S LIVES
  37. PL2LIVES: .ds.b 1 ;PLAYER 1'S LIVES
  38. GRNDPC: .ds.b 1 ;GROUND OBJECTS PROGRAM COUNTER
  39. OBJTYP: .ds.b 1 ;OBJECT TYPE OF PATTERN
  40. DISTANCE: .ds.b 1 ;NUMBER OF COARSE SCROLLS
  41. HDIST: .ds.b 1 ;HIGH BYTE OF DISTANCE
  42. PGNUM: .ds.b 2 ;PLAYERS' NUMBER OF GLYPHS
  43. PGPOWER: .ds.b 2 ;PLAYERS' CURRENT POWER
  44. PGS1: .ds.b 3 ;PLAYER ONE'S HEIROS
  45. PGS2: .ds.b 3 ;PLAYER TWO'S HEIROS
  46. PSRA1: .ds.b 1 ;LAND PROGRAM RANDOMS
  47. PSRA2: .ds.b 1
  48. PSRB1: .ds.b 1
  49. PSRB2: .ds.b 1
  50. DUMPAREA: .ds.b 2 ;QUEUE VAR FOR MCP
  51. DIFIND: .ds.b 1 ;DIFICULTY LEVEL
  52. EATME: .ds.b 1 ;AVAILABLE BYTE
  53. TRVAL1: .ds.b 2
  54. TRVAL2: .ds.b 2
  55. XTRBNSTM: .ds.b 2 ;EXTRA BONUS TIME
  56. FUTEXP3:
  57. FUTEXP2: .ds.b 1 ;NO MORE ROOM FOR EXPANSION
  58. * LEVEL 3 RAM
  59. * TEMPS AND POINTERS
  60. org $80
  61. PTR0: .ds.b 2
  62. PTR1: .ds.b 2
  63. TEMP0: .ds.b 1
  64. COLPX: ;X PASSED TO COLLISION DETECTION
  65. TEMP1: .ds.b 1
  66. COLPY: ;Y PASSED TO COLLISION DETECTION
  67. TEMP2: .ds.b 1
  68. COLPZ: ;Z PASSED TO COLLISION DETECTION
  69. TEMP3: .ds.b 1
  70. TEMP4: .ds.b 1
  71. TEMP5: .ds.b 1
  72. TEMP6: .ds.b 1
  73. TEMP7: .ds.b 1
  74. TEMP8: .ds.b 1
  75. TEMP9: .ds.b 1
  76. TEMP10: .ds.b 1 ;JUST FOR PASSING DF
  77. TEMPX: .ds.b 1
  78. TEMPY: .ds.b 1
  79. org $91
  80. KTEMPX: .ds.b 1 ;TEMPX AND Y FOR INTERRUPT CODE
  81. KTEMPY: .ds.b 1
  82. KTEMP2: .ds.b 1
  83. KTEMP3: .ds.b 1
  84. KTEMP10: .ds.b 1 ;KERNEL TEMPORARY
  85. KPTR0: .ds.b 2 ;POINTERS FOR INTERRUPT CODE
  86. KPTR1: .ds.b 2
  87. KPTR: .ds.b 2
  88. JTEMP: .ds.b 1 ;WHAT THE FUCK
  89. * RANDOM BOB K. TEMPS WHAT CAN WE DO WITH THEM
  90. OTEMP1: .ds.b 1 ;BOBS TEMPS
  91. OTEMP2: .ds.b 1
  92. OTEMP3: .ds.b 1
  93. OTEMP4: .ds.b 1
  94. * RANDOM,BOGUS AND OTHERS
  95. ZONEOFF: .ds.b 1 ;OFFSET INTO 16 HIGH ZONE (FF-F)
  96. FRMCNT: .ds.b 1 ;FRAME COUNTER MOD 256
  97. OLDFRM: .ds.b 1 ;LAST FRAME'S FRAME COUNT
  98. SCRDELTA: .ds.b 1 ;DELTA VS NORMAL SCROLL
  99. JERKOFF: .ds.b 1 ;COUNTER FOR COARSE H SCROLL
  100. SCRATE: .ds.b 1 ;SCROLL RATE
  101. LASTSCRL: .ds.b 1 ;COUNTER FROM 0 TO SCRATE
  102. BIRDACNT: .ds.b 1 ;BIRD'S ANIMATION DELAY
  103. BIRDXCNT: .ds.b 1 ;BIRD'S X MOTION DELAY
  104. BIRDSTAT: .ds.b 1 ;BIRD'S STATUS (ANIMATION?)
  105. BLOCK: .ds.b 1 ;CURRENT BLOCK BEING SCROLLED ON SCREE
  106. BAND: .ds.b 1 ;CURRENT BAND IN BLOCK TO BE SCROLLED
  107. FIRECNT: .ds.b 1 ;FIRE BUTTON DELAY
  108. SHOTCNT: .ds.b 1 ;NUMBER OF SHOTS ON SCREEN (MAX IS 4)
  109. BLKCNT: .ds.b 1 ;BLOCK COUNT
  110. NBFLAG: .ds.b 1 ;FLAG THAT SAYS NEW BLOCK IS READY
  111. NEWBLK: .ds.b 1 ;NEW BLOCK NUMBER
  112. TENS: .ds.b 1 ;VALUES PASSED TO SCORE ROUTINE
  113. HUNDS: .ds.b 1 ;COULD BE TEMPS ALSO I BELIEVE
  114. HUNTHOUS: .ds.b 1
  115. ZNDLPOS: .ds.b 24 ;FIRST EMPTY BYTE IN EACH DISP. LIST
  116. LOWEST: .ds.b 1 ;START OF RLTBL
  117. MPTRL: ;ZERO PAGE TEMP(NOT GAMEPLAY)
  118. KTEMP0: .ds.b 1 ;TEMPS FOR INTERRUPT CODE
  119. MPTRH: ;ZERO PAGE TEMP(NOT GAMEPLAY)
  120. KTEMP1: .ds.b 1 ;KTEMP0 AND 1 MUST BE PAST $C0
  121. HIGHEST: .ds.b 1 ;OPPOSITE OF LOWEST.. END OF RLTBL
  122. SCROLLS: .ds.b 1 ;NUMBER OF SCROLLS THIS FRAME
  123. MAINCNT: .ds.b 1 ;MAIN LOOP COUNTER
  124. *FLEA STATE
  125. FLEASTAT: .ds.b 16 ;16 FLEA STATUS PRE/ON/OFF SCREEN
  126. FLEANIM: .ds.b 8 ;8 FLEA ANIMATION STATE
  127. NUMFLEAS: .ds.b 1 ;NUMBER OF FLEAS CURRENTLY AROUND
  128. FLSYSCLK: .ds.b 1 ;FLEA SYSTEM CLOCK
  129. BUFDEX: .ds.b 1 ;INDEX OF BUFFER WITH CHAR MAPS (0-11)
  130. BACKCOL: .ds.b 1 ;BACKGROUND FOR PLAY AREA
  131. D11CBASE: .ds.b 1 ;CHARBASE FOR BOTTOM ZONE OF SCREEN
  132. DLZDEST: .ds.b 2 ;POINTER TO DESTINATION OF DLI AT
  133. ; BEGINNING OF ZONE 11
  134. DCH0: .ds.b 1 ;ONE BYTE--DURATION CNTR CHAN. 0
  135. DCH1: .ds.b 1 ;ONE BYTE--DURATION CNTR CHAN. 1
  136. TUNNUM: .ds.b 1 ;ONE BYTE--TUNE NUM FOR CHAN. 0
  137. TUNNUM1: .ds.b 1 ;ONE BYTE--TUNE NUM FOR CHAN. 1
  138. TINDEX0: .ds.b 1 ;ONE BYTE--NOTE POINTER 0
  139. TINDEX1: .ds.b 1 ;ONE BYTE--NOTE POINTER 1
  140. CINDEX0: .ds.b 1 ;CONTROL INDEX0
  141. CINDEX1: .ds.b 1 ;CONTROL INDEX1
  142. VINDEX0: .ds.b 1 ;VOLUME INDEX0
  143. VINDEX1: .ds.b 1 ;VOLUME INDEX1
  144. TUNTEMP: .ds.b 1 ;COULD BE A TEMP
  145. RUNLOAD: ;TELLS LOADER TO RUN, SET BY MAINLOOP
  146. ENDRAM0: .ds.b 1 ;MOVE ME AS NEEDED YES SIR
  147. * OBJECT INDEX EQUATES
  148. ZBIRD EQU 0 ;0 BIRD
  149. ZSHOT1 EQU 1 ;1,2,3,4 SHOTS
  150. FLEADEX EQU 5 ;5,6,7,8,9,10,11,12 FLEAS
  151. UWEDEX EQU 13 ;13,14,15 UWES
  152. PYRSTART EQU 16 ;16-58 SCROLLING OBJS
  153. PYRSTOP EQU 58
  154. SPHXSHOT EQU 59 ;59,60,61,62 SPHINX SHOTS
  155. LASTPNT EQU 63 ;COMPARE VALUE FOR LAST COLLISIONS
  156. FLSHDEX EQU 63 ;63 - 70 FLEA SHADOWS
  157. ZSHAD EQU 71 ;71 BIRD SHADOW
  158. SHOTSHAD EQU 72 ;72,73,74,75 SHOT SHADOWS
  159. SPXSHTSH EQU 76 ;76,77,78,79 SPHNX SHT SHDS
  160. ZREF0 EQU 80 ;80 REFERENCE POINT
  161. ZREF1 EQU 81 ;81 REFERENCE POINT
  162. ZREF2 EQU 82 ;82 REFERENCE POINT
  163. ZREF3 EQU 83 ;83 REFERENCE POINT
  164. * RANDOM EQUATES
  165. SHOTDIFF EQU SHOTSHAD-ZSHOT1 ;DIFFERENCE BETWEEN SHOTS AND THEIR
  166. ;SHADOWS
  167. NUMBER EQU 126 ;96 + Z OF LOWER LEFT CORNER OF SCREEN
  168. DXADJ EQU -16 ;ADJUST THE RANGE OF DX'S
  169. LOWATER EQU 72 ;LOWEST WATER CHARACTER NUMBER
  170. SCRENBOT EQU 176
  171. * COLISION BOX ID'S
  172. HIEROCOL EQU 1 ; 1 THRU 8 - HIEROGLYPHS
  173. TREASCOL EQU 9 ; 9 THRU 11 - TREASURES
  174. PASSVCOL EQU 12 ; ALL PASSIVE OBJECTS
  175. MINICOL EQU 13 ; MINI SPHINX TARGET
  176. SPHNXCOL EQU 14 ; BIG SPHINX TARGET
  177. FLEACOL EQU 15 ; FLEAS
  178. UWECOL EQU 16 ; UWES
  179. SXSHTCOL EQU 17 ; SPHINX SHOTS
  180. FIRECOL EQU 18 ; FIRE
  181. ;CAN BE ANYTHING ELSE BUT 0
  182. *** SPHINX--SPROLOG.S
  183. * TIA REGISTERS
  184. INPT4R EQU $08 ;PLAYER 0, RIGHT BUTTON (PADDLE INPUT)
  185. INPT4L EQU $09 ;PLAYER 0, LEFT BUTTON (PADDLE INPUT)
  186. INPT5R EQU $0A ;PLAYER 1, RIGHT BUTTON (PADDLE INPUT)
  187. INPT5L EQU $0B ;PLAYER 1, LEFT BUTTON (PADDLE INPUT)
  188. INPT4 EQU $0C ;PLAYER 0 FIRE BUTTON
  189. INPT5 EQU $0D ;PLAYER 1 FIRE BUTTON
  190. AUDC0 EQU $15 ;BITS 3210 AUDIO CONTROL 0
  191. AUDC1 EQU $16 ;BITS 3210 AUDIO CONTROL 1
  192. AUDF0 EQU $17 ;BITS 3210 AUDIO FREQUENCY 0
  193. AUDF1 EQU $18 ;BITS 3210 AUDIO FREQUENCY 1
  194. AUDV0 EQU $19 ;BITS 3210 AUDIO VOLUME 0
  195. AUDV1 EQU $1A ;BITS 3210 AUDIO VOLUME 1
  196. * MARIA REGISTERS
  197. BACKGRND EQU $20 ;BACKGROUND COLOR RW
  198. P0C1 EQU $21 ;PALETTE ZERO COLOR ONE RW
  199. P0C2 EQU $22 ;PALETTE ZERO COLOR TWO RW
  200. P0C3 EQU $23 ;PALETTE ZERO COLOR THREE RW
  201. WSYNC EQU $24 ;FAST MARIA WSYNC STROBE
  202. P1C1 EQU $25 ;PALETTE ONE COLOR ONE RW
  203. P1C2 EQU $26 ;PALETTE ONE COLOR TWO RW
  204. P1C3 EQU $27 ;PALETTE ONE COLOR THREE RW
  205. MSTAT EQU $28 ;BIT 6 IN VBLANK, BIT ? IN DISPLAY RO
  206. P2C1 EQU $29 ;PALETTE TWO COLOR ONE RW
  207. P2C2 EQU $2A ;PALETTE TWO COLOR TWO RW
  208. P2C3 EQU $2B ;PALETTE TWO COLOR THREE RW
  209. DPPH EQU $2C ;DISPLAY LIST POINTER HIGH WO
  210. P3C1 EQU $2D ;PALETTE THREE COLOR ONE RW
  211. P3C2 EQU $2E ;PALETTE THREE COLOR TWO RW
  212. P3C3 EQU $2F ;PALETTE THREE COLOR THREE RW
  213. DPPL EQU $30 ;DISPLAY LIST POINTER LOW WO
  214. P4C1 EQU $31 ;PALETTE FOUR COLOR ONE RW
  215. P4C2 EQU $32 ;PALETTE FOUR COLOR TWO RW
  216. P4C3 EQU $33 ;PALETTE FOUR COLOR THREE RW
  217. CHARBASE EQU $34
  218. P5C1 EQU $35 ;PALETTE FIVE COLOR ONE RW
  219. P5C2 EQU $36 ;PALETTE FIVE COLOR TWO RW
  220. P5C3 EQU $37 ;PALETTE FIVE COLOR THREE RW
  221. OFFSET EQU $38 ;GRAPHICS HIGH POINTER OFFSET RW
  222. P6C1 EQU $39 ;PALETTE SIX COLOR ONE RW
  223. P6C2 EQU $3A ;PALETTE SIX COLOR TWO RW
  224. P6C3 EQU $3B ;PALETTE SIX COLOR THREE RW
  225. CTRL EQU $3C ;MAGIC WO
  226. P7C1 EQU $3D ;PALETTE SEVEN COLOR ONE RW
  227. P7C2 EQU $3E ;PALETTE SEVEN COLOR TWO RW
  228. P7C3 EQU $3F ;PALETTE SEVEN COLOR THREE RW
  229. * 6532 TIMERS AND PORTS
  230. SWCHA EQU $280 ;PO, P1 JOYSTICKS
  231. ; BIT 7 PLAYER 0 EAST IF CLEAR
  232. ; BIT 6 WEST
  233. ; BIT 5 SOUTH
  234. ; BIT 4 NORTH
  235. ; BIT 3 PLAYER 1 EAST IF CLEAR
  236. ; BIT 2 WEST
  237. ; BIT 1 SOUTH
  238. ; BIT 0 NORTH
  239. SWCHB EQU $282 ;CONSOLE SWITCHES
  240. ; BIT 7 PLAYER 1 DIFFICULTY A IF SET B IF CLEAR
  241. ; BIT 6 PLAYER 0 DIFFICULTY A IF SET B IF CLEAR
  242. ; BIT 3 BLACK + WHITE/COLOR COLOR WHEN SET
  243. ; BIT 1 GAME SELECT CLEAR WHEN PRESSED
  244. ; BIT 0 GAME RESET CLEAR WHEN PRESSED
  245. CTLSWA EQU $281
  246. CTLSWB EQU $283
  247. INTIM EQU $284 ;INTERVAL TIMER IN
  248. INTIMI EQU $28C ;INTERRUPT INTERVAL TIMER IN
  249. TIM8T EQU $295 ;TIMER 8T WRITE OUT
  250. TIM64T EQU $296 ;TIMER 64T WRITE OUT
  251. TIM64TI EQU $29E ;INTERUPT TIMER 64T
  252. * HIGH SCORE EQUATES
  253. HSCSTAT EQU $3FF7
  254. HSCATRCT EQU $3FFA
  255. HSCENTER EQU $3FFD
  256. HSCSETRS EQU $3FEB
  257. DFNMADAD EQU PTR0
  258. ; RAM equates:
  259. include "SDEF.S"
  260. ; Code from $5000-$7FFF:
  261. include "SHSC.S"
  262. include "SMAGIC.S"
  263. include "STUNES.S"
  264. include "SMCP.S"
  265. include "PATCH.S"
  266. ; Code from $8000-$8FFF:
  267. include "SGRAPH8.S"
  268. ; Code from $9000-$9FFF:
  269. include "SINIT.S"
  270. include "SKERNEL.S"
  271. include "SOBJ.S"
  272. ; Code from $A000-$AFFF:
  273. include "SGRAPHA.S"
  274. ; Code from $B000-$BFFF:
  275. include "SGNDOBJ.S"
  276. ; Code from $C000-$CFFF:
  277. include "SGRAPHC.S"
  278. ; Code from $D000-$DFFF:
  279. include "SCOLON.S"
  280. include "SSCROLL.S"
  281. ; Code from $E000-$EFFF:
  282. include "SGAME.S"
  283. ; Code from $F000-$FFFF:
  284. include "SNILE.S"
  285. include "SSUBRS.S"
  286. include "SSCROBJ.S"
  287. include "SPHINX.S"