SELECT.S 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  1. ; SELECT.S
  2. ; THIS FILE CONTAINS "MKSELECT" AND "SELECT"
  3. ; BOTH VERY SIMILAR TO "MKLOGO" AND "LOGO" RESPECTIVELY.
  4. GLBL DRAWLOGO
  5. GLBL TRUE,FALSE
  6. GLBL TEXT1 ; IN "TEXT.S"
  7. GLBL TXTLIST1,TXTLIST2,TXTLIST3,CLOWMAP2
  8. GLBL DLIST6,DLIST5,DLIST4,DLIST2
  9. GLBL MSELECT
  10. GLBL SCORELST,STATLIST
  11. GLBL NULL2,DPPINIT,SCRAPALL
  12. GLBL THRWTIME,HTHROW,HJOYDIR
  13. GLBL THREADY
  14. GLBL PLRACK,PLBCD,PL1BCD,PL0BCD,PL0RACK,PL1RACK
  15. GLBL PLLIVES,PL0LIVES
  16. GLBL MGAME
  17. GLBL GAME,GOD
  18. GLBL AWOLDRAW,CLRSCRN
  19. GLBL FPSELECT,SELREADY,MKLOGO
  20. GLBL HIGHEST
  21. GLBL STATINIT,STATCOMB,STATPLAY,FPPAUSE,JOYDIR,OLDDIR,DLIST3
  22. GLBL SELECT,MKSELECT
  23. RAMDEF ; ZERO PAGE
  24. RSEG CODE1
  25. MKSELECT LDA #FALSE ; NO MLOADER IN LOGO MODE
  26. STA RUNLOAD
  27. STA TEMP4 zero out in case this was IR text
  28. LDA #MSELECT
  29. STA MODE
  30. NEWSTATE SELECT
  31. LDA #$19 ; COLORS FOR TEXT
  32. STA P5C1
  33. LDA #$15
  34. STA P5C2
  35. LDA #$1F
  36. STA P5C3
  37. LDA #00 ; CLEAR OUT ALL CHARACTER MAP INFO
  38. STA SCORELST+1
  39. STA STATLIST+1
  40. JSR DRAWLOGO ; DRAW THE "FOODFIGHT" LOGO
  41. LDA #8 ; LOGO DLISTS-- EACH WITH TWO ENTRIES
  42. STA LISTSTRT+8
  43. STA LISTSTRT+9
  44. ; SETUP THE HEADERS USED BELOW THE LOGO:
  45. ; "PLAYER N"
  46. ; "SELECT STARTING"
  47. ; "LEVEL"
  48. ; "NNN"
  49. ; PUT BLANKS IN THE CHARACTER MAPS:
  50. ; (ALL THREE, LENGTHS 13,14, AND 15)
  51. LDX #$2A
  52. LDA #NULL2
  53. MKSELP0 STA TXTLIST1,X
  54. DEX
  55. BNE MKSELP0
  56. ; FIRST LINE OF TEXT:
  57. LDA #L(TXTLIST2) ; "SELECT STARTING"
  58. STA DLIST6
  59. LDA #$60
  60. STA DLIST6+1
  61. LDA #H(TXTLIST2)
  62. STA DLIST6+2
  63. LDA #$B1 ; 15 CHARACTERS; PALETTE 5
  64. STA DLIST6+3
  65. LDA #$10
  66. STA DLIST6+4
  67. LDA #0
  68. STA DLIST6+6
  69. LDY #14
  70. SCOPYLP0 LDA SELTEXT1,Y ; "SELECT STARTING"
  71. STA TXTLIST2,Y ; 15 WIDE MAP
  72. DEY
  73. BPL SCOPYLP0
  74. ; DO SECOND LINE OF TEXT:
  75. LDA #L(TXTLIST3) ; "LEVEL"
  76. STA DLIST5
  77. LDA #$60
  78. STA DLIST5+1
  79. LDA #H(TXTLIST3)
  80. STA DLIST5+2
  81. LDA #$B4 ; 12 CHARACTERS; PALETTE 5
  82. STA DLIST5+3
  83. LDA #$38 ; HPOS
  84. STA DLIST5+4
  85. LDA #0
  86. STA DLIST5+6
  87. LDY #4
  88. SCOPYLP1 LDA SELTEXT2,Y
  89. STA TXTLIST3,Y
  90. DEY
  91. BPL SCOPYLP1
  92. ; THIRD LINE OF TEXT:
  93. LDA #L(TXTLIST1) ; "PLAYER N"
  94. STA DLIST4
  95. LDA #$60
  96. STA DLIST4+1
  97. LDA #H(TXTLIST1)
  98. STA DLIST4+2
  99. LDA #$B3 ; PALETTE 5, 13 LENGTH
  100. STA DLIST4+3
  101. LDA #$30
  102. STA DLIST4+4
  103. ; NOW FILL THIS WITH THE TEXT "PLAYER "
  104. LDX #05
  105. SCOPYLP2 LDA TEXT1,X ; IN "TEXT.S"
  106. STA TXTLIST1,X
  107. DEX
  108. BPL SCOPYLP2
  109. ; TACK ON THE PLAYER NUMBER:
  110. LDA CURRENT ; 0 OR 1
  111. ASL A ; 0 OR 2
  112. CLC
  113. ADC #$D8 ; LOW BYTE FOR DIGIT "1"
  114. STA TXTLIST1+7
  115. ; NOW DISPLAY THE STARTING LEVEL OF 1 (ALREADY INITIALIZED TO THIS):
  116. LDX #4 ; FIRST FILL WITH NULL
  117. SCOPYLP4 LDA #NULL2
  118. STA CLOWMAP2,X
  119. DEX
  120. BPL SCOPYLP4
  121. LDA #L(CLOWMAP2)
  122. STA DLIST2
  123. LDA #$60
  124. STA DLIST2+1
  125. LDA #H(CLOWMAP2)
  126. STA DLIST2+2
  127. LDA #$BC ; WIDTH OF 4
  128. STA DLIST2+3
  129. LDA #$40
  130. STA DLIST2+4
  131. LDA #0
  132. STA DLIST2+6
  133. JSR NEWLEVEL ; PUTS LEVEL INTO "CLOWMAP2"
  134. LDA #30 ; DE-BOUNCE BEFORE FIRST SWITCH
  135. STA THRWTIME
  136. STA TEMP2
  137. LDA #2
  138. STA TEMP1
  139. LDA #FALSE
  140. STA THREADY
  141. JSR SCRAPALL
  142. JSR DPPINIT ; TURN DMA ON
  143. ENDCYCLE
  144. ; THE ROUTINE WHICH DISPLAYS THE RACK NUMBER
  145. SELECT LDA STATUS
  146. CMP #STATCOMB
  147. BNE SELTEST0
  148. JMP COMBINE
  149. SELTEST0 LDA PLRACK
  150. CMP #12
  151. BNE ITISNT
  152. LDA FPPAUSE
  153. BEQ ITISNT
  154. JMP MKCOMB
  155. ITISNT LDA HTHROW
  156. BPL SELTEST1
  157. LDA THREADY
  158. BPL SELTEST1
  159. JMP GENDSEL
  160. ; SEE IF WE SHOULD GO INTO "LOGO" MODE:
  161. SELTEST1 LDA FPSELECT
  162. BPL SELTEST2
  163. LDA SELREADY
  164. BPL SELTEST2
  165. JMP MKLOGO ; HOP INTO LOGO; IT RESETS THE STACK
  166. ; AND GOES TO "GOD"
  167. ; DO THE LEVEL SELECT BY POLLING THE JOYSTICK:
  168. SELTEST2 LDA THRWTIME ; JOYSTICK DEBOUNCE
  169. BEQ SELTEST3
  170. DEC THRWTIME
  171. JMP SELCONT1
  172. SELTEST3 LDA HJOYDIR
  173. CMP #8
  174. BNE SELTEST4
  175. JMP SETTT0 ; IF 8, NO PUSH AT ALL
  176. SELTEST4 CMP #7 ; DON'T LET 7 DECREASE LEVEL
  177. BEQ SELOVER
  178. CMP #3 ; INCREASES ON 0,1,2
  179. BMI SELRIGHT
  180. CMP #4 ; DECREASES ON 4,5,6
  181. BPL SELLEFT
  182. JMP SELOVER ; MUST BE = 3
  183. SELRIGHT LDX CURRENT
  184. LDA PLRACK
  185. CMP HIGHEST,X ; indexed for each player
  186. BCS SELOVER
  187. INC PLRACK
  188. ; ADD ONE TO THE BCD REPRESENTATION OF THE LEVEL:
  189. SED
  190. LDA PLBCD+1
  191. CLC
  192. ADC #1
  193. STA PLBCD+1
  194. DEX ; HIGH ORDER DIGITS
  195. LDA PLBCD
  196. ADC #0
  197. STA PLBCD
  198. CLD
  199. JSR NEWLEVEL
  200. JMP SELOVER
  201. SELLEFT
  202. LDA PLRACK
  203. BEQ SELOVER
  204. DEC PLRACK
  205. SED
  206. LDA PLBCD+1
  207. SEC
  208. SBC #1
  209. STA PLBCD+1
  210. LDA PLBCD
  211. SBC #0
  212. STA PLBCD
  213. CLD
  214. JSR NEWLEVEL ; DISPLAYS PLBCD
  215. ; COME HERE AFTER A JOYSTICK PUSH HAS BEEN DETECTED-- RESET DEBOUNCE
  216. SELOVER LDA TEMP2
  217. STA THRWTIME
  218. DEC TEMP1
  219. BMI SPEEDUP
  220. ENDCYCLE
  221. SPEEDUP LDA #5
  222. STA TEMP2
  223. ENDCYCLE
  224. SELCONT1 LDA HJOYDIR
  225. CMP #8
  226. BNE SELBYE
  227. SETTT0 LDA #0
  228. STA THRWTIME
  229. LDA #2 ; FASTER TIMER
  230. STA TEMP1
  231. LDA #30
  232. STA TEMP2
  233. SELBYE ENDCYCLE
  234. GENDSEL
  235. LDX CURRENT
  236. BEQ SELCOPY1
  237. MOVE PLBCD,PL1BCD
  238. MOVE PLBCD+1,PL1BCD+1
  239. JMP SELEXIT
  240. SELCOPY1 MOVE PLBCD,PL0BCD
  241. MOVE PLBCD+1,PL0BCD+1
  242. SELEXIT MOVE PLRACK,PL0RACK,X
  243. ; SED
  244. LDA PLBCD
  245. BEQ NO10
  246. LDA #10 10 extra lives for the 100
  247. CLC
  248. ADC PLLIVES
  249. STA PLLIVES
  250. STA PL0LIVES,X
  251. NO10 LDA PLBCD+1 now, one for every 10s digit
  252. LSR A
  253. LSR A
  254. LSR A
  255. LSR A
  256. CLC
  257. ADC PLLIVES
  258. STA PLLIVES
  259. STA PL0LIVES,X
  260. ; CLD
  261. LDA #MGAME
  262. STA MODE
  263. MOVE #STATINIT,STATUS
  264. NEWSTATE GAME
  265. JSR AWOLDRAW ; PUT WALL BACK
  266. JSR CLRSCRN ; GET RID OF THIS DISPLAY
  267. RTS ; GOES BACK INTO "INIT.S"
  268. NEWLEVEL LDA #FALSE ; USE THIS TO TELL IF ZEROES ARE
  269. STA TEMP0 ; DISPLAYED
  270. LDA PLBCD ; LIVES IN BCD
  271. BEQ SBLANK1 ; IF ZERO, PUT A BLANK
  272. ASL A ; TIMES 2
  273. ADC #$D6 ; DIGIT "1" IS AT $D8
  274. STA CLOWMAP2
  275. LDA #TRUE
  276. STA TEMP0
  277. JMP NEWLP1
  278. SBLANK1 LDA #$2F
  279. STA CLOWMAP2
  280. NEWLP1 LDA PLBCD+1
  281. LSR A
  282. LSR A
  283. LSR A
  284. LSR A
  285. LDX TEMP0
  286. BNE NEWLP2 ; IF "TRUE", DISPLAY IT
  287. TAY ; TO RESET FLAGS TO "A"
  288. BNE NEWLP2 ; IF NOT ZERO, DISPLAY IT
  289. LDA #$2F ; IF A LEADING ZERO, PUT A BLANK
  290. STA CLOWMAP2+1
  291. JMP NEWLP3
  292. NEWLP2 ASL A ; TIMES 2
  293. ADC #$D6 ; THE "O" CHARACTER
  294. STA CLOWMAP2+1
  295. NEWLP3 LDA PLBCD+1
  296. AND #$F
  297. ASL A ; TIMES 2
  298. ADC #$D6
  299. STA CLOWMAP2+2
  300. RTS
  301. mkcomb lda #statcomb
  302. sta status
  303. lda #0
  304. sta temp5
  305. endcycle
  306. combine ldx temp5
  307. lda hjoydir
  308. cmp olddir
  309. beq skip
  310. sta olddir
  311. cmp #8
  312. beq skip
  313. cmp nextcomb,x
  314. beq cont
  315. lda #statplay
  316. sta status
  317. skip endcycle
  318. cont inc temp5
  319. cpx #7
  320. bpl doit
  321. endcycle
  322. doit lda #0 blank out the text
  323. sta dlist5+1
  324. sta dlist4+1
  325. sta dlist3+1
  326. endcycle
  327. nextcomb DB 0,2,4,6,0,2,4,6
  328. SELTEXT1 DB $CA,$BA,$C4,$BA,$B6,$CC,$2F ; SELECT
  329. DB $CA,$CC,$B8,$C8,$CC,$C2,$BE,$B4 ; STARTING
  330. SELTEXT2 DB $C4,$BA,$BC,$BA,$C4 ; LEVEL
  331. END