LOGO.S 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. ; LOGO.S
  2. ; THIS FILE CONTAINS THE ROUTINE FOR STARTING UP THE LOGO, "MKLOGO"
  3. ; AND ALSO THE LOOP WHICH POLES THE FIRE BUTTON TO SEE IF
  4. ; I SHOULD JUMP INTO STATPLAY AGAIN.
  5. GLBL LOGO
  6. GLBL DRAWLOGO
  7. GLBL MKHISCOR ; IN "HISCORE.S"
  8. GLBL MKAUTO
  9. GLBL CLEARALL
  10. GLBL POLLALL
  11. GLBL DWORDL,DWORDH,DWORDLEN ; USED IN "HISCORE"
  12. MKLOGO LDA #FALSE ; NO MLOADER IN LOGO MODE
  13. STA RUNLOAD
  14. STA SELREADY
  15. LDX #$FF ; RESET STACK POINTER
  16. TXS
  17. LDA #STATLOGO
  18. STA STATUS
  19. LDA #MLOGO
  20. STA MODE
  21. NEWSTATE LOGO
  22. INX ; MAKE SURE PLAYER 0 JOYSTICK IS USED
  23. STX CURRENT
  24. STX SCORELST+1
  25. STX STATLIST+1
  26. STX NUMCYCLE
  27. INX
  28. STX MAXCYCLE
  29. INX now is 2
  30. STX SYSCOUNT+1
  31. LDA #$58 ; STAY HERE FOR 10 SECONDS
  32. STA SYSCOUNT
  33. ONSCREEN wait for onscreen, then
  34. INVBLANK off screen
  35. JSR DRAWLOGO ; SET UP THE LOGO ITSELF
  36. LDA #$19 ; COLORS FOR TEXT
  37. STA COLORS+20 palette 5
  38. LDA #$15
  39. STA COLORS+21
  40. LDA #$1F
  41. STA COLORS+22
  42. LDA #8 ; LOGO DLISTS-- EACH WITH TWO ENTRIES
  43. STA LISTSTRT+8
  44. STA LISTSTRT+9
  45. ; NOW, SET UP THE HEADERS USED BY MENU SELECT. THESE (FOR NOW) ARE IN
  46. ; DLIST3 (DIFFICULTY) AND DLIST4 (PLAYNUM)
  47. ; NOTE: ALSO THERE IS THE COPYRIGHT MESSAGE
  48. ; PUT BLANKS IN THE CHARACTER MAPS:
  49. ; (ALL THREE, LENGTHS 13,14, AND 15)
  50. LDX #$2A
  51. LDA #NULL2
  52. MKLOLP0 STA TXTLIST1,X
  53. DEX
  54. BNE MKLOLP0
  55. LDA #L(TXTLIST1) ; COPYRIGHT, CENTERED AT BOTTOM
  56. STA DLIST0
  57. LDA #$60
  58. STA DLIST0+1
  59. LDA #H(TXTLIST1)
  60. STA DLIST0+2
  61. LDA #$B3 ; PALETTE 5, 13 LENGTH
  62. STA DLIST0+3
  63. LDA #$20
  64. STA DLIST0+4
  65. LDX #11
  66. LCOPYLP LDA COPYTXT,X
  67. STA TXTLIST1,X
  68. DEX
  69. BPL LCOPYLP
  70. LDA #L(TXTLIST2)
  71. STA DLIST3
  72. LDA #$60
  73. STA DLIST3+1
  74. LDA #H(TXTLIST2)
  75. STA DLIST3+2
  76. LDA #$B4 ; 12 CHARACTERS; PALETTE 5
  77. STA DLIST3+3
  78. LDX HOWHARD
  79. LDA DWORDPOS,X ; HPOS
  80. STA DLIST3+4
  81. LDA DWORDL,X ; COPY WORD INTO "TXTLIST2"
  82. STA TEMP0
  83. LDA DWORDH,X use stack for indirect
  84. STA TEMP1
  85. LDY DWORDLEN,X
  86. LDIFFLP LDA (TEMP0),Y
  87. STA TXTLIST2,Y
  88. DEY
  89. BPL LDIFFLP
  90. ; NUMBER OF PLAYERS WILL SWITCH BETWEEN DLIST2 AND DLIST4. SETUP
  91. ; EVERYTHING THE SAME EXCEPT FOR THE SECOND BYTE.
  92. LDA #$60
  93. LDX PLAYNUM
  94. BEQ LCOPYLP1 ; IF ONE PLAYER
  95. STA DLIST4+1 ; IF TWO PLAYER
  96. LDA #0
  97. STA DLIST2+1 playnum must be 1
  98. BEQ LCOPYLP2 jump
  99. LCOPYLP1 STA DLIST2+1
  100. STX DLIST4+1 x is 0
  101. LCOPYLP2 LDA #L(TXTLIST3)
  102. STA DLIST2 ; "ONE PLAYER" IN "DLIST2"
  103. STA DLIST4
  104. LDY #2
  105. LLOOP22 LDA LLTABLE,Y this loop stores to this header
  106. STA DLIST2+2,Y the values #H(txtlist3),#$b4,#$28
  107. STA DLIST4+2,Y
  108. DEY
  109. BPL LLOOP22
  110. ; PLAYNUM is in X
  111. AALOGO
  112. LDA PWORDL,X ; PLACE IN "TXTLIST3"
  113. STA TEMP0
  114. LDA PWORDH,X
  115. STA TEMP1
  116. LDY #9
  117. LPLAYLP LDA (TEMP0),Y
  118. STA TXTLIST3,Y
  119. DEY
  120. BPL LPLAYLP
  121. INY FALSE is 0
  122. STY DOITOVER
  123. LDA #30 ; DE-BOUNCE BEFORE FIRST SWITCH
  124. STA THRWTIME
  125. JSR SCRAPALL
  126. ; JSR DPPINIT ; TURN DMA ON
  127. ENDCYCLE
  128. ; THIS WILL ALSO BE CALLED FROM "HISCORE.S"
  129. DRAWLOGO LDA #$37 ; PROPER COLORS FOR PALETTE 6
  130. STA COLORS+24
  131. LDA #$35
  132. STA COLORS+25
  133. LDA #$33
  134. STA COLORS+26
  135. JSR CLRSTRCT
  136. JSR CLEARALL ; SIMILAR TO "CLRSCRN" BUT MORE SO
  137. LDA #LOGOTOP1
  138. STA FSTAMP
  139. LDA #LOGOTOP2
  140. STA FSTAMP+1
  141. LDA #LOGOBOT1
  142. STA FSTAMP+2
  143. LDA #LOGOBOT2
  144. STA FSTAMP+3
  145. LDA #159 ; TOP OF ZONE 9
  146. STA FYPOS
  147. STA FYPOS+1
  148. LDA #143
  149. STA FYPOS+2 ; TOP OF ZONE 8
  150. STA FYPOS+3
  151. LDA #BLOCK2
  152. STA FHSTAMP
  153. STA FHSTAMP+1
  154. STA FHSTAMP+2
  155. STA FHSTAMP+3
  156. LDA #LOGOPW1
  157. STA FPALW
  158. STA FPALW+2 ; LEFT HALVES
  159. LDA #LOGOPW2
  160. STA FPALW+1
  161. STA FPALW+3 ; RIGHT HALVES
  162. LDA #24
  163. STA FXPOS
  164. STA FXPOS+2 ; LEFT HALVES
  165. LDA #88
  166. STA FXPOS+1
  167. STA FXPOS+3 ; RIGHT HALVES
  168. JMP FLOADER ; LOAD INTO PROPER DLISTS
  169. ; same as JSR followed by RTS
  170. ; GOD COMES HERE DURING TITLE PAGE
  171. LOGO LDA HTHROW ; ACTUAL CONTROLLER VALUE
  172. ; BPL LOGCONT0 ; IF "THROWBUT == FALSE"
  173. BMI NEWGAME1 ; ELSE, BUTTON IS DOWN: START GAME
  174. LOGCONT0 LDX FPRESET ; IF RESET WAS PUSHED, GO TO GAME
  175. BPL LOGCONT2
  176. INX from $ff to 0
  177. STX RESREADY "false"
  178. NEWGAME1 JMP NEWGAME
  179. ; DO THE GAME OPTION SELECT BY POLLING THE JOYSTICK:
  180. ; NOTE: ALSO POLL THE SELECT SWITCH, AT THE SAME DEBOUNCE RATE.
  181. LOGCONT2 LDA THRWTIME
  182. BEQ LSELTEST ; IF ZERO, STAY HERE WAITING FOR A
  183. DEC THRWTIME ; BUTTON
  184. JMP LOGCONT1
  185. LSELTEST LDX FPSELECT ; SELECT SWITCH
  186. BEQ LLTEST ; IF IT'S NOT PRESSED
  187. INX from $ff to 0
  188. STX SELREADY "false"
  189. ; THERE ARE REALLY 8 "STATES" OR GAME OPTIONS-- 4 DIFFICULTY LEVELS
  190. ; TIMES 2 PLAYNUM VALUES. THUS THE FOLLOWING LOGIC--
  191. LDX HOWHARD
  192. LDA PLAYNUM
  193. BEQ LSTEST00 ; 1 PLAYER-- FIRST HALF OF TABLES
  194. TXA ; 2 PLAYER
  195. CLC
  196. ADC #4
  197. TAX
  198. LSTEST00 LDA SELNUM,X ; NEW PLAYNUM
  199. STA PLAYNUM
  200. LDA SELDIFF,X ; NEW DIFFICULTY
  201. STA HOWHARD
  202. BPL LLOVER ; RESET 10-SECOND TIMER
  203. ;a jump
  204. LLTEST LDX PLAYNUM
  205. LDY HOWHARD
  206. LDA HJOYDIR
  207. BEQ LLUP
  208. CMP #2
  209. BEQ LLRIGHT
  210. CMP #4
  211. BEQ LLDOWN
  212. CMP #6
  213. BEQ LLLEFT
  214. CMP #8
  215. BNE LLOVER ; IF NOT CENTERED, RESET SYSCOUNT
  216. JMP LOGCONT1 ; ELSE DECREMENT
  217. LLUP
  218. LDA UPNUM,X
  219. STA PLAYNUM
  220. BPL LLOVER
  221. LLDOWN
  222. LDA DOWNNUM,X
  223. STA PLAYNUM
  224. BPL LLOVER
  225. LLRIGHT
  226. LDA RIGHTNUM,Y
  227. STA HOWHARD
  228. BPL LLOVER
  229. LLLEFT
  230. LDA LEFTNUM,Y
  231. STA HOWHARD
  232. ; IF ANY OPTION IS CHANGED, THE CODE WILL COME HERE. ZERO OUT THE PLAYER
  233. ; SCORES-- AND RESET THE DEBOUNCE COUNTER
  234. LLOVER LDA #30
  235. STA THRWTIME
  236. LDX #3
  237. LDA #0
  238. LLSC0LP STA PL0SCORE,X
  239. STA PL1SCORE,X
  240. DEX
  241. BPL LLSC0LP
  242. LDA #2 ; IF JOYSTICK WAS PUSHED, 10 MORE
  243. STA SYSCOUNT+1 ; SECONDS
  244. LDA #$58
  245. STA SYSCOUNT
  246. LDX #$1C ; ZERO OUT DIFFICULTY AND PLAYNUM
  247. LDA #NULL2
  248. LLLOOP0 STA TXTLIST2,X
  249. DEX
  250. BPL LLLOOP0
  251. LDX HOWHARD ; UPDATE DIFFICULTY WORD
  252. LDA DWORDL,X ; COPY WORD INTO "TXTLIST2"
  253. STA TEMP0
  254. LDA DWORDH,X
  255. STA TEMP1
  256. LDA DWORDPOS,X
  257. STA DLIST3+4 ; HPOS
  258. LDY DWORDLEN,X
  259. LLDIFFLP LDA (TEMP0),Y
  260. STA TXTLIST2,Y
  261. DEY
  262. BPL LLDIFFLP
  263. LDX PLAYNUM ; UPDATE NUMBER OF PLAYERS WORD
  264. AALOGO1
  265. LDA PWORDL,X
  266. STA TEMP0
  267. LDA PWORDH,X ; PLACE IN "TXTLIST3"
  268. STA TEMP1
  269. LDY #9
  270. LLPLAYLP LDA (TEMP0),Y
  271. STA TXTLIST3,Y
  272. DEY
  273. BPL LLPLAYLP
  274. LDA #$60 ; WILL BE PLACED IN THE LUCKY DLIST
  275. LDX PLAYNUM ; PLACE IN PROPER DLIST
  276. BEQ LLPLAY01 ; ONE PLAYER
  277. STA DLIST4+1 ; FOR TWO PLAYER
  278. DEX playnum must be 1
  279. STX DLIST2+1 store 0
  280. LCJMP JMP LOGCONT2
  281. LLPLAY01 STA DLIST2+1
  282. LDA #0
  283. STA DLIST4+1
  284. BEQ LCJMP ; SKIP OVER THIS TEST
  285. LOGCONT1 LDX SELREADY
  286. BEQ LOGCONT3 ; STILL UP-- DON'T RESET DEBOUNCE
  287. LDA HJOYDIR
  288. CMP #8
  289. BNE LOGCONT3 ; STILL PUSHED-- DON'T RESET
  290. INX ; MAKE SURE THAT THE FIRST PUSH
  291. STX THRWTIME ; REGISTERS IMMEDIATELY
  292. ; selready must have been $ff--
  293. ; store 0 to thrwtime
  294. LOGCONT3 LDA SYSCOUNT ; DEC TIMER AND TEST
  295. SEC
  296. SBC #1
  297. STA SYSCOUNT
  298. LDA SYSCOUNT+1
  299. SBC #0
  300. STA SYSCOUNT+1
  301. BNE LOGOBYE
  302. LDA SYSCOUNT
  303. BNE LOGOBYE
  304. AENDLOGO LDX #0 ; DO ALL FOUR DIFFICULTY LEVELS
  305. AENDLOOP STX TEMP4
  306. JSR MKHISCOR
  307. DMAOFF
  308. JSR POLLALL find out if any switches are down
  309. LDY #FALSE
  310. LDA FPRESET
  311. BNE LEAVE1
  312. LDA FPSELECT
  313. BNE LEAVE2
  314. LDA HTHROW
  315. BNE LEAVE3
  316. LDA HJOYDIR
  317. CMP #$08
  318. BNE LEAVEIT
  319. LDX TEMP4 POLLALL trashes X
  320. INX
  321. CPX #4
  322. BMI AENDLOOP
  323. JSR HSCRTN
  324. JSR MKAUTO
  325. ENDCYCLE
  326. LEAVEIT JSR HSCRTN
  327. JSR MKLOGO
  328. LEAVE1 STY RESREADY
  329. JMP LEAVE
  330. LEAVE2 STY SELREADY
  331. BNE LEAVE ; same as JMP
  332. LEAVE3 STY THREADY
  333. LEAVE JSR HSCRTN clean-up after HSC is done
  334. JMP NEWGAME
  335. LOGOBYE ENDCYCLE
  336. ; USED TO ERASE ALL DLISTS
  337. CLEARALL ONSCREEN
  338. INVBLANK
  339. LDX #10
  340. ZCLRA00 LDA LISTTABL,X
  341. STA LISTPTR
  342. LDA LISTTABH,X
  343. STA LISTPTR+1
  344. LDY #0
  345. STY LISTSTRT,X
  346. STY LISTSIZE,X
  347. ZCLRA01 LDA #0
  348. STA (LISTPTR),Y
  349. INY
  350. CPY #LISTLENG ; LENGTH OF A DLIST
  351. BNE ZCLRA01
  352. DEX ; GO TO NEXT DLIST
  353. BPL ZCLRA00
  354. RTS
  355. LLTABLE DB H(TXTLIST3),$B4,$28