; D:TRC1C.ASM ; collision tests CLLTST PROC ;all collision tests LDA P0PF ;are from ship to playfield AND #%00000111 BEQ TP1 JSR P0COLN TP1 LDA P1PF AND #%00000111 BEQ TP2 JSR P1COLN TP2 LDA P2PF AND #%00000111 BEQ TP3 JSR P2COLN TP3 LDA P3PF AND #%00000111 BNE P3COLN RTS P3COLN PROC LDA CMVEN+3 ;skip if movement disabled BNE :EXIT LDX #3 STX CMVEN+3 ;disable movement STX CLLEN+3 ;enable collision processing STX HPOSP3 ;remove ship from screen STX PHPRG+3 LDA #11 ;set explosion smoke STA NWORK+3 ;ring parameters LDY #9 STY PWORK+3 LDA PLCOL+3 ;set coordinates STA HCOORD+3 ;for smoke ring LDA PLROW+3 STA VCOORD+3 LDA #143 STA SAUDC1+3 JSR SCRSCN ;compute & print score :EXIT RTS P1COLN PROC LDA CMVEN+1 BNE :EXIT LDX #1 STX CMVEN+1 STX CLLEN+1 STX HPOSP1 STX PHPRG+1 LDA #11 STA NWORK+1 LDY #9 STY PWORK+1 LDA PLCOL+1 STA HCOORD+1 LDA PLROW+1 STA VCOORD+1 LDA #143 STA SAUDC1+1 JSR SCRSCN :EXIT RTS P2COLN PROC LDA CMVEN+2 BNE :EXIT LDX #2 STX CMVEN+2 STX CLLEN+2 STX HPOSP2 STX PHPRG+2 LDA #11 STA NWORK+2 LDY #9 STY PWORK+2 LDA PLCOL+2 STA HCOORD+2 LDA PLROW+2 STA VCOORD+2 LDA #143 STA SAUDC1+2 JSR SCRSCN :EXIT RTS P0COLN PROC LDA MYBRK BEQ :EXIT LDA #0 STA AUDC2 STA MYBRK ;flag for end of play LDY #LOW VBSND ;kill VB movement LDX #HIGH VBSND ;leave vbsound operational LDA #7 JSR SETVBV LDX #1 STX CLLEN STX HPOSP0 LDA #11 STA NWORK LDA #9 STA PWORK LDA PLCOL STA HCOORD LDA PLROW STA VCOORD LDA #143 STA SAUDC1 JSR DCSHIP ;dec ship count :EXIT RTS CLLEN DB 0,0,0,0 PROCLL PROC LDX ALTCMS LDA CLLEN,X BEQ :EXIT BMI PROEXP ;process explosion only LDA PLCOL,X ;process eatline first STA COLGET LDA PLROW,X STA ROWGET LDA #3 STA LNBIT JSR EATLN PROEXP = * LDY ALTCMS LDA NWORK,Y BMI :EXIT ;skip explosion processing JSR EXPLOS RTS ;computer speed controlled from this delay rtn :EXIT = * LDY CSPED :LOOP2 LDX #12 :LOOP DEX BNE :LOOP DEY BNE :LOOP2 RTS CSPED DB 0 ;value of pixel in line to be eaten LNBIT DB 0 EATLN PROC LDY #11 JMP CLEAR :EXIT LDX ALTCMS ;holds current ship to be processed LDA COLGET ;save end of line STA PLCOL,X LDA ROWGET STA PLROW,X RTS CLEAR = * DEY BEQ :EXIT LDA #00 JSR MYPLOT INC COLGET JSR MYGET CMP LNBIT ; + 1 COL BEQ CLEAR DEC COLGET DEC COLGET JSR MYGET CMP LNBIT ; - 1 COL BEQ CLEAR INC COLGET DEC ROWGET JSR MYGET CMP LNBIT ; - 1 ROW BEQ CLEAR INC ROWGET INC ROWGET JSR MYGET CMP LNBIT ; + 1 ROW BEQ CLEAR LDX ALTCMS ;eat line finished LDA #$FF ;set collision enable for eatline done STA CLLEN,X XTSF RTS ;keeps length of cmptr plyrs line CPPTVA DS 8 ;scorcp adds to computer point value accumulator SCORCP PROC TXA ! ASL A ! TAY SED CLC LDA CPPTVA+1,Y ADC #1 STA CPPTVA+1,Y LDA CPPTVA,Y ADC #0 STA CPPTVA,Y CLD RTS PAUSE PROC TXA PHA LDA #3 LDX #00 JSR SETVBV LDA #1 STA CDTMF3 :WAIT LDA CDTMF3 BNE :WAIT PLA TAX RTS ; explosion routine ; same as two player procedure except a ; smaller diameter ring EXPTBL DB $1F,$3F,$5E,$7D,$9C,$BB,$C9,$D7,$E5,$F3,$F1 HCOORD DB 0,0,0,0 VCOORD DB 0,0,0,0 RINGCT DB 0 EXTEN DB 0 PLTVAL DB 0 SAUDC1 DB 0,0,0,0 NWORK DB 0,0,0,0 ;clear ring dia. PWORK DB 0,0,0,0 ;plot ring dia. EXPLOS PROC ;Y passes plyr index LDX #1 STX PLTVAL LDA PWORK,Y BMI FINNW STA EXTEN JSR RING TYA ! ASL A ! TAX CPX #4 BCS :SKIP ; < = CPX #1 BCS :OVER LDX #4 BPL :SKIP ;unconditional :OVER LDX #6 :SKIP LDA SAUDC1,Y ;process sound AND #%11101111 STA AUDC1,X FINNW TYA ! TAX DEC PWORK,X DEC NWORK,X DEC SAUDC1,X LDA NWORK,Y BPL NOTOUT TYA ! ASL A ! TAX CPX #4 BCS :SKIP2 CPX #1 BCS :OVER2 LDX #4 BPL :SKIP2 :OVER2 LDX #6 :SKIP2 LDA #0 STA AUDC1,X STA SAUDC1,Y RTS NOTOUT STA EXTEN LDA #0 STA PLTVAL JSR RING RTS ; routine to plot ring of explosion RING PROC ;Y holds plot tbl index LDX #11 :NEXT = * TXA ! PHA JSR SETRC JSR ADDH JSR SUBV LDA PLTVAL JSR MYPLOT JSR SUBH JSR ADDV LDA PLTVAL JSR MYPLOT JSR ADDH JSR ADDV LDA PLTVAL JSR MYPLOT JSR SUBH JSR SUBV LDA PLTVAL JSR MYPLOT PLA ! TAX DEX BPL :NEXT RTS ; routine to set horizontal and ; vertical registers VER DB 0 HOR DB 0 SETRC PROC LDA EXPTBL,X AND #$0F SEC SBC EXTEN BPL :OVER LDA #0 :OVER STA VER LDA EXPTBL,X LSR A ! LSR A ! LSR A ! LSR A SEC SBC EXTEN BPL :OVER2 LDA #0 :OVER2 STA HOR RTS ; add and sub routines to set col and ; row for plot rtn ADDH PROC LDA HOR CLC ADC HCOORD,Y CMP #158 BCC :OKRNG LDA #158 :OKRNG STA COLPUT RTS ADDV PROC LDA VER CLC ADC VCOORD,Y CMP #90 BCC :OKRNG LDA #90 :OKRNG STA ROWPUT RTS SUBH PROC LDA HCOORD,Y SEC SBC HOR BCS :TESTZ LDA #1 :TESTZ CMP #1 BCS :OKRNG LDA #1 :OKRNG STA COLPUT RTS SUBV PROC LDA VCOORD,Y SEC SBC VER BCS :TESTZ LDA #1 :TESTZ CMP #1 BCS :OKRNG LDA #1 :OKRNG STA ROWPUT RTS LINK D:TRC1D.ASM