123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812 |
- *** DEATH.S ***
- * DVP 4/26/84 ALL PAUSE MODE CODE NOW LOCALIZED IN CHKSTRT
- * DVP 8/12 CHECK FOR START AND END OF GAME, COLLISIONS WITH SHOOTER,
- * AND HANDLE FIRING AND EXPLOSIONS
- STRTMEN EQU 3 ;HOW MANY MEN DO WE START GAME WITH?
- STRTDUAL EQU 6 ;START DUAL GAME WITH 2 ON SCREEN, 4
- ; EXTRA
- TEAMMEN EQU 17 ;LEFTMOST MAN LOCATION IN TEAM MAN POOL
- CHKSTRT JSR STICKIT0 ;DO TRACKBALL CRAP
- LDA FRMCNT ;DISPLAY OF THE SCORE IS DISABLED
- BNE CHKSTRT1 ; WHEN SCRTIMER IS NEGATIVE
- LDA ATTRACT ; THIS CHUNK INCREMENTS THE VALUE
- BEQ CHKSTRT1 ; DURING ATTRACT MODE; LATER IN THIS
- LDX SCRTIMER ; ROUTINE, ANY INPUT SETS SCRTIMER
- BMI CHKSTRT1 ; BACK TO 0
- INC SCRTIMER
- CHKSTRT1 LDA PANEL ;TEST RESET SWITCH
- LSR A
- BCS RSTDBNC
- STA DEBOUNC1
- RTS
- RSTDBNC LDA #$FF
- EOR DEBOUNC1
- BPL SKPGMRST
- STA DEBOUNC1 DEBOUNC1 SHOULD BE NEGATIVE ON LEAVING
- JMP GMRESET
- SKPGMRST LDA ATTRACT ;NO RESET -- IN GAME SELECT?
- BPL NOOPTSET
- JMP SETGMOPT
- * GAME PLAY OR ATTRACT
- NOOPTSET
- LDA PANEL ;TEST GAME SELECT SWITCH DURING GAME
- AND #$02
- BNE THATSALL ;BRANCH IF SWITCH NOT PRESSED
- JMP GOINTOTP
- THATSALL LDA ATTRACT
- BEQ PAUSEME
- JMP SKPNORST
- * GAME PLAY
- * PAUSE HANDLING
- PAUSEME
- LDA PANEL
- LDX PAUSETMR CURRENTLY PAUSED?
- BNE PAUSED YES
- *********** NOT CURRENTLY PAUSED
- AND #$08 IS BUTTON PRESSED?
- BEQ STRTPAUS
- RTS NO
- STRTPAUS LDX #1 THIS DISABLES TUNER FROM RUNNING
- STX PAUSETMR
- DEX
- STX AUDV0 YES, START PAUSE
- STX AUDV1
- WAITPSE LDA PANEL AND WAIT FOR BUTTON TO BE RELEASED
- AND #$08 (PANEL IS UPDATED AT 60 HZ.)
- BEQ WAITPSE
- STAYPSD LDA PANEL INTERNAL PAUSE LOOP CHECK OF RESET
- LSR A BUTTON
- BCS NOOPTSET NOT PRESSED
- WAITRST LDA PANEL PRESSED, WAIT FOR RELEASE
- LSR A
- BCC WAITRST
- JMP GMRESET
- *********** CURRENTLY PAUSED WITH DMA STILL ON
- PAUSED AND #$08 IS BUTTON PRESSED?
- BEQ ENDPAUSE YES, ENDPAUSE
- JSR ONSCREEN
- JSR OFFSCRN
- INC PAUSETMR+1 NO, INCREMENT TIME. EVERY FRAME
- BNE STAYPSD
- INC PAUSETMR EVERY 256 FRAMES
- LDA PAUSETMR
- CMP #$FF
- BNE STAYPSD
- *********** 18 MINUTE TIMEOUT
- LDX #$7F TURN DMA OFF
- STX CTRL
- LDA #L(MORPHO) TOP OF SCREEN VECTOR
- STA VECTORI
- LDA #H(MORPHO)
- STA VECTORI+1
- BLANKLP JSR ONSCREEN
- JSR OFFSCRN SINCE DMA IS OFF ...
- JSR TRACKIT FOR COMING OUT OF PAUSE WITH TRACKBALL
- LDX #1 RESET PAUSE TIMER AND TURN SCREEN BACK
- JSR STICKIT ON IF WE SEE ANY ...
- CMP #$F0 JOYSTICK MOVEMENT
- BMI UNBLANK
- JSR STICKIT0
- CMP #$F0
- BMI UNBLANK
- LDA BUTNIB OR BUTTON PUSHES
- AND BUTNIB+1
- BPL UNBLANK
- LDA PANEL OR SELECT OR RESET PUSHES
- AND #$03
- CMP #$03
- BNE ENDBLANK
- LDA PANEL PAUSE BUTTON PRESSED?
- AND #$08
- BNE BLANKLP NO
- *********** RESTART GAME AFTER TIMEOUT
- ENDBLANK JSR TURNON TURN DMA ON
- ENDPAUSE LDA PANEL WAIT FOR BUTTON TO BE RELEASED
- AND #$08
- BEQ ENDPAUSE
- LDA PANEL DID RESET BRING US OUT OF BLANK?
- LSR A
- BCS RESUME NO
- WAITRST2 LDA PANEL RESET PRESSED, WAIT FOR RELEASE
- LSR A DON'T TURN PAUSE OFF YET SO SOUND
- BCC WAITRST2 STAYS OFF
- JMP GMRESET
- RESUME LDA #0 TURN PAUSE OFF, RESUME GAME PLAY
- STA PAUSETMR
- RTS
- *********** RESTART PAUSE AFTER SELECT OR RESET WHEN SCREEN BLANK
- UNBLANK LDA #1
- STA PAUSETMR
- JSR TURNON
- JMP STAYPSD
- *********** RESTART DISPLAY
- TURNON JSR ONSCREEN TURN DMA ON
- JSR OFFSCRN
- LDX #$43
- STX CTRL
- RTS
- * ATTRACT MODE
- SKPNORST
- LDA SCHTICK ;CHECK JOYSTICK DURING ATTRACT GAME
- ORA #$0F ; PLAY; ANY MOVEMENT GOES INTO
- EOR #$FF ; TITLE PAGE TO START GAME SELECT
- BEQ SWTCHCLR
- LDA #1
- STA DEBOUNC2
- SKMNPGJP JMP SKPMENPG ;ALWAYS
- SWTCHCLR LDA DEBOUNC2
- BEQ SKMNPGJP
- GOINTOTP LDA #60
- STA OPTCNT2
- LDA #0
- STA DEBOUNC2
- ;;;;; LDA #0
- STA SCRTIMER
- JSR SCOREDL ;DISPLAY SCORES AGAIN IN TITLE PAGE
- LDA #$80
- STA ATTRACT
- JMP INITATGM
- * TITLE PAGE
- SETGMOPT LDA PANEL ;CHECK GAME SELECT SWITCH IN TITLE PAGE
- AND #$02
- BEQ SELECTIT
- LDA #$00 ;SET NEXT CHANGE TO HAPPEN WHEN SWITCH
- STA OPTCNT2 ; PRESSED
- BEQ NOGMSEL ;ALWAYS
- SELECTIT LDA #0 ;SWITCH WAS PRESSED
- STA SCRTIMER ; DISPLAY SCORES AGAIN IN TITLE PAGE
- JSR SCOREDL
- DEC OPTCNT2 ;DELAY BETWEEN CHANGES WHILE SWITCH
- BPL NOGMSEL ; DOWN
- LDA #45
- STA OPTCNT2
- JSR NXTGMOPT ;SWITCH PRESSED, GO TO NEXT OPTION
- JMP UPDATDSP
- NOGMSEL LDA SCHTICK ;CHECK FOR JOYSTICK MOVEMENT DURING
- STA GTEMP1 ; TITLE PAGE GAME SELECT
- ORA #$0F
- EOR #$FF
- BNE SKPOPCTZ
- LDA #0 ;NO INPUT
- STA OPTCNT1
- GOSKPMN JMP LVMENUPG ;ALWAYS
- SKPOPCTZ LDA #0
- STA SCRTIMER
- JSR SCOREDL ;DISPLAY SCORE AGAIN IN TITLE PAGE
- DEC OPTCNT1 ;WHAT IS OPTCNT1, 2?
- BPL GOSKPMN
- LDA #30
- STA OPTCNT1
- LDA GTEMP1
- BMI NOATEAST
- LDA DIFLEVEL
- CMP #3
- BEQ UPDATDSP
- INC DIFLEVEL ;INCREASE DIFFICULTY
- BNE UPDATDSP ;ALWAYS
- NOATEAST ASL A
- BMI CHKPLYNM
- DFWEST LDA DIFLEVEL
- BEQ UPDATDSP
- DEC DIFLEVEL ;DECREASE DIFFICULTY
- BPL UPDATDSP ;ALWAYS
- CHKPLYNM ;LDA GTEMP1
- ;ASL A
- ASL A
- BMI NOATSTH
- LDA GAMETYPE
- AND ALTCTRLS
- CMP #1
- BNE ALTTP2
- LDA #0
- STA ALTCTRLS
- BEQ UPDATDSP
- ALTTP2 LDA GAMETYPE
- CMP #2
- BNE INCGMTP2
- LDA TRACKF
- BEQ INCGMTP2
- LDA TRACKF+1
- BNE INCGMTP2 ;TWO TRACKBALLS
- NXTGMTP2 LDA #1 ;SHARE THE TRACKBALL
- STA ALTCTRLS
- INCGMTP2 LDA GAMETYPE
- BEQ UPDATDSP
- DEC GAMETYPE ;DECREASE GAMETYPE
- BPL UPDATDSP
- NOATSTH ASL A
- BMI UPDATDSP
- JSR INCALT
- BNE UPDATDSP
- LDA GAMETYPE
- CMP #3
- BEQ UPDATDSP
- INC GAMETYPE ;INCREASE GAMETYPE
- UPDATDSP
- LDA #0
- LDX #2
- ZSCRLP STA SCORE0,X
- STA SCORE1,X
- STA SCORE2,X
- DEX
- BPL ZSCRLP
- LDX #0
- JSR CLRMAPZN
- LDA #1 ;WHEN AN INPUT HAS BEEN RECEIVED, KEEP
- STA LETTRNUM ; TITLE PAGE UP THERE LONGER
- LVMENUPG JSR DSPLYOPT
- SKPMENPG LDA SHOTTIMR ;CHECK FOR BUTTON RESTART
- BEQ CHKBTTN
- DEC SHOTTIMR
- BNE NORESET
- CHKBTTN LDA BUTNIB ;GAME START WHEN BUTTON COMES UP
- BMI BTNUP
- STA DEBOUNCE ;INPT4 LOW (BTN. DOWN), SET DEBOUNCE LO
- NORESET RTS
- BTNUP EOR DEBOUNCE
- BPL NORESET
- STA DEBOUNCE ;INPT4 HIGH (BTN. UP), DEBOUNCE LOW
- ; =START, DEBOUNCE HIGH
- ******************************************
- * RESET -- START A NEW GAME
- ******************************************
- GMRESET LDA #$00 ;TURN ON GAME AND INITIALIZE
- STA SCRTIMER
- STA ATTRACT
- JSR INITGAME
- LDX #STRTMEN-1 ;SET THE NUMBER OF MEN LEFT IN GAME
- STX MENLEFT ; AND DISPLAY IT
- LDY GAMETYPE
- BEQ ZINITLV1 ;ONE PLAYER GAME
- DEY
- BEQ ZINITLVX ;TWO PLAYER ALTERNATING
- DEY
- BEQ ZINITLV2 ;TWO PLAYER SIMULTANEOUS
- LDX #STRTDUAL-2 ;TEAM PLAY -- MEN LEFT POOL
- STX MENLEFT
- LDA #L(ELF320)
- INITLVB STA MUSHMAP+TEAMMEN-1,X
- DEX
- BNE INITLVB
- RTS
- ZINITLVX INX
- ZINITLV2 STX MENLEFT+1
- LDY #5
- LDA #L(ELF320)
- INITLV2 STA MUSHMAP+ZONELEN-12,Y
- DEY
- DEX
- BNE INITLV2
- ZINITLV1 LDX MENLEFT
- LDA #L(ELF320)
- INITLV1 STA MUSHMAP+6-1,X
- DEX
- BNE INITLV1
- RTS
- ******************************************
- *** CHANGE GAME OPTIONS
- ******************************************
- NXTGMOPT
- INC DIFLEVEL
- LDA DIFLEVEL
- CMP #4
- BNE NOGMEND
- LDX #0
- STX DIFLEVEL
- JSR INCALT
- BNE NOGMEND
- INCGMTP INC GAMETYPE
- LDA GAMETYPE
- CMP #4
- BNE NOGMEND
- WRAPGMTP STX GAMETYPE
- NOGMEND RTS
- INCALT LDA GAMETYPE
- CMP #1
- BNE NEXTGMTP
- LDA ALTCTRLS
- BNE NEXTGMTP
- LDA TRACKF
- BEQ NEXTGMTP
- LDA TRACKF+1
- BNE NEXTGMTP ;TWO TRACKBALLS
- LDA #1
- STA ALTCTRLS ;SHARE THE TRACKBALL
- BNE INCALTND
- NEXTGMTP LDA #0
- STA ALTCTRLS
- INCALTND RTS
- ********************************************************************************
- * CHKEND *
- * CHECK FOR THE END OF A GAME AND THE END OF EACH PLAYER'S TURN *
- ********************************************************************************
- CHKEND LDA SHTRTIMR
- BEQ NOGMEND
- * CHECK TO MAKE SURE MUSHROOM RESTORATION HAS FINISHED BEFORE PROCEEDING
- BIT FLAGS
- BVS NOGMEND
- SEC
- SBC #1
- STA SHTRTIMR
- AND #$7F
- BNE NOGMEND
- LDA GAMETYPE
- CMP #2
- BCC CHKEND1 ;NOT A DUAL PLAYER MODE
- LDX #0
- STX PLAYER
- ;;;;; LDA GAMETYPE
- CMP #3
- BEQ CHKEND1
- LDA MENLEFT ;IS THERE A MESSAGE UP?
- AND #$C0
- BNE CHKEND1
- LDA MENLEFT+1
- AND #$C0
- BNE CHKEND2
- LDA SHTRSTAT ;ONLY CHECK SHOOTER WITH POSITIVE
- BEQ CHKEND1 ; STATUS (HAS BEEN BLOWN AWAY)
- CHKEND2 INC PLAYER
- CHKEND1 BIT ATTRACT
- BMI NOGMEND
- BVC SKPGMATR
- ******************************************
- * ATTRACT MODE GAME OVER?
- ******************************************
- LDA ATGMTMR
- AND #$7F
- CMP #20
- BCC ZGAME
- JMP GAMEDONE
- ZGAME LDA #-1
- STA ATTSHTRY
- STA ATTSHTRY+1
- JMP INATGAME
- ******************************************
- * "PLAYER X" MESSAGE DISPLAYED LONG ENOUGH, START PLAYING AGAIN
- ******************************************
- OTHERPLR ;GET RID OF "PLAYER x " MESSAGE AT
- LDA MENLEFT,X ; START OF A PLAYER'S TURN
- AND #$07
- STA MENLEFT,X
- LDA #0
- STA SHTRTIMR
- ERSPLR LDY #8
- ERASEPLR LDA MSGSTORE+9,Y
- STA MUSHMAP+13*ZONELEN+11,Y
- DEY
- BPL ERASEPLR
- RTS
- ******************************************
- * SOMEBODY DIED RECENTLY, DO SOMETHING ABOUT IT
- ******************************************
- SKPGMATR
- LDX PLAYER
- LDA MENLEFT,X
- BEQ OUTOFGM ;SOMEBODY'S GAME JUST ENDED
- BPL ZCONTGM
- JMP ZMSGOVER ;"GAME OVER" MESSAGE DONE DISPLAYING
- ZCONTGM AND #$40
- BNE OTHERPLR ;"PLAYER X" MESSAGE DONE, RESUME PLAY
- JMPINGM JMP INGAME ;GAME STILL IN PROGRESS
- ******************************************
- * SOMEBODY'S GAME JUST ENDED, DISPLAY
- * "GAME OVER , PLAYER X" MESSAGE
- ******************************************
- OUTOFGM LDA GAMETYPE
- CMP #3
- BNE GAMEOUT
- LDA SHTRSTAT ;A TEAM PLAY GAME DOESN'T END UNTIL
- ORA SHTRSTAT+1 ; BOTH PLAYERS HAVE DIED
- BPL GAMEOUT
- LDA #$40
- LDY SHTRSTAT
- BMI NOTDEAD1
- STA SHTRSTAT
- BPL DEAD1 ;ALWAYS
- NOTDEAD1 STA SHTRSTAT+1
- DEAD1 LDA FLAGS
- ORA #$80
- STA FLAGS
- JMP INATGAME
- GAMEOUT LDY #8 ;DISPLAY "GAME OVER"
- ZDSPGOVR LDA MUSHMAP+12*ZONELEN+11,Y
- STA MSGSTORE,Y
- LDA MGMOVER,Y
- STA MUSHMAP+12*ZONELEN+11,Y
- DEY
- BPL ZDSPGOVR
- LDY GAMETYPE ;IN ONE PLAYER OR TEAM PLAY GAMES,
- DEY ; DON'T CARE WHICH PLAYER
- CPY #2
- BCS STMSGTMR
- * ALTERNATING OR COMPETITION GAME
- LDA SHTRTIMR ;DID BOTH PLAYERS LOSE A LIFE?
- BPL COMPCHK ;NO
- LDA MENLEFT ;DID BOTH PLAYERS GAMES END?
- ORA MENLEFT+1
- BEQ STBTHVR ;YES
- LDA MENLEFT ;IF OTHER PLAYER GOT BROUGHT BACK TO
- AND MENLEFT+1 ; LIFE BY MY MUSHROOM RESTORATION,
- BEQ COMPCHK ; CLEAR THE FLAG
- LDA FLAGS
- AND #$7F
- STA FLAGS
- COMPCHK DEY ;AFTER THIS, Y=#$FF=ALT, Y=0=COMP
- BNE PLRXOVER ;ALTERNATING
- BIT FLAGS ;IS OTHER PLAYER ALSO DEAD?
- BMI WHOWINS ;YES
- ;;;;; LDX PLAYER ;IS SCORE OF PLAYER WHO DIED HIGHER
- JSR CMPSCORE ; THAN OR SAME AS PLAYER WHO LIVED?
- BCS PLRXOVER ;YES--KEEP PLAYING
- LDA FLAGS ;NO, OTHER PLAYER WON AND GAME IS OVER
- ORA #$80
- STA FLAGS
- BCC OTHRWINS
- * DISPLAY "PLAYER X"
- PLRXOVER JSR SHOWPLR1 ;"PLAYER 1" MESSAGE
- LDX PLAYER ;GET CORRECT PLAYER NUMBER
- TXA
- CLC
- ADC #L(DGT1)
- STA MUSHMAP+13*ZONELEN+19 ;PUT CORRECT PLAYER NUMBER UP
- JMP STMSGTMR
- * SET BOTH-GAMES-OVER FLAG
- STBTHVR LDA FLAGS ;BOTH DIED, SET FLAG TO SHOW OTHER
- ORA #$80 ; PLAYER'S GAME HAS ENDED
- STA FLAGS
- * DECIDE WHICH PLAYER WON
- WHOWINS
- ;;;;; LDX PLAYER
- JSR CMPSCORE
- BCC OTHRWINS ;OTHER PLAYER DEFINITELY WON
- TYA
- TAX ;SWITCH PLAYERS
- JSR CMPSCORE
- BCS GAMETIED
- ;SWITCH BACK
- OTHRWINS TYA
- TAX
- * DISPLAY "PLAYER X WINS"
- PLRXWINS LDY #12 ;PUT UP "PLAYER 1WINS"
- ZDSPWINR LDA MPLAYER,Y
- STA MUSHMAP+14*ZONELEN+9,Y
- DEY
- BPL ZDSPWINR
- TXA
- CLC
- ADC #L(DGT1)
- STA MUSHMAP+14*ZONELEN+16 ;PUT CORRECT PLAYER NUMBER UP
- LDA #L(EMPTY)
- STA MUSHMAP+14*ZONELEN+17
- * SET TIMER FOR MESSAGE
- STMSGTMR DEC MENLEFT,X ;SET MENLEFT,X = #$FF AS "GAME OVER"
- ; DISPLAY FLAG
- LDA SHTRTIMR
- ORA #$7F ;SET TIMER TO LEAVE GAME OVER MESSAGE
- STA SHTRTIMR ; UP
- RTS
- GAMETIED LDY #12 ;PUT UP "YOU HAVE TIED"
- ZDSPTIE LDA MTIE,Y
- STA MUSHMAP+14*ZONELEN+9,Y
- DEY
- BPL ZDSPTIE
- BMI STMSGTMR
- ******************************************
- * "GAME OVER" MESSAGE DISPLAYED LONG ENOUGH
- ******************************************
- ZMSGOVER LDA GAMETYPE
- BEQ DONEHSCR ;ALWAYS HIGH SCORE IN ONE PLAYER
- CMP #3
- BEQ GMEDONE ;NEVER HIGH SCORE AT TOP IN TEAM PLAY
- LDA FLAGS ;IN TWO PLAYER MODES, WE'RE STILL IN
- BPL NOTGMVR ; GAME IF OTHER PLAYER HADN'T ALREADY
- ; DIED
- ******************************************
- * ALL GAMES HAVE ENDED -- DO SOMETHING ABOUT IT
- ******************************************
- DONEHSCR JSR CHKHSCR ;CHECK HIGH SCORE AT TOP OF DISPLAY
- GMEDONE LDX #0
- LDA GAMETYPE ;TEAM PLAY?
- BEQ TMHSC0
- CMP #3
- BNE NOTMHSC
- JSR CMPSCORE ;YES--IS PLAYER 1'S SCORE HIGHER?
- BCS TMHSC0 ; YES
- BCC TMHSC1 ; NO--USE PLAYER 2
- NOTMHSC JSR HSCNTR1
- TMHSC1 LDX #1
- TMHSC0 JSR HSCNTR1
- GAMEDONE LDA #$80
- STA ATTRACT
- JMP INITATGM ;INITIALIZE GAME ATTRACT MODE
- ******************************************
- * RESTART THE OTHER PLAYER IN A TWO PLAYER ALTERNATING OR SIMULTANEOUS GAME
- * AFTER OTHER PLAYER'S GAME JUST ENDED
- ******************************************
- NOTGMVR ORA #$80
- STA FLAGS ;SET THAT FLAG
- LDA #0 ;DELETE "GAME OVER" DISPLAY FLAG
- STA MENLEFT,X
- LDA #$40 ;INDICATE THAT THIS PLAYER'S GAME IS
- STA SHTRSTAT,X ; OVER
- LDA GAMETYPE
- CMP #2
- BNE ALTGM ;BRANCH IF ALTERNATING GAME
- LDY #8 ;IN SIMULTANEOUS GAME, MUST ERASE
- ZERSGOVR LDA MSGSTORE,Y ; "GAME OVER" FROM MUSHROOM FIELD
- STA MUSHMAP+12*ZONELEN+11,Y
- DEY
- BPL ZERSGOVR
- BMI SIMULTGM ;"PLAYER X" MESSAGE STAYS UP AS READY
- ; MESSAGE
- ******************************************
- * ENTRY POINT FOR RESTARTING GAMES AFTER LOSING A LIFE, NOT A GAME
- ******************************************
- INGAME LDA GAMETYPE
- CMP #1
- BNE INGAME1P
- * TWO PLAYER ALTERNATING GAME, SWITCH PLAYERS IF BOTH ALIVE
- LDA FLAGS
- BMI INGAME1P ;BRANCH IF ONLY ONE ALIVE
- ALTGM JSR SWAP
- JSR SHOWPLR1 ;DISPLAY "PLAYER 1"
- SIMULTGM LDA #1
- STA COLORFLG
- EOR PLAYER
- TAX
- STX PLAYER
- CLC
- ADC #L(DGT1)
- STA MUSHMAP+13*ZONELEN+19 ;PUT CORRECT PLAYER NUMBER UP
- LDA MENLEFT,X ;SET "PLAYER X" MESSAGE FLAG
- ORA #$40
- STA MENLEFT,X
- LDA SHTRTIMR
- ORA #$7F ;TIME TO LEAVE IT UP
- STA SHTRTIMR
- BMI KILL1 ;HANDLES CASE OF BOTH PLAYERS DYING
- ; OTHER PLAYER LOST GAME, THIS ONE
- ; DIDN'T
- LDA GAMETYPE ;AT THIS POINT IN SIMULT. GAME, OTHER
- CMP #2 ; PLAYER'S GAME JUST ENDED AND THIS
- BEQ INATGAME ; PLAYER SHOULDN'T LOSE A LIFE
- ******************************************
- * REMOVE AN EXTRA MAN TO BE USED AS CURRENT MAN
- ******************************************
- INGAME1P
- LDA SHTRTIMR ;SHTRTIMR IS NEGATIVE IF BOTH PLAYERS
- BPL KILL1 ; DIED IN SAME FRAME
- * BOTH PLAYERS LOST A LIFE
- LDA GAMETYPE ;TEAM PLAY?
- CMP #3
- BNE KILL2 ;NO
- LDA MENLEFT
- BNE STILLTM
- JMP GAMEOUT ;LOST TWO LIVES, ENDING THE GAME
- STILLTM
- ;;;;; LDX #0 ;YES
- JSR TAKEMAN
- DEC MENLEFT ;IN GAME 3 PLAYER ALWAYS IS 0
- BNE KILL1
- * AT THIS POINT IN TEAM PLAY GAME, ONLY ONE PLAYER CONTINUES -- DECIDE WHICH
- LDX #1
- JSR CMPSCORE
- LDA #$40 ;PLAYER 2 CONTINUES
- LDY #$80
- BCS GOPLR2
- TAY ;PLAYER 1 CONTINUES
- ASL A
- GOPLR2 STA SHTRSTAT
- STY SHTRSTAT+1
- LDA FLAGS
- ORA #$80
- STA FLAGS
- BNE INATGAME
- KILL2 LDX #1 ;DUAL PLAYER COMPETITION, BOTH PLAYERS
- STX PLAYER ; LOST A LIFE. WE KNOW PLAYER 1'S
- LDA MENLEFT+1 ; GAME ISN'T OVER, HOW ABOUT PLAYER
- BNE DOKILL2 ; 2'S?
- JMP OUTOFGM
- DOKILL2 JSR TAKEMAN
- DEC MENLEFT+1
- LDX #0
- STX PLAYER
- KILL1 ; LDX PLAYER
- JSR TAKEMAN
- DEC MENLEFT,X ;DEDUCT A LIFE
- ******************************************
- * INITIALIZE TO START PLAYING AGAIN
- ******************************************
- INATGAME LDA #$00
- ;;;;; STA SHOTSTAT ;THIS IS ALWAYS SET TO $80 LATER
- STA SHOTSTAT+1
- LDA SHTRTIMR
- AND #$7F
- STA SHTRTIMR
- JSR MAKCENTI
- LDA #$00
- STA FLEASTAT
- STA SPDRSTAT
- LDX DIFLEVEL
- LDA SPDRWTDF,X
- STA SPDRTIMR
- * PUT THE SHOOTERS BACK TOGETHER
- INITPLRS LDA #CNTRCLMN ;CALLED AS SUBROUTINE FROM CMAIN
- STA SHOOTERX
- STA SHOOTERX+1
- LDA #CNTRCLMN+2
- STA SHOTX
- STA SHOTX+1
- LDY #184
- STY SHOOTERY
- STY SHOOTERY+1
- DEY
- STY SHOTY
- STY SHOTY+1
- LDA #L(ELF)
- STA SHTROFST
- LDA #L(ELFB)
- STA SHTROFST+1
- JSR SHTRCLRS
- LDA GAMETYPE
- CMP #2
- BCC SNGLSHIT ;GAMES 0 OR 1 -- NOT DUAL PLAY
- BEQ CHKFLAGS
- LDX #1 ;TEAM PLAY
- LDA SHTRSTAT+1
- BMI SHTEMUP
- LDX #0
- SHTEMUP STX PLAYER
- CHKFLAGS LDA FLAGS ;IS EITHER PLAYER DEAD?
- BPL DUALSHIT ;NO
- SNGLSHIT LDX PLAYER
- LDA #$80
- STA SHTRSTAT,X
- STA SHOTSTAT,X
- TXA
- EOR #$01
- TAX
- LDA #$40
- STA SHTRSTAT,X
- LDA #$00
- STA SHOTSTAT,X
- RTS
- DUALSHIT LDA #$80
- STA SHTRSTAT
- STA SHTRSTAT+1
- STA SHOTSTAT
- STA SHOTSTAT+1
- LDA #CNTRCLMN-8
- STA SHOOTERX
- LDA #CNTRCLMN-8+2
- STA SHOTX
- LDA #CNTRCLMN+8
- STA SHOOTERX+1
- LDA #CNTRCLMN+8+2
- STA SHOTX+1
- RTS
- SHTRCLRS LDA #$18 ;SHOOTER1
- STA P0C1
- STA P0C2
- LDA #$6E
- STA P0C3
- LDA #$97 ;SHOOTER2
- STA P1C1
- STA P1C2
- LDA #$0F
- STA P1C3
- RTS
- ******************************************
- SHOWPLR1 LDY #8 ;PUT UP "PLAYER 1 " OR "PLAYER 2 "
- ZDSPPLR1 LDA MUSHMAP+13*ZONELEN+11,Y ;MESSAGE AT THE START OF A
- STA MSGSTORE+9,Y ;PLAYER'S TURN, AND GET RID OF IT
- LDA MPLAYER,Y ;WITH OTHERPLR CODE ABOVE
- STA MUSHMAP+13*ZONELEN+11,Y
- DEY
- BPL ZDSPPLR1
- RTS
- ******************************************
- * REMOVE A MAN FROM EXTRA MAN POOL
- ******************************************
- TAKEMAN LDX PLAYER
- LDA MENLEFT,X
- AND #$07
- CPX #0
- BEQ SUBLIFE1
- SUBLIFE2 EOR #$FF
- CLC
- ADC #21
- SUBLIFE1 LDY GAMETYPE
- CPY #3
- BNE SUB1
- SUBTEAM CLC
- ADC #TEAMMEN-6
- SUB1 TAY
- LDA #L(EMPTY)
- STA MUSHMAP+6-1,Y
- RTS
- ******************************************
- * COMPARE THE TWO PLAYER'S SCORES
- ******************************************
- CMPSCORE TXA ;RETURNS CARRY SET IF PLAYER X'S SCORE
- EOR #$01 ; GREATER THAN OR EQUAL TO OTHER
- TAY ; PLAYER'S
- LDA SCORE0,X
- CMP SCORE0,Y
- LDA SCORE1,X
- SBC SCORE1,Y
- LDA SCORE2,X
- SBC SCORE2,Y
- LDA SCORE3,X
- SBC SCORE3,Y
- RTS
- ******************************************
- * CHECK HIGH SCORE, PUT INTO TOP ROW OF SCREEN
- ******************************************
- ;FIRST CHECK FOR THE PRESENSE OF HIGH SCORE CART
- CHKHSCR
- LDY DIFLEVEL ;HIGH SCORE IN DIFFERENT GAME VERSIONS?
- LDX GAMETYPE ;CHECK SCORES OF BOTH PLAYERS
- BEQ HSCORELP
- LDX #1
- HSCORELP LDA HSCORE0,Y
- CMP SCORE0,X
- LDA HSCORE1,Y
- SBC SCORE1,X
- LDA HSCORE2,Y
- SBC SCORE2,X
- BCS HSCNXTPL
- LDA SCORE0,X
- STA HSCORE0,Y
- LDA SCORE1,X
- STA HSCORE1,Y
- LDA SCORE2,X
- STA HSCORE2,Y
- HSCNXTPL DEX
- BPL HSCORELP
- RTS
- ************************************************
- * SWAP THE MUSHROOM MAPS FOR TWO PLAYER GAME
- ************************************************
- SWAP LDX #1 ;IGNORE ROW 0 (SCORE ROW)
- LDA #L(MUSHMAP+ZONELEN) ;INITIAL ROW, MUSHMAP
- STA GTEMP1
- LDA #H(MUSHMAP+ZONELEN)
- STA GTEMP2
- LDA #L(MAP2) ;INITIAL ROW, MAP2
- STA GTEMP3
- LDA #H(MAP2)
- STA GTEMP4
- SWTCHLP1 LDY #ZONELEN-1 ;LOOP THROUGH ROW
- SWTCHLP2 LDA (GTEMP1),Y ;READ OUT OF MUSHMAP, INTO A TEMP.
- STA GTEMP5
- LDA (GTEMP3),Y ;READ OUT OF MAP2, INTO MUSHMAP
- STA (GTEMP1),Y
- LDA GTEMP5 ;READ OUT OF TEMP., INTO MAP2
- STA (GTEMP3),Y
- DEY
- BPL SWTCHLP2
- INX ;NEXT ROW
- CPX #NZONES-1 ;THERE IS NO MAP FOR LAST ROW
- BEQ SWTCHOUT
- LDA GTEMP1
- CLC
- ADC #ZONELEN
- STA GTEMP1
- BCC NROWMAP2
- INC GTEMP2
- NROWMAP2 LDA GTEMP3
- CLC
- ADC #ZONELEN
- STA GTEMP3
- BCC SWTCHLP1
- INC GTEMP4
- BNE SWTCHLP1
- SWTCHOUT RTS
- ******************************************
- * COLLISION DETECTION ROUTINE FOR SHOOTER
- * CALLED BY THE INDIVIDUAL OBJECT MOVEMENT ROUTINES
- * X = OBJECT NUMBER
- ******************************************
- SHTRCOLL BIT ATTRACT
- BMI SWTCHOUT
- LDA GAMETYPE
- CMP #2
- BCC ZSHTRCOL
- LDA #0
- STA PLAYER
- LDA SHTRSTAT+1
- AND #$D0
- CMP #$80
- BNE ZSHTRCOL
- LDA SHTRSTAT
- AND #$D0
- CMP #$80
- BNE SHTRCOL2
- JSR ZSHTRCOL
- SHTRCOL2 INC PLAYER
- ZSHTRCOL LDY PLAYER
- LDA OBJX,X
- SEC
- SBC SHOOTERX,Y
- CPX #SPDROBJ
- CLC
- BNE NOTSPCLL
- ADC #SPDRWDTH-1 ;DO IF X=12
- CMP #SPDRWDTH+5-2
- BCC HITSHTRX
- RTS
- NOTSPCLL BPL FLEAPLXX ;BRANCH IF X=13
- ADC #SEGWDTH-1
- CMP #SEGWDTH+5-2
- BCS SHCLRTS
- BCC HITSHTRX
- * COLLISION RANGE FOR FLEA: -2 <= (OBJX-SHTRX) <= 3
- * SO ADD 2 AND COMPARE: 0 <= (OBJX-SHTRX) <= 5
- FLEAPLXX ADC #2 ;FLEAWDTH-3
- CMP #6 ;
- BCS SHCLRTS
- HITSHTRX
- LDA OBJY,X
- SEC
- SBC SHOOTERY,Y
- BPL NOTNEGC2
- EOR #$FF
- CLC
- ADC #$01
- NOTNEGC2 CMP #6
- BCS SHCLRTS
- HITPLAY LDA SHTRTIMR
- BEQ ONEDEAD
- LDA #$80
- ONEDEAD ORA #$30
- STA SHTRTIMR
- LDA #L(EXPLOS) ;DIFFERENT EXPLOSION?
- STA SHTROFST,Y
- * START PLAYER DEATH SOUND?
- JSR SCRAPALL
- LDA #3
- JSR TUNIN
- LDA #0
- STA SHOTSTAT,Y
- SHCLRTS RTS
- ******************************************
- *** SHOT.S ***
- ******************************************
- * DVP 7/29
- SHOOT BIT ATTRACT
- BMI SHCLRTS
- LDA GAMETYPE
- CMP #2
- BCC SHOOTZ
- LDA #0
- STA PLAYER
- BIT SHTRSTAT+1
- BVS SHOOTZ
- BIT SHTRSTAT
- BVS SHOOTHR
- LDA FRMCNT
- AND #$01
- STA PLAYER
- JSR SHOOTZ
- LDA PLAYER
- SHOOTHR EOR #$01
- STA PLAYER
- SHOOTZ LDA SHTRTIMR
- BNE SHOTOUT ;IF SHOOTER IS DEAD
- LDX PLAYER
- LDA SHOTSTAT,X
- LSR A
- BCS SHOTCOLL ;DID SHOT HIT ANYTHING?
- LDA SHTRSTAT,X ;IS THE SHOOTER RESING IN?
- AND #$90
- CMP #$90
- BNE RESIN2
- LDA FRMCNT
- AND #$0F
- ORA #$10
- CPX #1
- BNE RESIN1
- ORA #$80
- STA P1C2
- BNE RESIN2
- RESIN1 STA P0C2
- RESIN2 JMP CHKSHOT
- *CHECK FOR COLLISION OF SHOT AND OBJECT
- SHOTCOLL ;LDX PLAYER
- LDA SHOTX,X
- STA GTEMP1
- LDA SHOTY,X
- CLC ;IF THIS IS CHANGED, ALSO CHANGE WHERE
- ADC #2 ; MUSHCNT IS DECREMENTED BELOW
- JSR OBSTAC ;CHECK FOR MUSHROOM
- CMP #L(EMPTY+1)
- BCC NOMSHHIT
- CMP #L(POISONED+1)
- BCS NOMSHHIT
- ;;;;; CMP #L(FLOWER) ;FLOWER STOPS THE SHOT
- ;;;;; BEQ ENDSHOT
- TAX ;GET VALUE FOR MUSHROOM AFTER HIT
- LDA MUSHHIT-$41,X
- STA (GTEMP3),Y
- CMP #L(EMPTY)
- BNE ENDSHOT
- LDA #1 ;KILLED A MUSHROOM--ADD 1 TO SCORE
- ; LDY #0
- LDX PLAYER
- JSR ADDSCORE
- LDX PLAYER ;X WAS TRASHED BY ADDSCORE, MAYBE
- LDA SHOTY,X ;DECREMENT MUSHROOM COUNT, IF NECESSARY
- CLC
- ADC #2
- LSR A
- LSR A
- LSR A
- CMP #INFLDZN-1
- BCC ENDSHOT
- LDA GAMETYPE
- CMP #1
- BEQ ZDECMSH
- LDX #0 ;USE ONLY MUSHCNT, NOT MUSHCNT+1, IN
- ZDECMSH DEC MUSHCNT,X ; DUAL PLAYER GAMES
- ENDSHOT LDX PLAYER
- LDA #$80
- STA SHOTSTAT,X
- LDA SHOOTERX,X
- CLC
- ADC #2
- STA SHOTX,X
- LDA SHOOTERY,X
- SEC
- SBC #1
- STA SHOTY,X
- ;;;;; LDA #L(ELFWSHOT)
- ;;;;; STA SHTROFST,X
- SHOTOUT RTS
- ;USHHIT DB L(EMPTY),L(QDYING),L(HDYING)
- ; DB L(EMPTY),L(QLIVE),L(HLIVE),L(TLIVE)
- ; DB L(HGROWN),L(QGROWN),L(EMPTY),L(FLOWER)
- ; DB L(EMPTY),L(QPOIS),L(HPOIS),L(TPOIS)
- MUSHHIT DB L(ZERO),L(ZERO),L(ELF320)
- DB L(EMPTY),L(QLIVE),L(HLIVE),L(TLIVE)
- DB L(ZERO),L(ZERO),L(ZERO),L(ZERO)
- DB L(EMPTY),L(QPOIS),L(HPOIS),L(TPOIS)
- NOMSHHIT
- LDA PLAYER
- CLC
- EOR #$01
- ADC #14
- TAX
- SHOTOBJC LDA OBJSTAT,X
- BPL NXTOB ;NEXTOBJC
- LDA OBJOFFST,X
- CMP #L(POINT300)
- BCS NXTOB
- LDY PLAYER
- LDA SHOTY,Y ;SHOTY-OBJY
- SEC
- SBC OBJY,X
- BPL POSDIFF
- EOR #$FF
- CLC
- ADC #1
- POSDIFF CMP #8
- BCS NXTOB
- LDA SHOOTERY,Y ;CHECK TO MAKE SURE OBJECT IS ABOVE
- SEC ;SHOOTER
- SBC OBJY,X ;SHOOTERY-OBJY
- SBC #6
- CMP #200
- BCS NXTOB
- LDA SHOTX,Y
- SEC
- SBC OBJX,X
- CPX #13
- BEQ FLSCSHOT
- BCS JMPPLRHT
- CPX #12
- BCS NOTSEGSH
- JMP SEGSHOT
- NOTSEGSH CMP #SPDRWDTH
- BCC SPDRPNTS
- NXTOB JMP NEXTOBJC
- JMPPLRHT CMP #FLEAWDTH
- BCS NXTOB
- LDA GAMETYPE
- CMP #2
- BNE NXTOB
- TXA ;GET PLAYER NUMBER OF PLAYER WHO DIED
- SEC
- SBC #14
- TAY
- JMP HITPLAY
- SPDRPNTS LDX PLAYER
- LDY #0
- LDA SHOOTERY,X
- SEC
- SBC SPDRY
- CMP #40
- BCS SPDREXPL
- LDY #2
- CMP #16
- BCC SPDREXPL
- LDY #1
- SPDREXPL LDA POINTSPR,Y
- STA SPDROFST
- * CHANGE PALETTE FOR SPIDER POINTS TO THAT OF PLAYER WHO SHOT IT
- LDA OBJPALWD+12
- AND #$1F
- LDX PLAYER
- BEQ PNTSCLR
- ORA #$20
- PNTSCLR STA OBJPALWD+12
- LDA FRMCNT
- AND #$18
- EOR #$80
- STA SPDRSTAT
- LDA #$10
- STA SPDRTIMR
- LDA #MINX
- CMP SPDRX
- BCS PNTSON
- LDA #MAXX-SPDRWDTH-3
- CMP SPDRX
- BCS GOSPOUT
- PNTSON STA SPDRX
- GOSPOUT LDA MULT3SP,Y
- TAY
- LDA #1
- JSR SCRAPONE
- JMP SKER ;USED TO BE SHOTSCR
- FLSCSHOT TAY
- LDA FLEASTAT
- AND #$40
- BEQ SCRPSHOT
- FLEASHOT CPY #FLEAWDTH
- BCC HITFLEA
- NXOB JMP NEXTOBJC
- HITFLEA LDY #2
- LDA DIFLEVEL
- CMP #2
- BCC ICPTYOG ;ONLY ONE SHOT KILLS FLEA IN EASY
- LDA FLEASTAT
- ORA #$03
- CMP FLEASTAT
- BEQ ICPTYOG
- STA FLEASTAT
- JMP ENDSHOT
- ICPTYOG LDA #4
- JMP SHOTSCR
- SCRPSHOT CPY #SCRPWDTH
- BCS NXOB
- INC FLEAX ;ADJUST EXPLOSION POSITION
- LDY #10
- LDA #5 ;TURN OFF SCORPION SOUND
- JMPSHTSC JMP SHOTSCR
- SEGSHOT CMP #SEGWDTH
- BCS NEXTOBJC
- LDA OBJY,X
- CMP #2
- BCC NEXTOBJC
- * WE HAVE HIT A SEGMENT
- * MIDDLE OF A CHAIN? -- IF SO, MAKE NEXT SEG. NEW HEAD
- CPX #11
- BEQ KILLSEGM
- LDA OBJOFFST+1,X
- CMP #L(EXPLOS)
- BCS KILLSEGM
- LDA OBJSTAT+1,X
- AND #$A0
- CMP #$80
- BNE KILLSEGM
- LDA OBJSTAT+1,X
- ORA #$20
- STA OBJSTAT+1,X
- LDA OBJOFFST+1,X
- EOR #$30
- STA OBJOFFST+1,X
- * PUT MUSHROOM UP, KILL SEGM
- KILLSEGM LDA OBJOFFST,X
- AND #$04
- EOR #$04
- BNE SKIPFC
- LDA #$FE
- SKIPFC ORA #$02 ;X-2 OR X+6
- CLC
- ADC OBJX,X ;PUT UP A MUSHROOM IN SEGMENT'S PLACE
- CMP #MINX
- BCS SEGML
- LDA #MINX
- SEGML CMP #MAXX
- BCC SEGMR
- LDA #MAXX-1
- SEGMR STA GTEMP1
- LDA OBJY,X
- JSR COBSTAC
- BNE KILLIT
- TXA
- PHA
- LDA OBJY,X
- JSR CMUSHER
- PLA
- TAX
- KILLIT LDA #L(EXPLOS)
- STA OBJOFFST,X
- DEC NUMSEG ;ONE LESS SEG. ON SCREEN
- LDA #2
- JSR TUNIN
- * SCORE A CENTIPEDE SEGMENT
- SEGSCORE LDY #$00 ;ADDING SCORE FOR CENTIPEDE SEGMENT
- LDA OBJSTAT,X ;IF BODY SEGMENT -- ADD 10 POINTS
- AND #$20
- LSR A
- EOR #$10
- BNE BODYSCR
- INY ;HEAD -- ADD 100 POINTS
- BODYSCR LDX PLAYER
- JSR ADDSCORE
- JMP ENDSHOT
- NEXTOBJC DEX
- BMI SHOTUP
- CPX #13
- BCC JUMPSHOT
- LDX #13
- JUMPSHOT JMP SHOTOBJC
- SHOTSCR
- * EXPLOSION PICTURE, SOUND
- JSR SCRAPONE
- LDA #L(EXPLOS)
- STA OBJOFFST,X
- SKER
- LDA #2
- JSR TUNIN
- LDX PLAYER
- LDA #0
- JSR ADDSCORE
- JENDS JMP ENDSHOT ;JENDS CALLED FROM SHOTUP BELOW
- * CHECK FOR NEW SHOT
- CHKSHOT LDX PLAYER
- BIT ATTRACT
- BMI NOSHOT
- BVS ATTRSHOT
- LDA BUTNIB,X ;CHECK FIRE BUTTON
- BMI NOSHOT
- ATTRSHOT ;LDA #L(ELF)
- ;;;;; STA SHTROFST,X
- JSR STOPRES
- LDA #$81 ;MARK SHOT AS FIRED -- ALWAYS AT RIGHT
- STA SHOTSTAT,X ; POSITION
- LDA #0 ;START A NEW SHOT
- JSR SCRAPONE
- LDA #0
- JMP TUNIN
- SHOTUP LDX PLAYER
- LDA SHOTY,X
- CMP #8 ;AT TOP?
- BCC JENDS
- SBC #8 ;SHOT NOT AT TOP -- MOVE UP
- STA SHOTY,X
- NOSHOT RTS
- STOPRES LDA SHTRSTAT,X ;TAKE OUT OF RES MODE
- AND #$EF
- STA SHTRSTAT,X
- JMP SHTRCLRS
- ******************************************
- * ADVANCE ALL OBJECT EXPLOSION ANIMATIONS
- ******************************************
- EXPLODE LDA FRMCNT
- AND #1
- BNE NOSHOT
- LDX #15
- EXPLLP LDY OBJOFFST,X
- CPY #L(POINT300)
- BCC EXPLNEXT ;EXPLOSION STAMP PUNT, TRY NEXT
- CPX #12
- BCC NRMLEXPL ;CENTIPEDE EXPLOSION
- BEQ SPIDEY ;SPIDER EXPLOSION
- CPX #13
- BEQ NRMLEXPL ;FLEA EXPLOSION
- ;ELSE SHOOTER EXPLOSION
- BIT FLAGS ;IF MUSHROOM RESTORATION, USE NORMAL
- BVS NRMLEXPL ; EXPLOSION
- LDA FRMCNT ;SHOOTER EXPLOSION IS SLOWED DOWN
- AND #$07
- BNE EXPLNEXT
- CPY #L(EXPLOS+4)
- BNE ZNRMLEXP
- LDA FLAGS ;SHOOTER EXPLOSION DONE, TURN ON
- ORA #$40 ; MUSHROOM RESTORATION
- STA FLAGS
- LDA #0 ;ROW, COLUMN OF FIRST MUSHROOM
- STA GTEMP5
- STA GTEMP6
- BEQ NOTHING ;ALWAYS
- ***********
- NRMLEXPL CPY #L(EXPLOS+4)
- BEQ NOTHING
- ZNRMLEXP INC OBJOFFST,X
- INC OBJOFFST,X
- BNE EXPLNEXT ;ALWAYS
- ***********
- SPIDEY DEC SPDRTIMR ;LEAVE SPIDER POINTS UP FOR A WHILE
- BNE EXPLNEXT
- LDY DIFLEVEL ;SET TIMER FOR REAPPEARANCE
- LDA SPDRWTDF,Y
- STA SPDRTIMR
- ***********
- NOTHING LDA #0
- STA OBJOFFST,X
- STA OBJSTAT,X
- EXPLNEXT DEX
- BPL EXPLLP
- RTS
- ;HSCSETUP FIRST DETERMINES IF THERE IS A HSC PLUGGED IN IF IT IS A ZERO IS
- ;RETUNED AND THE ARGUMENT BLOCK IS SETUP. IF THE CART IS NOT PRESENT, THE ZERO
- ;FLAG IS RESET. DURATION IS SET TO ZERO FOR HSCENTER. ANY OTHER VALUE MUST BE
- ;STORED AFTER CALLING HSCSETUP. ACTUAL SCORES MUST BE MOVED INTO THE SCORE BLOCK
- ;OUTSIDE THIS ROUTINE.
- ;FIRST CHECK FOR THE PRESENSE OF HIGH SCORE CART
- HSCSETUP
- LDA $3900 ;HSC THERE?
- CMP #$C6
- BNE NOHSC
- LDA $3904
- CMP #$FE
- BNE NOHSC
- TXA
- PHA
- LDA #$80
- STA ATTRACT
- LDX #14 ;LOAD FIXED HSC ARGS INTO DATA BLOCK
- HSLOADLP LDA HSCARGS,X ;this argument loading must come first
- STA HSDATA,X ;in setup, since some args are
- DEX ;variable and get reloaded
- BPL HSLOADLP
- LDA #$7F
- STA CTRL
- LDA #0
- LDX #5
- HSCOBJCL STA OBJSTAT+12,X
- DEX
- BPL HSCOBJCL
- LDA #5 ;SO THAT COLOR LOADING ROUTINE ONLY
- STA HSCFLAG ; DOES PAL.S 5,6
- JSR LOGOINIT ;LOGO BOTTOM
- LDA #1
- STA COLORFLG
- LDA #L(HSTOPDLI)
- STA VECTORI
- LDA #H(HSTOPDLI)
- STA VECTORI+1
- LDX GAMETYPE ;NO GAME TYPE DISPLAY IF IN A SINGLE
- LDA HSGMTYP,X ; PLAYER AT A TIME GAME
- BNE NOTYPDSP
- ;;;;; LDA #0
- STA DL16+1
- NOTYPDSP LDA DIFLEVEL
- ASL A
- ASL A
- ORA HSGMTYP,X
- ASL A
- ASL A
- STA GTEMP3
- PLA
- TAX
- ORA GTEMP3
- STA HSDATA+2 ;DIFFY PLAYNUM
- LDA #0 ;MAKE EQUAL ON RETURN
- ;MUST RETURN WITH INITIAL X RESTORED
- NOHSC RTS ; AND ZERO FLAG SET
- HSCNTR1 ;ENTER THE INITIALS FOR PLAYER1
- JSR HSCSETUP
- BNE RHS1
- TXA
- PHA
- JSR MAKCENTI ;CENTIPEDE FOR HSC LOGO
- PLA
- TAX
- LDA GAMETYPE
- BEQ DOSCREG ;ONE PLAYER GAME
- CMP #3
- BEQ TMSCREG ;TEAM
- CPX #0
- BNE DOSCREG
- STX HSDATA+$E ;NO WAIT AFTER FIRST PLAYER IN TWO PLR
- BEQ DOSCREG
- TMSCREG LDX #2 ;USE TEAM SCORE IN TEAM PLAY GAME
- DOSCREG LDA SCORE3,X
- STA SCOREBLK
- LDA SCORE2,X ;INITIALIZE SCORE INFO TO BE PASSED
- STA SCOREBLK+1
- LDA SCORE1,X
- STA SCOREBLK+2
- LDA SCORE0,X
- STA SCOREBLK+3
- LDY #H(HSDATA)
- JSR $3FFD ;HSCENTER
- HSCREC LDX #$7F ;RECOVER FROM HSC
- STX CTRL
- LDA #H(DLL)
- STA DPH
- LDA #L(DLL)
- STA DPL
- LDA #H(STMPBASE)
- STA CHARBASE
- LDA #L(MORPHO)
- STA VECTORI
- LDA #H(MORPHO)
- STA VECTORI+1
- JSR TURNON WAIT FOR TOP OF SCREEN AND TURN DMA ON
- LDX #0
- STX HSCFLAG
- INX
- STX COLORFLG
- RHS1 RTS
- HSATRACT LDA #11 ;LOOP FOR ALL GAME LEVELS
- STA HSATRGM
- JSR MAKCENTI
- LDA GAMETYPE
- PHA
- LDA DIFLEVEL
- PHA
- HSATRLP LDX HSATRGM
- LDA GAMETBL,X
- LSR A
- LSR A
- AND #$03
- TAY
- BEQ ZXABD
- INY
- ZXABD STY GAMETYPE ;GAMETYPE
- LDA GAMETBL,X
- LSR A
- LSR A
- LSR A
- LSR A
- STA DIFLEVEL ;DIFLEVEL
- LDX #0
- JSR HSCSETUP
- BNE ATRREC
- LDA #0
- STA HSDATA+$E
- LDY #H(HSDATA)
- JSR $3FF7 ;HSCSTAT
- LDX HSDATA+4
- CPX #5
- BCC ZNHSOK
- LDX #5
- ZNHSOK LDA HSTIME,X
- STA HSDATA+$E ;DURATION OF HSC
- LDA #L(STICKIT)
- STA HSDATA+4
- LDA #H(STICKIT)
- STA HSDATA+5
- LDY #H(HSDATA)
- JSR $3FFA ;HSCATRCT
- LDA PANEL
- LSR A
- BCC ATRLEAVE ;RESET SWITCH PRESSED
- LSR A
- BCC ATRREC ;SELECT SWITCH PRESSED
- LDA BUTNIB
- BPL ATRLEAVE
- JSR STICKIT0
- ;; LDA SCHTICK
- AND #$F0
- CMP #$F0
- BNE ATRREC
- DEC HSATRGM
- BPL HSATRLP
- ATRREC PLA
- STA DIFLEVEL
- PLA
- STA GAMETYPE
- JMP HSCREC
- ATRLEAVE LDA #$60
- STA DL16+1
- PLA
- STA DIFLEVEL
- PLA
- STA GAMETYPE
- JSR HSCREC
- LDA #$FF ;MAKE FLAG NEG
- NOSOUND RTS
- GAMETBL DB $38,$28,$18,$08,$34,$24,$14,$04,$30,$20,$10,$00
- HSTIME DB 0,9,6,5,4,3
- HSCARGS DB 1,1,0,2,L(STICKIT),H(STICKIT),0,0,L(SCOREBLK),H(SCOREBLK)
- DB L(HSCDLL),H(HSCDLL),L(NOSOUND),H(NOSOUND),9
- HSGMTYP DB 0,0,1,2
- HSTOPDLI
- TXA
- PHA
- TYA
- PHA
- CLD
- LDA #$40
- STA CTRL
- LDA #H(STMPBASE+$100)
- STA CHARBASE
- LDA #$80 ;GROUND CAPS
- STA VBLANK
- LDA #L(HSBTMDLI)
- LDY #H(HSBTMDLI)
- ENDHSDLI STA VECTORI
- STY VECTORI+1
- PLA
- TAY
- PLA
- TAX
- PLA
- RTI
- HSBTMDLI
- TXA
- PHA
- TYA
- PHA
- CLD
- LDA #0
- STA VBLANK ;UNGROUND CAPS
- STA WSYNC
- STA WSYNC
- LDA #$39
- STA CHARBASE
- LDA #$4B
- STA CTRL
- INC FRMCNT
- JSR LOADIT
- JSR MOVCENTI
- JSR TRACKIT
- LDA NUMSEG
- BNE HSLMST
- LDA #12
- CLC
- ADC CLRINDEX
- CMP #TOPCOLOR
- BNE HSNOCLR
- LDA #0
- HSNOCLR STA CLRINDEX
- LDA #1
- STA COLORFLG
- JSR MAKCENTI
- HSLMST JSR LMST STUPID NAME FOR COLOR LOAD ROUTINE
- LDA #L(HSTOPDLI)
- LDY #H(HSTOPDLI)
- JMP ENDHSDLI
- STICKIT
- CPX #0
- BEQ ZSTICK ;IF PLAYER 0 GO AHEAD
- LDX #1 ;ENSURE THAT IT'S PLAYER 1
- LDA ALTCTRLS ;SHARE TRACKBALL?
- BEQ ZSTICK ; NO
- ;YES
- STICKIT0 LDX #0
- ZSTICK LDY BUTNIB,X
- LDA TRACKF,X
- BNE DOMOVM ;DO TRACKBALL
- CPX #1
- BNE STIKI
- LDA ALTCTRLS
- CMP #$1
- BNE STIKI ;THE PLAYER WANTS TO SHARE TRACKBALL
- LDX #0 ;coerce track0 for two play alt
- DOMOVM LDA FRMCNT
- AND #$7
- BNE ROTSI
- LDA DELTAX,X
- BNE CALCIT
- LDA DELTAY,X
- BNE CALCIT
- LDA #$FF
- BMI DITTY ;NO MOVEMENT
- CALCIT LDA DELTAX,X
- BPL POSIT
- EOR #$FF
- CLC
- ADC #1
- POSIT STA TTEMP1
- LDA DELTAY,X
- BPL YSOT
- EOR #$FF
- CLC
- ADC #1
- YSOT STA TTEMP2
- CMP TTEMP1
- BCC EW
- NS LDA DELTAY,X ;SET FLAGS
- BPL SOU
- LDA #$EF
- DITTY STA SCHTICK
- RTS
- SOU
- LDA #$DF ;SOUTH JOYSTICK VALUE
- STA SCHTICK
- RTS
- EW LDA DELTAX,X
- BPL EAS
- LDA #$BF
- STA SCHTICK
- RTS
- EAS LDA #$7F
- STA SCHTICK
- RTS
- STIKI LDA #0
- STA CTLSWA
- LDA SWCHA ;joystick
- CPX #0
- BEQ ZSTIKI
- ASL A
- ASL A
- ASL A
- ASL A
- ZSTIKI STA SCHTICK
- RTS
- ROTSI LDA SCHTICK
- RTS
|