NSELECT.S 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. ; NSELECT.S
  2. ; THIS FILE CONTAINS "MKSELECT" AND "SELECT"
  3. ; BOTH VERY SIMILAR TO "MKLOGO" AND "LOGO" RESPECTIVELY.
  4. GLBL XDMAOFF
  5. GLBL DRAWLOGO
  6. GLBL TRUE,FALSE
  7. GLBL TEXT1 ; IN "TEXT.S"
  8. GLBL TXTLIST1,TXTLIST2,TXTLIST3,CLOWMAP2
  9. GLBL DLIST6,DLIST5,DLIST4,DLIST2
  10. GLBL MSELECT
  11. GLBL SCORELST,STATLIST
  12. GLBL NULL2,DPPINIT,FOODSTUF,SCRAPALL
  13. GLBL THRWTIME
  14. GLBL PL1BCD,PL0BCD,PL0RACK,PL1RACK
  15. GLBL PL0LIVES,CTEXT1,CTEXT2,CTEXT3,CTEXT4
  16. GLBL MGAME
  17. GLBL GAME,GOD
  18. GLBL AWOLDRAW,CLRSCRN
  19. GLBL MKLOGO
  20. GLBL STATINIT,STATCOMB,STATPLAY,OLDDIR,DLIST3
  21. GLBL COLORS
  22. GLBL SELECT,MKSELECT
  23. GLBL SELTEXT1,SELTEXT2
  24. RAMDEF ; ZERO PAGE
  25. RSEG CODE1
  26. MKSELECT LDX #FALSE ; NO MLOADER IN LOGO MODE
  27. STX RUNLOAD
  28. ; ONSCREEN wait until off screen for init
  29. ; INVBLANK
  30. DMAOFF
  31. STX TEMP4 zero out in case this was IR text
  32. STX SCORELST+1 FALSE is 0
  33. STX STATLIST+1
  34. ; End of all dlists:
  35. STX DLIST2+6
  36. STX DLIST4+6
  37. STX DLIST5+6
  38. STX DLIST6+6
  39. LDA #MSELECT
  40. STA MODE
  41. NEWSTATE SELECT
  42. LDA #$19 ; COLORS FOR TEXT
  43. STA COLORS+20
  44. LDA #$15
  45. STA COLORS+21
  46. LDA #$1F
  47. STA COLORS+22
  48. JSR DRAWLOGO ; DRAW THE "FOODFIGHT" LOGO
  49. LDA #8 ; LOGO DLISTS-- EACH WITH TWO ENTRIES
  50. STA LISTSTRT+8
  51. STA LISTSTRT+9
  52. ; SETUP THE HEADERS USED BELOW THE LOGO:
  53. ; "PLAYER N"
  54. ; "SELECT STARTING"
  55. ; "LEVEL"
  56. ; "NNN"
  57. ; PUT BLANKS IN THE CHARACTER MAPS:
  58. ; (ALL THREE, LENGTHS 13,14, AND 15)
  59. JSR CLRMAPS
  60. ; FIRST LINE OF TEXT:
  61. LDY #4
  62. NSLOOP LDA NSTABLE,Y
  63. STA DLIST6,Y
  64. DEY
  65. BPL NSLOOP
  66. LDY #14
  67. SCOPYLP0 LDA SELTEXT1,Y ; "SELECT STARTING"
  68. STA TXTLIST2,Y ; 15 WIDE MAP
  69. DEY
  70. BPL SCOPYLP0
  71. ; DO SECOND LINE OF TEXT:
  72. LDY #4
  73. NSLOOP1 LDA NSTABLE1,Y
  74. STA DLIST5,Y
  75. DEY
  76. BPL NSLOOP1
  77. LDY #4
  78. SCOPYLP1 LDA SELTEXT2,Y
  79. STA TXTLIST3,Y
  80. DEY
  81. BPL SCOPYLP1
  82. ; THIRD LINE OF TEXT:
  83. LDY #4
  84. NSLOOP2 LDA NSTABLE2,Y
  85. STA DLIST4,Y
  86. DEY
  87. BPL NSLOOP2
  88. ; NOW FILL THIS WITH THE TEXT "PLAYER "
  89. LDX #05
  90. SCOPYLP2 LDA TEXT1,X ; IN "TEXT.S"
  91. STA TXTLIST1,X
  92. DEX
  93. BPL SCOPYLP2
  94. ; TACK ON THE PLAYER NUMBER:
  95. LDA CURRENT ; 0 OR 1
  96. ASL A ; 0 OR 2
  97. CLC
  98. ADC #$D8 ; LOW BYTE FOR DIGIT "1"
  99. STA TXTLIST1+7
  100. ; NOW DISPLAY THE STARTING LEVEL OF 1 (ALREADY INITIALIZED TO THIS):
  101. LDX #4 ; FIRST FILL WITH NULL
  102. SCOPYLP4 LDA #NULL2
  103. STA CLOWMAP2,X
  104. DEX
  105. BPL SCOPYLP4
  106. LDY #4
  107. NSLOOP3 LDA NSTABLE3,Y
  108. STA DLIST2,Y
  109. DEY
  110. BPL NSLOOP3
  111. JSR NEWLEVEL ; PUTS LEVEL INTO "CLOWMAP2"
  112. LDA #30 ; DE-BOUNCE BEFORE FIRST SWITCH
  113. STA THRWTIME
  114. STA TEMP2
  115. LDA #2
  116. STA TEMP1
  117. LDA #FALSE
  118. STA THREADY
  119. JSR SCRAPALL
  120. JSR DPPINIT ; TURN DMA ON
  121. ENDCYCLE
  122. ; THE ROUTINE WHICH DISPLAYS THE RACK NUMBER
  123. SELECT LDA STATUS
  124. CMP #STATCOMB
  125. BNE SELTEST0
  126. JMP COMBINE
  127. SELTEST0 lda plrack
  128. cmp #22
  129. bne itisnt
  130. lda fppause
  131. beq itisnt
  132. jmp mkcomb
  133. ; If the throw or the reset button is pushed, select this rack and start
  134. ; a new game.
  135. ITISNT LDA HTHROW
  136. BPL SELTST1
  137. LDA THREADY
  138. BPL SELTST1
  139. JMP GENDSEL
  140. SELTST1 LDA FPRESET
  141. BPL SELTEST1
  142. LDA RESREADY
  143. BPL SELTEST1
  144. MOVE #FALSE,RESREADY
  145. JMP GENDSEL
  146. ; SEE IF WE SHOULD GO INTO "LOGO" MODE:
  147. SELTEST1 LDA FPSELECT
  148. BPL SELTEST2
  149. LDA SELREADY
  150. BPL SELTEST2
  151. JMP MKLOGO ; HOP INTO LOGO; IT RESETS THE STACK
  152. ; AND GOES TO "GOD"
  153. ; DO THE LEVEL SELECT BY POLLING THE JOYSTICK:
  154. SELTEST2 LDA THRWTIME ; JOYSTICK DEBOUNCE
  155. BEQ SELTEST3
  156. DEC THRWTIME
  157. JMP SELCONT1
  158. SELTEST3 LDA HJOYDIR
  159. CMP #8
  160. BNE SELTEST4
  161. JMP SETTT0 ; IF 8, NO PUSH AT ALL
  162. SELTEST4 CMP #7 ; DON'T LET 7 DECREASE LEVEL
  163. BEQ SELOVER
  164. CMP #3 ; INCREASES ON 0,1,2
  165. BMI SELRIGHT
  166. CMP #4 ; DECREASES ON 4,5,6
  167. BPL SELLEFT
  168. JMP SELOVER ; MUST BE = 3
  169. SELRIGHT
  170. LDX CURRENT
  171. LDA PLRACK
  172. CMP HIGHEST,X
  173. BCS SELOVER
  174. INC PLRACK
  175. ; ADD ONE TO THE BCD REPRESENTATION OF THE LEVEL:
  176. SED
  177. LDA PLBCD+1
  178. CLC
  179. ADC #1
  180. STA PLBCD+1
  181. DEX ; HIGH ORDER DIGITS
  182. LDA PLBCD
  183. ADC #0
  184. STA PLBCD
  185. CLD
  186. JSR NEWLEVEL
  187. JMP SELOVER
  188. SELLEFT
  189. LDA PLRACK
  190. BEQ SELOVER
  191. DEC PLRACK
  192. SED
  193. LDA PLBCD+1
  194. SEC
  195. SBC #1
  196. STA PLBCD+1
  197. LDA PLBCD
  198. SBC #0
  199. STA PLBCD
  200. CLD
  201. JSR NEWLEVEL ; DISPLAYS PLBCD
  202. ; COME HERE AFTER A JOYSTICK PUSH HAS BEEN DETECTED-- RESET DEBOUNCE
  203. SELOVER LDA TEMP2
  204. STA THRWTIME
  205. DEC TEMP1
  206. BMI SPEEDUP
  207. ENDCYCLE
  208. SPEEDUP LDA #5
  209. STA TEMP2
  210. ENDCYCLE
  211. SELCONT1 LDA HJOYDIR
  212. CMP #8
  213. BNE SELBYE
  214. SETTT0 LDA #0
  215. STA THRWTIME
  216. LDA #2 ; FASTER TIMER
  217. STA TEMP1
  218. LDA #30
  219. STA TEMP2
  220. SELBYE ENDCYCLE
  221. GENDSEL
  222. LDX CURRENT
  223. BEQ SELCOPY1
  224. LDA PLBCD
  225. STA PL1BCD
  226. LDA PLBCD+1
  227. STA PL1BCD+1
  228. JMP SELEXIT
  229. SELCOPY1 LDA PLBCD
  230. STA PL0BCD
  231. LDA PLBCD+1
  232. STA PL0BCD+1
  233. SELEXIT LDA PLRACK
  234. STA PL0RACK,X
  235. ; SED
  236. LDA PLBCD
  237. BEQ NO10
  238. LDA #10 10 extra lives for the 100
  239. CLC
  240. ADC PLLIVES
  241. STA PLLIVES
  242. STA PL0LIVES,X
  243. NO10 LDA PLBCD+1 now, one for every 10s digit
  244. LSR A
  245. LSR A
  246. LSR A
  247. LSR A
  248. CLC
  249. ADC PLLIVES
  250. STA PLLIVES
  251. STA PL0LIVES,X
  252. ; CLD
  253. LDA #MGAME
  254. STA MODE
  255. MOVE #STATINIT,STATUS
  256. NEWSTATE GAME
  257. JSR AWOLDRAW ; PUT WALL BACK
  258. JMP CLRSCRN ; GET RID OF THIS DISPLAY
  259. ; same as JSR and RTS ( to INIT.S)
  260. NEWLEVEL LDA #FALSE ; USE THIS TO TELL IF ZEROES ARE
  261. STA TEMP0 ; DISPLAYED
  262. LDA PLBCD ; LIVES IN BCD
  263. BEQ SBLANK1 ; IF ZERO, PUT A BLANK
  264. ASL A ; TIMES 2
  265. ADC #$D6 ; DIGIT "1" IS AT $D8
  266. STA CLOWMAP2
  267. LDA #TRUE
  268. STA TEMP0
  269. JMP NEWLP1
  270. SBLANK1 LDA #$2F
  271. STA CLOWMAP2
  272. NEWLP1 LDA PLBCD+1
  273. LSR A
  274. LSR A
  275. LSR A
  276. LSR A
  277. LDX TEMP0
  278. BNE NEWLP2 ; IF "TRUE", DISPLAY IT
  279. TAY ; TO RESET FLAGS TO "A"
  280. BNE NEWLP2 ; IF NOT ZERO, DISPLAY IT
  281. LDA #$2F ; IF A LEADING ZERO, PUT A BLANK
  282. STA CLOWMAP2+1
  283. JMP NEWLP3
  284. NEWLP2 ASL A ; TIMES 2
  285. ADC #$D6 ; THE "O" CHARACTER
  286. STA CLOWMAP2+1
  287. NEWLP3 LDA PLBCD+1
  288. AND #$F
  289. ASL A ; TIMES 2
  290. ADC #$D6
  291. STA CLOWMAP2+2
  292. RTS
  293. mkcomb lda #statcomb
  294. sta status
  295. lda #0
  296. sta temp5
  297. endcycle
  298. combine ldx temp5
  299. lda hjoydir
  300. cmp olddir
  301. beq skip
  302. sta olddir
  303. cmp #8
  304. beq skip
  305. cmp nextcomb,x
  306. beq cont
  307. lda #statplay
  308. sta status
  309. skip endcycle
  310. cont inc temp5
  311. cpx #3
  312. bmi cont001
  313. stx FOODSTUF
  314. cont001 cpx #7
  315. bpl doit
  316. endcycle
  317. doit
  318. jsr clrmaps
  319. ldy #00
  320. sty dlist4+1
  321. iny to get 1
  322. doitlp1 lda ctext1,y by
  323. sta txtlist2,y
  324. dey
  325. bpl doitlp1
  326. ldy #11
  327. doitlp0 lda ctext4,y keith sawyer
  328. sta txtlist3,y
  329. dey
  330. bpl doitlp0
  331. LDA #L(TXTLIST1) ; "PLAYER N"
  332. STA DLIST3
  333. LDA #$60
  334. STA DLIST3+1
  335. LDA #H(TXTLIST1)
  336. STA DLIST3+2
  337. ldy #13
  338. doitlp2 lda ctext2,y the "alchemist
  339. sta txtlist1,y
  340. dey
  341. bpl doitlp2
  342. ldy #6
  343. doitlp3 lda ctext3,y of fun"
  344. sta clowmap2,y
  345. dey
  346. bpl doitlp3
  347. ldx #$be new widths for character strings
  348. stx dlist6+3
  349. ldx #$94
  350. stx dlist5+3
  351. ldx #$b2
  352. stx dlist3+3
  353. ldx #$b9
  354. stx dlist2+3
  355. lda #72 new horizontal positions
  356. sta dlist6+4
  357. lda #32
  358. sta dlist5+4
  359. lda #24
  360. sta dlist3+4
  361. lda #52
  362. sta dlist2+4
  363. endcycle
  364. nextcomb DB 0,4,2,6,0,4,2,6
  365. CLRMAPS
  366. LDX #$2B
  367. LDA #NULL2
  368. MKSELP0 STA TXTLIST1,X
  369. DEX
  370. BNE MKSELP0
  371. RTS
  372. NSTABLE DB L(TXTLIST2),$60,H(TXTLIST2),$B1,$10
  373. NSTABLE1 DB L(TXTLIST3),$60,H(TXTLIST3),$B4,$38
  374. NSTABLE2 DB L(TXTLIST1),$60,H(TXTLIST1),$B3,$30
  375. NSTABLE3 DB L(CLOWMAP2),$60,H(CLOWMAP2),$BC,$40
  376. END