TEXT.S 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. ; TEXT.S
  2. ; THIS ROUTINE HANDLES THE TEXT STRING DISPLAY, AND CONTAINS ALL TABLES
  3. ; NEEDED FOR THE PROMPTS.
  4. ;
  5. GLBL MTEXT
  6. GLBL PROMPT,MKPROMPT
  7. GLBL GOD
  8. GLBL DLIST6,DLIST5,DLIST7
  9. GLBL TXTLIST1,TXTLIST2,TXTLIST3
  10. GLBL NULL2
  11. GLBL TRUE,FALSE
  12. GLBL NEWGAME,MKLOGO
  13. GLBL COLORS
  14. GLBL FINFO
  15. GLBL TEXTTM1,TEXT0,TEXT1,TEXT2,TEXT4,TEXT5,TEXT6
  16. GLBL TEXTLEN,TEXTPOS,PPTRL,PPTRH
  17. GLBL FSTATE
  18. GOTIME EQU $30
  19. RAMDEF ; ZERO PAGE
  20. RSEG CODE1
  21. ; THE ROUTINE "MKPROMPT" EXPECTS THE TYPE OF PROMPT IN A.
  22. ; CURRENTLY ALL PROMPTS TAKE UP TWO LINES
  23. ; IT SETS UP THE MODE AND THE TIME COUNT.
  24. ; CURRENTLY, TRY THIS-- DON'T DO AN "RTS" UNTIL THE WAIT IS OVER
  25. ; THIS WAY, I CAN RE-ENTER THE CODE EXACTLY WHERE THIS WAS CALLED.
  26. MKPROMPT ASL A ; MULTIPLY BY TWO
  27. TAX ; FIND FIRST STRING HERE
  28. ONSCREEN wait until off-screen to hack
  29. INVBLANK display lists
  30. LDA TEXTTM1,X
  31. STA SYSCOUNT
  32. LDA #FALSE
  33. STA RUNLOAD ; NO LOADER !
  34. ; ZERO OUT ALL THREE "TXTLIST" STRINGS:
  35. LDY #$2A ; 13+14+15
  36. T0LP LDA #NULL2
  37. STA TXTLIST1,Y
  38. DEY
  39. BPL T0LP
  40. CPX #4 ; INSTANT REPLAY MESSAGE
  41. BNE TXTDL6
  42. LDY LISTSIZE+7
  43. LDA #L(TXTLIST3)
  44. STA DLIST7,Y
  45. LDA #H(TXTLIST3)
  46. STA DLIST7+2,Y
  47. LDA #$B2 ; PALETTE 5, WIDTH 14
  48. STA DLIST7+3,Y
  49. LDA TEXTPOS,X
  50. STA DLIST7+4,Y ; HPOS
  51. LDA #0
  52. STA DLIST7+6,Y
  53. ; STORE PALW LAST OF ALL:
  54. LDY LISTSIZE+7
  55. LDA #$60
  56. STA DLIST7+1,Y
  57. ; COPY THE TEXT STRING:
  58. LDA PPTRL,X
  59. STA LISTPTRA ; POINTER TO THIS TEXT
  60. LDA PPTRH,X
  61. STA LISTPTRA+1
  62. LDY TEXTLEN,X ; NUMBER OF CHARACTERS
  63. TXT3LP LDA (LISTPTRA),Y
  64. STA TXTLIST3,Y
  65. DEY
  66. BPL TXT3LP
  67. INX
  68. ; PUT TEXT IN DLIST6. THIS WILL NORMALLY BE THE UPPERMOST LINE OF TEXT,
  69. ; THE EXCEPTION BEING THE INSTANT REPLAY MESSAGE, WHICH
  70. ; ALSO USES DLIST7.
  71. TXTDL6 LDY LISTSIZE+6 ; FIRST STRING DLIST 6
  72. LDA #L(TXTLIST1)
  73. STA DLIST6,Y
  74. ; STORE PALW LAST OF ALL
  75. LDA #H(TXTLIST1)
  76. STA DLIST6+2,Y
  77. LDA #$B3 ; PALETTE 5, WIDTH 13
  78. STA DLIST6+3,Y
  79. LDA TEXTPOS,X
  80. STA DLIST6+4,Y ; HPOS
  81. LDA #0
  82. STA DLIST6+6,Y
  83. ; STORE PALW LAST OF ALL, TO PREVENT ON-SCREEN GLITCH:
  84. LDY LISTSIZE+6
  85. LDA #$60
  86. STA DLIST6+1,Y
  87. ; COPY THE TEXT STRING:
  88. LDA PPTRL,X
  89. STA LISTPTRA ; POINTER TO THIS TEXT
  90. LDA PPTRH,X
  91. STA LISTPTRA+1
  92. LDY TEXTLEN,X ; NUMBER OF CHARACTERS
  93. TXT1LP LDA (LISTPTRA),Y
  94. STA TXTLIST1,Y
  95. DEY
  96. BPL TXT1LP
  97. INX ; NEXT TEXT STRING
  98. LDY LISTSIZE+5 ; NEXT LOWER DLIST
  99. LDA #L(TXTLIST2)
  100. STA DLIST5,Y
  101. LDA #H(TXTLIST2)
  102. STA DLIST5+2,Y
  103. LDA #$B1 ; PALETTE 5, 15 CHARACTER MAXIMUM
  104. STA DLIST5+3,Y
  105. LDA TEXTPOS,X
  106. STA DLIST5+4,Y ; HPOS
  107. LDA #0
  108. STA DLIST5+6,Y
  109. ; STORE PALW LAST OF ALL:
  110. LDY LISTSIZE+5
  111. LDA #$60
  112. STA DLIST5+1,Y
  113. ; COPY THIS TEXT STRING:
  114. LDY TEXTLEN,X
  115. LDA PPTRL,X
  116. STA LISTPTRA
  117. LDA PPTRH,X
  118. STA LISTPTRA+1
  119. TXT2LP LDA (LISTPTRA),Y
  120. STA TXTLIST2,Y
  121. DEY
  122. BPL TXT2LP
  123. ; NOTE-- IF THIS MESSAGE IS "PLAYER N", FILL IN THE PLAYER NUMBER
  124. MOVE #0,TEMP4 used as an indicator for GAME OVER
  125. CPX #1 ; "EAT THE CONE!"
  126. BEQ TXTADDPL
  127. CPX #3 ; "GAME OVER"
  128. BEQ TXTGOVER
  129. CPX #6
  130. BNE TXTCONT0 if equal, an IR message
  131. ; If this is the "GAME OVER" message, set up the counters which
  132. ; make the palettes flash.
  133. ; Use the RAM location FINFO, which was being used for the cone timing.
  134. TXTIROVR
  135. MOVE #$80,TEMP4 flag for IR message
  136. MOVE COLORS+15,TEMP5 start with this color
  137. JMP TXTCONT0
  138. TXTGOVER MOVE #GOTIME,FINFO
  139. MOVE #0,FSTATE
  140. MOVE #$40,TEMP4 flag for GAME OVER message
  141. TXTADDPL LDA CURRENT ; 0 OR 1
  142. ASL A ; 0 OR 2
  143. CLC
  144. ADC #$D8 ; LOW BYTE FOR DIGIT "1"
  145. STA TXTLIST2+7
  146. TXTCONT0 LDA MODE ; KEEP TO RESTORE LATER
  147. STA TEMP0
  148. MOVEWORD GODPTR,TEMP2 ; SAVE POINTER AS WELL
  149. LDA #MTEXT
  150. STA MODE
  151. NEWSTATE PROMPT
  152. ENDCYCLE
  153. ; THIS ROUTINE JUST WAITS UNTIL IT'S TIME TO GET RID OF THE TEXT.
  154. ; AT THIS TIME, LET THE LOADER RUN AGAIN, THEREBY ERASING
  155. ; THE TEXT AS A SIDE EFFECT OF "MLOADER". ALSO , RESTORE
  156. ; THE PREVIOUS MODE FROM "TEMP0".
  157. ; FIRST POLL THE RESET AND SELECT BUTTONS TO CHANGE MODES
  158. ;
  159. ; Addition: If this is the GAME OVER message, then decrement the timer
  160. ; to see if a new palette is due for the message. FSTATE
  161. ; tells whether the colors are palette 4 or 5.
  162. PROMPT LDA FPRESET ; IF RESET WAS PUSHED, GO TO GAME
  163. BPL PRCONT2
  164. LDA RESREADY
  165. BPL PRCONT2
  166. LDA #FALSE ; DON'T LET IT GO AGAIN !
  167. STA RESREADY
  168. JMP NEWGAME ; START A NEW GAME AND RETURN
  169. PRCONT2 LDA FPSELECT ; SELECT SWITCH
  170. BEQ PRCONT3 ; IF IT'S NOT PRESSED
  171. JMP MKLOGO ; START MENU MODE AND RETURN
  172. PRCONT3 LDA NUMCYCLE ; ONLY ONCE PER FRAME !
  173. CMP #1
  174. BNE PCONT00
  175. DEC SYSCOUNT
  176. BNE PCONT00
  177. ; IF WE GET HERE, THE WAIT IS OVER; RESTORE STUFF AND FINALLY DO THE
  178. ; "RTS" TO WHATEVER LOCATION CALLED "MKPROMPT"
  179. LDA TEMP0
  180. STA MODE
  181. MOVEWORD TEMP2,GODPTR
  182. RTS
  183. ; If TEMP4 is non-zero, this is the GAME OVER message.
  184. PCONT00 LDA TEMP4
  185. BPL PCONT10 not IR message
  186. INC TEMP5 actually stored in DLI2
  187. JMP PCONT01
  188. PCONT10 ASL A
  189. BPL PCONT01 not GAME OVER either
  190. DEC FINFO else, this is the GAME OVER message
  191. BNE PCONT01
  192. LDA FSTATE only flash 4 times:
  193. CMP #4 (yellow)->red->yellow->red->yellow
  194. BPL PCONT01
  195. LDX #$93
  196. LSR A
  197. BCC PCONT02 time for palette 4, RED
  198. ;time for YELLOW again
  199. LDX #$B3
  200. PCONT02
  201. INC FSTATE
  202. LDA LISTSIZE+6
  203. CLC
  204. ADC #3
  205. TAY
  206. TXA
  207. STA DLIST6,Y
  208. LDA LISTSIZE+5
  209. CLC
  210. ADC #3
  211. TAY
  212. TXA
  213. STA DLIST5,Y
  214. LDA #GOTIME
  215. STA FINFO
  216. PCONT01 ENDCYCLE
  217. END