diff --git a/crystalcastles/.DS_Store b/crystalcastles/.DS_Store new file mode 100644 index 0000000..7bf3623 Binary files /dev/null and b/crystalcastles/.DS_Store differ diff --git a/crystalcastles/CRYSTALCASTLES b/crystalcastles/CRYSTALCASTLES new file mode 100644 index 0000000..bf106d1 Binary files /dev/null and b/crystalcastles/CRYSTALCASTLES differ diff --git a/crystalcastles/CRYSTALCASTLES.S b/crystalcastles/CRYSTALCASTLES.S new file mode 100644 index 0000000..00818da --- /dev/null +++ b/crystalcastles/CRYSTALCASTLES.S @@ -0,0 +1,5113 @@ +* +* Crystal Castles +* by John Stouffer +* +* (c) 1983, Atari +* (s) 2024, Brutal Deluxe Software +* + + TYP BIN + ORG $000800 + MX %11 + LST OFF + +*----------------------------------- +* EQUATES +*----------------------------------- + +SOFTEV EQU $03F2 +PWREDUP EQU $03F4 +KBD EQU $C000 +KBDSTROBE EQU $C010 +SPKR EQU $C030 +TXTCLR EQU $C050 +TXTSET EQU $C051 +MIXCLR EQU $C052 +TXTPAGE1 EQU $C054 +HIRES EQU $C057 +BUTN0 EQU $C061 +BUTN1 EQU $C062 +PADDL0 EQU $C064 +PADDL1 EQU $C065 +PTRIG EQU $C070 +BASCALC EQU $FBC1 +HOME EQU $FC58 +WAIT EQU $FCA8 + +L0800 = $0800 +L0801 = L0800+$01 +L0808 = L0800+$08 +L0809 = L0800+$09 +L0810 = L0800+$10 +L0811 = L0800+$11 +L0820 = L0800+$20 +L0830 = L0800+$30 +L0838 = L0800+$38 +L0840 = L0800+$40 +L0848 = L0800+$48 +L0849 = L0800+$49 +L0850 = L0800+$50 +L0868 = L0800+$68 +L0869 = L0800+$69 +L0870 = L0800+$70 +L0871 = L0800+$71 +L0878 = L0800+$78 +L0880 = L0800+$80 +L08A0 = L0800+$A0 + +L6200 = $6200 +L6300 = L6200+$100 +L6400 = L6300+$100 +L6500 = L6400+$100 +L6600 = L6500+$100 +L6700 = L6600+$100 + +NBLIVES = 2 + +*----------------------------------- +* ZERO PAGE +*----------------------------------- + +nbPLAYER = 19 ; 0: one player, 1: two players +thePLAYER = 1A +theLASTGEM = 46 ; 0: player had the last gem, <>0: enemies had it +p1SCORE = 4A +p2SCORE = 4D +p1LIVES = 54 +p2LIVES = 55 +joyX = 60 +joyY = 61 +theLEVEL = 79 + +*----------------------------------- +* IT RELOCATES CODE AND DATA +*----------------------------------- + + LDY #$00 +]lp LDA $2000,Y + STA $9500,Y + LDA $2100,Y + STA $9600,Y + LDA $2200,Y + STA $9700,Y + LDA $2300,Y + STA $9900,Y + LDA $2400,Y + STA $9C00,Y + INY + BNE ]lp + +* Copy $2500..$2fff to $a500..$afff + + LDX #$0A +L0825 LDA $2500,Y +L0828 STA $A500,Y + INY + BNE L0825 + INC L0825+2 + INC L0828+2 + DEX + BNE L0825 + JMP L1F20 + + DS \ + +*----------------------------------- +* ENTRY POINT +*----------------------------------- + +L0900 JSR moveDATA ; move font + unrle data + LDA #$04 + STA $F0+1 + LDY #$00 + STY $F0 + LDA #$A0 +L090D STA ($F0),Y + INY + BNE L090D + INC $F0+1 + LDX $F0+1 + CPX #$08 + BNE L090D + LDA #L0927 + STA SOFTEV+1 + STA PWREDUP +L0927 LDA #$00 + STA $F6 + STA $F7 + STA $79 + STA $EC + STA $19 + BEQ L093D + + DB $02 + DB $BB + DB $5A + DB $30 + DB $5F + DB $EE + DB $05 + DB $A8 + +*----------------------------------- +* MAIN LOOP +*----------------------------------- + +L093D JSR LAE00 ; show title +L0940 LDA #$19 ; start game + STA L8000+$58 + LDA $F7 + STA $F6 + BEQ L0950 + LDA #$99 + STA L8000+$58 +L0950 LDA #$00 + STA $79 ; level + STA $4A ; score P1 + STA $4B + STA $4C + STA $4D ; score P2 + STA $4E + STA $4F + STA $1A + STA $F7 + LDA #NBLIVES + STA $54 ; nb lives P1 + STA $55 ; nb lives P2 + LDA #$FF + STA $58 +L096E LDA #$0F + STA $E2 + LDA #$A8 + STA $E3 + LDA $79 + BEQ L0985 + SEC + SBC #$01 + LSR + LSR + CMP $F7 + BCC L0985 + STA $F7 +L0985 LDY #$00 + STY L0800 + STY $D4 ; low level pointer + STY $F2 + STY $7A + STY $7B + STY $C4 + STY $C5 + STY $EC + STY $ED + STY $EE + STY $1F + LDX #$07 +L09A0 TYA + STA L0808,X + STA L0850,X + STA L0830,X + STA L0838,X + TXA + STA L0868,X + STA L0870,X + LDA #$C0 + STA L0848,X + DEX + BPL L09A0 + LDA #$02 + STA $15 + STY $14 + STY $59 + STY $13 + STY $D2 + STY L0848 + STY $CB + STY $23 + STY $25 + STY $67 + STY $7C + STY $16 + STY $5F + STY $7E + LDA #$80 + STA $7D + LDA #$70 + STA $FF + STA $E1 + LDA $58 + BNE L0A13 + LDA $19 + BEQ L0A13 + LDX $1A + LDA LAD6C,X + STA $F2+1 + LDY #$00 + LDA LAD6E,X + TAX +L09FA LDA L08A0,X + STA |$0070,Y + INX + INY + CPY #$10 + BNE L09FA + LDY #$00 +L0A08 LDA ($F2),Y + STA L6500,Y + INY + BNE L0A08 + JMP L0A6D + +L0A13 LDX $79 + LDA LAC78,X + STA $E6 + LDY #$07 + LDA #>L6880 + STA $F0+1 + LDA $E6 + ASL + ASL + ASL + ORA #L7D90 + STA $FE+1 + LDA #L7E60 + STA $E0+1 + JMP L0E8C +L0E51 RTS + +L0E52 ADC L7D30,X +L0E55 LDA $7B + BNE L0ECB + LDA #$01 + STA $7C + LDX $E6 + LDY L0EFC,X + LDA L0EEC,X + BEQ L0ECB + LDA L6600,Y + ORA #$80 + STA L6600,Y + LDA #$02 + STA $DA + LDA L6200,Y + AND #$01 + ASL + TAX + LDA L0E51,X + STA $FE + LDA L0E52,X + STA $FF + LDA #L7E00 + STA $E1 +L0E8C LDA L6200,Y + STA $F4 + LDA L6300,Y + CLC + ADC #$0B + STA $F5 + LDY #$00 + LDA #$0C + STA $E7 +L0E9F LDX $F5 + LDA L6000,X + CLC + ADC $F4 + STA $F0 + LDA L6100,X + EOR $ED + STA $F0+1 + LDA $DA + STA $E8 + LDX #$00 +L0EB6 LDA ($F0,X) + AND ($E0),Y + ORA ($FE),Y + STA ($F0,X) + INY + INC $F0 + DEC $E8 + BNE L0EB6 + INC $F5 + DEC $E7 + BNE L0E9F +L0ECB RTS + +L0ECC DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $01 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $01 +L0EDC DB $FF + DB $FF + DB $FF + DB $FF + DB $FF + DB $FF + DB $FF + DB $FF + DB $FF + DB $84 + DB $FF + DB $FF + DB $FF + DB $FF + DB $FF + DB $88 +L0EEC DB $00 + DB $01 + DB $00 + DB $01 + DB $01 + DB $00 + DB $01 + DB $01 + DB $01 + DB $01 + DB $01 + DB $01 + DB $01 + DB $01 + DB $01 + DB $01 + +L0EFC DB $5C + DB $00 + DB $88 + DB $90 + DB $88 + DB $BE + DB $7F + DB $69 + DB $E4 + DB $80 + DB $18 + DB $10 + DB $11 + DB $70 + DB $16 + DB $00 + +*----------------------------------- +* +*----------------------------------- + +L0F0C LDX $E6 + LDY L0EFC,X + STY $5B + LDA L6200,Y + STA $F4 + LDA L6300,Y + CLC + ADC #$0B + STA $F5 + LDX #$00 + LDA #$0C + STA $E7 + RTS + +*----------------------------------- +* +*----------------------------------- + +L0F27 LDY $F5 + LDA L6000,Y + STA $F0 + LDA L6100,Y + EOR $ED + STA $F0+1 + LDY $F4 + RTS + +*----------------------------------- +* +*----------------------------------- + +L0F38 INC $7B + JSR L0F0C + LDA L6600,Y + AND #$7F + STA L6600,Y +L0F45 LDY $56 + LDA LAD42,Y + ASL + ASL + STA $49 + JSR L0F27 + LDA $A400,X + STA ($F0),Y + INY + INX + LDA $A400,X + STA ($F0),Y + INX + INC $F5 + DEC $E7 + BNE L0F45 + RTS + +L0F65 LDA #$00 + STA $7B + STA $49 + JSR L0F0C + LDA #$00 + STA $7A +L0F72 JSR L0F27 + LDA ($F0),Y + STA $A400,X + INY + INX + LDA ($F0),Y + STA $A400,X + INX + INC $F5 + DEC $E7 + BNE L0F72 + RTS + +*----------------------------------- +* COPY HGR1 TO HGR2 +*----------------------------------- + +copyHGR1TOHGR2 + LDA #$20 + STA $FA+1 + ASL + STA $FC+1 + LDA #$00 + STA $FA + STA $FC +L0F96 LDY #$00 +L0F98 LDA ($FA),Y + STA ($FC),Y + INY + CPY #$78 + BNE L0F98 + TYA + ADC $FA + ADC #$07 + STA $FA + STA $FC + BNE L0F96 + INC $FC+1 + INC $FA+1 + LDA $FA+1 + AND #$1F + BNE L0F96 + RTS + +*----------------------------------- +* CLEAR AND SHOW HGR1 +*----------------------------------- + +clearHGR1 LDA TXTPAGE1 + LDA #$20 + STA $FA+1 + LDA #$00 + STA $FA + TAX +L0FC3 TXA + TAY +L0FC5 STA ($FA),Y + INY + CPY #$78 + BNE L0FC5 + TYA + ADC $FA + ADC #$07 + STA $FA + BNE L0FC3 + INC $FA+1 + LDA $FA+1 + AND #$1F + BNE L0FC3 + LDA TXTCLR + LDA MIXCLR + LDA HIRES + RTS + +*----------------------------------- +* +*----------------------------------- + +L0FE7 JSR L0E21 + LDA $7B + BNE L0FF4 + JSR L0F65 + JSR L0E55 +L0FF4 JSR copyHGR1TOHGR2 + LDY $79 + LDA LACE3,Y + STA $6E + CLC + ADC #$01 + ASL + STA $D6 + LDY $56 + LDA LAD38,Y + STA $1E + ASL + ASL + ADC LAD38,Y + ASL + STA $57 + INY + TYA + ASL + ASL + STA $CE + EOR #$FF + CLC + ADC #$01 + STA $CF + LDA $79 + BNE L102D + LDY $1A + LDA |$0054,Y + CMP #$02 + BEQ L1035 +L102D LDA $58 + BEQ L1046 + LDA $79 + BNE L1039 +L1035 LDA #$05 + BNE L1043 +L1039 AND #$03 + BNE L1041 + LDA #$02 + BNE L1043 +L1041 LDA #$06 +L1043 JSR playMUSIC +L1046 LDA #$00 + STA $58 + JMP L149B + +L104D LDA $C5 + STA $C6 +L1051 LDY $C6 + BMI L10C5 + LDX LACD3,Y + LDA $82,X + LDY $EC + CMP $84,X + BEQ L1064 + CMP $85,X + BNE L108E +L1064 LDY $C6 + LDA $87,X + CMP LACD8,Y + BNE L1070 + JSR L10C6 +L1070 DEC $87,X + BNE L1095 + LDY $C6 + LDA LACD8,Y + STA $87,X + LDY $81,X + LDA L6600,Y + AND #$F0 + STA L6600,Y + LDA $83,X + EOR #$FE + STA $83,X + JSR L1111 +L108E LDA $82,X + CLC + ADC $83,X + STA $82,X +L1095 LDY $81,X + LDA #$3F + STA L6500,Y + LDA $82,X + STA $F5 + SEC + SBC #$17 + STA L6300,Y + LDA #$71 + STA $FF + STA $E1 + DEC $C6 + LDA $86,X + STA $F4 + LDY $80,X + LDA LACBD,Y + STA $FE + LDA #$09 + STA $E7 + LDA $81,X + JSR L0D90 + JMP L1051 +L10C5 RTS + +L10C6 JSR L1111 + LDY $81,X + LDA $83,X + BPL L10F0 + LDA L6600,Y + AND #$F0 + ORA #$09 + STA L6600,Y + DEY + LDA L6600,Y + ORA #$04 + STA L6600,Y + TYA + SEC + SBC #$0F + TAY + LDA L6600,Y + ORA #$02 + STA L6600,Y + RTS + +L10F0 LDA L6600,Y + AND #$F0 + ORA #$06 + STA L6600,Y + INY + LDA L6600,Y + ORA #$08 + STA L6600,Y + TYA + CLC + ADC #$0F + TAY + LDA L6600,Y + ORA #$01 + STA L6600,Y + RTS + +L1111 LDY $81,X + DEY + LDA L6600,Y + AND #$FB + STA L6600,Y + INY + INY + LDA L6600,Y + AND #$F7 + STA L6600,Y + TYA + CLC + ADC #$0F + TAY + LDA L6600,Y + AND #$FE + STA L6600,Y + TYA + SEC + SBC #$20 + TAY + LDA L6600,Y + AND #$FD + STA L6600,Y + RTS + +L1141 LDY $6F + LDA L0800,Y + AND #$0F + STA $DA + LDA L0800,Y + LSR + LSR + LSR + LSR + STA $DB + LDX #$00 + LDA L0800 + AND #$0F + SEC + SBC $DA + STA $D8 + BEQ L1195 + BCC L1164 + INX +L1164 LDA L1206,X + CLC + ADC L0830,Y + STA L0830,Y + EOR $D8 + BMI L117C + LDA L1206,X + CLC + ADC L0830,Y + STA L0830,Y +L117C LDA L0830,Y + BPL L118C + CMP $CF + BCS L1195 + LDA $CF + STA L0830,Y + BNE L1195 +L118C CMP $CE + BCC L1195 + LDA $CE + STA L0830,Y +L1195 LDX #$00 + LDA L0800 + LSR + LSR + LSR + LSR + SEC + SBC $DB + STA $D9 + BEQ L11D9 + BCC L11A8 + INX +L11A8 LDA L1206,X + CLC + ADC L0838,Y + STA L0838,Y + EOR $D9 + BMI L11C0 + LDA L1206,X + CLC + ADC L0838,Y + STA L0838,Y +L11C0 LDA L0838,Y + BPL L11D0 + CMP $CF + BCS L11D9 + LDA $CF + STA L0838,Y + BNE L11D9 +L11D0 CMP $CE + BCC L11D9 + LDA $CE + STA L0838,Y +L11D9 LDA L0838,Y + STA $DB + LDX #$00 + LDA L0830,Y + BEQ L11EB + BPL L11E8 + INX +L11E8 LDA L1208,X +L11EB LDY $1F + STA |$0065,Y + TYA + EOR #$01 + TAY + LDX #$00 + LDA $DB + BEQ L1200 + BPL L11FD + INX +L11FD LDA L120A,X +L1200 STA |$0065,Y + JMP L1612 + +L1206 DB $01 + DB $FF +L1208 DB $88 + DB $95 +L120A DB $8B + DB $8A +L120C LDX $6F + LDA L0880,X + BEQ L1216 +L1213 JMP L1933 + +L1216 DEC L0868,X + BNE L1213 + LDY $56 + LDA LAD38,Y + STA L0868,X + LDY $6F + LDX L0840,Y + LDA L0808,Y + BEQ L1237 + INC $00 + LDY $00 + LDA $F000,Y + JMP L129B + +L1237 LDA L0800,Y + STA $DA + TAY + LDA L6600,Y + STA $DB + AND L12B1,X + BNE L1255 + LDA $DA + CLC + ADC L12BA,X + TAY + LDA L6400,Y + CMP #$02 + BCC L1273 +L1255 LDA $DB + AND L12B4,X + BEQ L1273 + LDA $DA + CLC + ADC L12B9,X + TAY + LDA L6600,Y + AND L12B1,X + BEQ L128D + LDA $DB + AND L12B2,X + BNE L1273 + DEX +L1273 INX + LDA $DB + AND L12B1,X + BNE L128D + LDA $DA + CLC + ADC L12BA,Y + TAY + LDA L6400,Y + CMP #$02 + BCS L128D + CPX #$07 + BNE L1273 +L128D DEX + TXA + INC $00 + LDY $00 + LDX $F000,Y + CPX #$10 + BCS L129B + TXA +L129B AND #$03 + LDY $6F + STA L0840,Y + TAX + LDA L12AD,X + STA $65 + STA $66 + JMP L163D + +L12AD DB $8B + DB $95 + DB $8A + DB $88 +L12B1 DB $08 +L12B2 DB $01 + DB $04 +L12B4 DB $02 + DB $08 + DB $01 + DB $04 + DB $02 +L12B9 DB $10 +L12BA DB $FF + DB $F0 + DB $01 + DB $10 + DB $FF + DB $F0 + DB $01 + +*----------------------------------- +* +*----------------------------------- + +L12C1 LDA $48 + BNE L1311 + LDA $5E + BNE L131E + LDA #$00 + STA $45 + LDA L0849 + CLC + ADC $5D + STA L0849 + BEQ L12DE + CMP #$F0 + BNE L12E7 + DEC $45 +L12DE LDY $56 + LDA LAD42,Y + STA $5E + BNE L1311 +L12E7 CMP #$08 + BEQ L1306 + CMP #$E8 + BNE L1311 + LDA $78 + BEQ L1300 + DEC $78 + LDX $E6 + LDA L0EFC,X + STA L0801 + JMP L1311 + +L1300 LDA L0800 + STA L0801 +L1306 LDY L0801 + LDA L6600,Y + AND #$7F + STA L6600,Y +L1311 LDY #$00 + LDX #$08 +L1315 DEY + BNE L1315 + DEX + BNE L1315 + JMP L1933 + +L131E DEC L0869 + BNE L1311 + LDY $56 + LDA LAD38,Y + STA L0869 + LDA $7E + BNE L133E + LDA L0849 + BEQ L133E + LDA $49 + BEQ L133E + STA $5E + LDA #$00 + STA $49 +L133E DEC $5E + BNE L1355 + LDA $5D + EOR #$F0 + STA $5D + BPL L1351 + LDY #$00 + STY L0809 + BEQ L1355 +L1351 LDY #$01 + STY $7E +L1355 LDY $6F + LDA L0800,Y + AND #$0F + STA $DA + LDA L0800,Y + LSR + LSR + LSR + LSR + STA $DB + LDX #$00 + LDA L0800 + AND #$0F + SEC + SBC $DA + BEQ L1379 + BCC L1376 + INX +L1376 LDA L1208,X +L1379 LDY $1F + STA |$0065,Y + TYA + EOR #$01 + TAY + LDX #$00 + LDA L0800 + LSR + LSR + LSR + LSR + SEC + SBC $DB + BEQ L1396 + BCC L1393 + INX +L1393 LDA L120A,X +L1396 STA |$0065,Y + JMP L1612 + +L139C LDA #$04 + STA $DB + LDX $6F + LDA $70,X + CMP #$07 + BNE L13BB + CPX $59 + BEQ L13FE + LDA $56 + CMP #$03 + BCC L13FE + LDA $CA + BNE L13FE + LDA $14 + STA L0848,X +L13BB LDA L0800,X + TAY + LDA L6600,Y + STA $DA + LDA L0830,X + BNE L13F8 + INC $00 + LDY $00 + LDA $F000,Y + AND #$03 + LDY $70,X + CLC + ADC L1405,Y + STA L0830,X + INC $00 + LDY $00 + LDA $F000,Y +L13E2 AND #$03 + TAY + LDA L140D,Y + STA L0840,X + LDA $DA + AND L1411,Y + BNE L13F8 + DEY + TYA + DEC $DB + BNE L13E2 +L13F8 DEC L0830,X + LDA L0840,X +L13FE STA $65 + STA $66 + JMP L1612 + +L1405 DB $00 + DB $00 + DB $00 + DB $00 + DB $01 + DB $01 + DB $02 + DB $02 +L140D DB $88 + DB $95 + DB $8A + DB $8B +L1411 DB $08 + DB $04 + DB $02 + DB $01 + +*----------------------------------- +* READ JOYSTICK +*----------------------------------- + +readJOYSTICK + LDX #$00 + STX $60 + STX $61 + LDA PTRIG +L141E LDA PADDL0 + BPL L1431 + STX $60 +L1425 LDA PADDL1 + BPL L1433 + STX $61 +L142C INX + BNE L141E + BEQ L1435 +L1431 BPL L1425 +L1433 BPL L142C +L1435 LDA #$FF + CMP $60 + BEQ L143F + CMP $61 + BNE L1446 +L143F LDA #$00 + STA $65 + STA $66 + RTS + +L1446 LDX #$95 + LDA $60 + SEC + SBC #$40 + BCS L1456 + LDX #$88 + EOR #$FF + CLC + ADC #$01 +L1456 LSR + LSR + LSR + CMP #$05 + BCS L1461 + LDX #$00 + LDA #$00 +L1461 STA $62 + STX $65 + LDX #$8A + LDA $61 + SEC + SBC #$40 + BCS L1475 + LDX #$8B + EOR #$FF + CLC + ADC #$01 +L1475 LSR + LSR + LSR + CMP #$05 + BCS L1480 + LDX #$00 + LDA #$00 +L1480 STX $66 + CMP $62 + BCC L1488 + STA $62 +L1488 LDA $62 + STA $64 + LDA #$00 + LDY BUTN1 + BMI L1498 + LDY BUTN0 + BPL L149A +L1498 LDA #$A0 +L149A RTS + +L149B LDA KBDSTROBE + LDA #$C3 + STA $CA + LDA #$FB + STA $48 + STA $DA + LDA $6E + STA $6F +L14AC LDX $6F + LDY L0800,X + LDA L6600,Y + AND #$7F + STA L6600,Y + LDA #$00 + STA L0808,X + STA L0830,X + STA L0838,X + STA L0880,X + STA L0878,X + LDA $CA + STA L0848,X + JSR L1729 + DEC $6F + BNE L14AC + LDA #$FC + STA L0800 + LDA #$08 + STA $5D + LDA #$FF + STA $45 + LDA #$F0 + STA L0849 + LDA $56 + LSR + TAY + LDA LACDD,Y + STA $78 + LDA #$00 + STA L0878 + STA $CB + STA L0848 + STA $47 + STA L0808 + JSR L9604 + LDY $56 + LDA LAD42,Y + LDY $E6 + LDX L0EEC,Y + BNE L1515 + STA $DC + ASL + ADC $DC + ASL +L1515 STA $5E +L1517 LDY $45 + LDA $C030,Y + LDA $6E + STA $6F +L1520 LDX $6F + CPX #$02 + BCC L1540 + LDY $70,X + CPY #$02 + BEQ L1540 + DEC L0868,X + BNE L1551 + CPY #$09 + BCC L1538 + JSR L1825 +L1538 LDY $56 + LDA LAD38,Y + STA L0868,X +L1540 LDA $70,X + ASL + TAX + LDA LAD08,X + STA $F0 + LDA LAD08+1,X + STA $F0+1 + JMP ($00F0) +L1551 JMP L1933 + +L1554 LDA $69 + CMP #$9B + BNE L155C + LDA #$00 +L155C STA $65 + STA $66 + LDA #$08 + STA $62 + STA $64 +L1566 LDA L0808 + BEQ L15A3 + LDX $79 + BEQ L1572 + JMP L1933 + +L1572 LDX $F6 + BNE L1579 + JMP L1933 + +L1579 LDA LAD22,X + STA $79 + LDA #$04 + LDY $1A + STA |$0054,Y + LDA L95FD,Y + TAY + LDA #$00 + STA |$004A,Y + STA |$004B,Y + LDA LAD2D,X + STA |$004C,Y + LDA #$09 + JSR playMUSIC + LDA #$01 + STA $58 + JMP L096E + +L15A3 LDX $79 + LDA L0800 + BNE L15BA + CPX #$00 + BNE L15B2 + LDX #$02 + BNE L1579 +L15B2 CPX #$12 + BNE L15CA + LDX #$06 + BNE L1579 +L15BA CMP #$22 + BNE L15CA + CPX #$08 + BNE L15CA + LDA $59 + BEQ L15CA + LDX #$04 + BNE L1579 +L15CA LDA $CB + BNE L15D2 + LDA #$04 + STA $CB +L15D2 LDA $65 + STA $CC + LDA $66 + STA $CD +L15DA JMP L1933 + +L15DD LDA $25 + BEQ L15DA + INC $00 + LDA L0848 + BEQ L15F3 + LDA $CC + STA $65 + LDA $CD + STA $66 + JMP L1612 + +*----------------------------------- +* +*----------------------------------- + +L15F3 LDA KBD + BMI L1602 + JSR readJOYSTICK + CMP #$A0 + BNE L1612 + JMP L1566 + +L1602 STA KBDSTROBE + CMP #" " + BNE L160C + JMP L1554 + +L160C STA $69 + STA $65 + STA $66 +L1612 LDX $67 + TXA + EOR #$01 + TAY + LDA $65,X + STA $2A + LDA |$0065,Y + BNE L1625 + STA $2A + LDA $65,X +L1625 LDY $6F + BNE L163D + LDY L0848 + BEQ L163D + INC $64 + LDY $64 + CPY #$07 + BCS L1639 + JMP L1933 + +L1639 LDY $62 + STY $64 +L163D LDX $47 + BMI L1678 + LDX $6F + LDY L0800,X + STY $D1 + LDY L0808,X + STY $2C + CMP #$88 ; LEFT ARROW + BEQ L1681 + CMP #$95 ; RIGHT ARROW + BEQ L169C + CMP #$8A ; DOWN ARROW + BEQ L16B4 + CMP #$8B ; UP ARROW + BEQ L16D1 + CMP #$DA ; Z + BEQ L16B4 + CMP #$C1 ; A + BEQ L16D1 + CMP #$91 ; CTRL-Q - restart level + BEQ L167B + CMP #$8F ; CTRL-O - restart game + BEQ L167E + CMP #$9B ; ESCAPE + BNE L1678 +L1671 JSR L9703 ; handle PAUSE + CMP #$9B + BNE L1671 +L1678 JMP L1933 +L167B JMP L0940 +L167E JMP L093D + +L1681 LDY #$02 + STY $EA + DEC $D1 + LDY L0808,X + BEQ L168F + JMP L1717 + +L168F LDY L0800,X + LDA L6600,Y + AND #$08 + BEQ L16EE + JMP L176A + +L169C LDY #$01 + STY $EA + INC $D1 + LDY L0808,X + BNE L1717 + LDY L0800,X + LDA L6600,Y + AND #$04 + BEQ L16EE + JMP L176A + +L16B4 LDY #$03 + STY $EA + LDA $D1 + CLC + ADC #$10 + STA $D1 + LDY L0808,X + BNE L1717 + LDY L0800,X + LDA L6600,Y + AND #$02 + BEQ L16EE + JMP L176A + +L16D1 LDY #$00 + STY $EA + LDA $D1 + SEC + SBC #$10 + STA $D1 + LDY L0808,X + BNE L1717 + LDY L0800,X + LDA L6600,Y + AND #$01 + BEQ L16EE + JMP L176A + +L16EE LDY $D1 + LDA L6400,Y + CMP #$02 + BCC L1709 + LDY L0800,X + LDA L6500,Y + AND #$3F + CMP $C7 + BNE L1709 + LDA #$01 + STA $2C + BNE L176A +L1709 LDA $2A + BEQ L1714 + LDY #$00 + STY $2A + JMP L1625 +L1714 JMP L1933 + +L1717 LDY $D1 + LDA L6400,Y + BMI L176A + BNE L1723 + JMP L1933 + +L1723 LDA #$00 + STA $2C + BEQ L176A +L1729 LDA $E6 + ASL + ASL + ASL + STA $F0 + LDA #>L6800 + STA $F0+1 + LDA $6F + TAY + ASL + TAX + LDA ($F0),Y + STA L0800,Y + BIT $DA + BMI L1748 + STA L0810,X + STA L0811,X +L1748 TAY + LDX $6F + CPX #$02 + BCC L175D + LDA $70,X + CMP #$0C + BEQ L175D + LDA L6600,Y + ORA #$80 + STA L6600,Y +L175D RTS + +L175E DEC $D6 + LDX #$00 + STX $DA + JSR L1729 + JMP L1986 + +L176A LDA $D6 + BNE L175E + LDA $CA + BEQ L1779 + LDX $6F + BEQ L1779 + JMP L1933 + +L1779 LDA $EA + LDX $6F + STA L0878,X + BEQ L1785 + JMP L1874 + +L1785 LDY $E6 + LDX $6E + LDA L0ECC,Y + BEQ L1798 + LDA $D1 + CMP L0EDC,Y + BNE L1798 + JMP L18C8 + +L1798 LDA L0EEC,Y + BEQ L17B5 + LDA $D1 + CMP L0EFC,Y + BNE L17B5 + LDA $7B + BNE L17B5 + LDA #$01 + STA $7B + SED + LDA #$10 + CLC + JSR L9562 + LDX #$01 +L17B5 LDA $D1 +L17B7 LDY L0808,X + CPY $2C + BNE L17D2 + LDY $70,X + CPY #$07 + BEQ L17CD + CPY #$09 + BCS L17D2 + LDY L0848,X + BNE L17D2 +L17CD CMP L0800,X + BEQ L17D8 +L17D2 DEX + BNE L17B7 + JMP L18F8 + +L17D8 LDA $70,X + CMP #$06 + BEQ L185D + CMP #$07 + BEQ L1835 + CMP #$09 + BCC L17E9 +L17E6 JMP L18F8 + +L17E9 LDY $59 + BNE L17E6 + LDY L0848,X + BNE L17E6 + CMP #$02 + BEQ L17F9 + JMP L18B8 + +L17F9 LDY L0800,X + LDA L6500,Y + AND #$40 + BNE L1808 + LDA L0880,X + BEQ L1820 +L1808 LDA L0848 + BNE L181D + LDA #$09 + STA $70,X + LDA #$30 + STA L0868,X + SED + LDA #$05 + CLC + JSR L9562 +L181D JMP L18F8 + +L1820 LDA #$02 + JMP L18C8 + +L1825 LDY L0800,X + LDA L6600,Y + AND #$7F + STA L6600,Y + LDA #$0C + STA $70,X + RTS + +L1835 JSR L183B + JMP L18F8 + +L183B LDA $48 + BNE L185C + LDA #$60 + STA $13 + STX $59 + LDA #$0D + STA L0848,X + LDY L0800,X + LDA L6600,Y + AND #$7F + STA L6600,Y + SED + LDA #$05 + CLC + JSR L9562 +L185C RTS + +L185D LDA $59 + BEQ L18C8 + LDA #$0B + STA $70,X + LDA #$30 + STA L0868,X + SED + LDA #$30 + CLC + JSR L9562 + JMP L18F8 + +L1874 LDA $47 + BEQ L187B + JMP L1933 + +L187B LDY $D1 + LDA L6600,Y + BPL L18A8 + LDY $E6 + LDA L0ECC,Y + BEQ L1890 + LDA $D1 + CMP L0EDC,Y + BEQ L18D8 +L1890 LDA $D1 + LDY $6E + INY +L1895 DEY + BEQ L18A8 + CMP L0800,Y + BNE L1895 + LDA L0808,Y + CMP $2C + BEQ L18D8 + LDA $D1 + BNE L1895 +L18A8 LDY $D1 + CPY L0800 + BNE L18F8 + LDA L0808 + CMP $2C + BNE L18F8 + LDA $70,X +L18B8 CMP #$07 + BNE L18BF + JMP L1835 + +L18BF LDY L0848,X + BNE L18F8 + CMP #$06 + BEQ L185D +L18C8 LDY $59 + BNE L18F8 + LDY L0848 + BNE L18E8 + LDA #$FF + STA $47 + JMP L18F8 + +L18D8 LDA $70,X + CMP #$02 + BNE L1933 + CLC + ADC L0840,X + STA L0840,X + JMP L1933 + + +L18E8 CMP #$03 + BEQ L18F0 + CMP #$02 + BNE L18F8 +L18F0 LDA $57 + STA L0868,X + JMP L18F8 + +L18F8 LDX $6F + LDA $2C + STA L0808,X + CPX #$00 + BNE L190B + LDA $D1 + STA L0800 + JMP L1933 + +L190B LDA $70,X + CMP #$0C + BEQ L1933 + CMP #$07 + BEQ L191A + LDA L0848,X + BNE L1933 +L191A LDY L0800,X + LDA L6600,Y + AND #$7F + STA L6600,Y + LDA $D1 + STA L0800,X + TAY + LDA L6600,Y + ORA #$80 + STA L6600,Y +L1933 LDA $D6 + BEQ L193A + JMP L175E + +L193A LDA $6F + ASL + CLC + ADC $EC + TAX + LDY L0810,X + LDA L6200,Y + STA $F4 + LDA L0820,X + STA $F5 + LDA L0820,X + STA $F5 + LDA LAD4C,X + STA $EE + LDA LAD5C,X + STA $EF + LDX #$17 + STX $E7 + LDX #$00 +L1963 LDY $F5 + LDA L6000,Y + STA $F0 + LDA L6100,Y + EOR $ED + STA $F0+1 + LDY $F4 + LDA ($EE,X) + STA ($F0),Y + INY + INC $EE + LDA ($EE,X) + STA ($F0),Y + INC $EE + INC $F5 + DEC $E7 + BNE L1963 +L1986 DEC $6F + BMI L198D + JMP L1520 + +L198D LDA $7B + BEQ L1998 + CMP #$03 + BCS L1998 + JSR L0F38 +L1998 LDA $6E + STA $6F + JSR L104D + LDX $59 + BEQ L19B8 + LDA L0800 + STA L0800,X + LDA L0848 + CLC + ADC #$0D + STA L0848,X + LDA L0808 + STA L0808,X +L19B8 LDX $6F + LDY L0800,X + TXA + ASL + CLC + ADC $EC + TAX + STA $DA + TYA + STA L0810,X + LDY $6F + BEQ L19D1 + LDA $48 + BMI L1A35 +L19D1 LDA L0850,Y + BEQ L19E6 + LDA #$00 + STA L0850,Y + LDA $DA + EOR #$01 + TAX + LDY L0810,X + JSR L1AC5 +L19E6 LDA |$0070,Y + CMP #$04 + BCS L1A35 + LDX $6F + LDA L0808,X + BNE L1A35 + LDA L0848,X + BNE L1A35 + LDX $DA + LDY L0810,X + LDA L6500,Y + AND #$40 + BEQ L1A35 + LDA #$01 + LDX $6F + STA L0850,X + LDA L6500,Y + AND #$BF + STA L6500,Y + JSR L1AC5 + LDA $6F + BNE L1A1E + JSR L9551 +L1A1E LDY $6F + LDA |$0070,Y + CMP #$02 + BNE L1A31 + LDA #$01 + STA L0868,Y + LDA #$05 + STA L0880,Y +L1A31 DEC $25 + BEQ L1A3F +L1A35 DEC $6F + BMI L1A3C + JMP L19B8 +L1A3C JMP L1B2B + +L1A3F LDA $6F + STA $46 + LDA #$05 + STA $48 + LDY $CA + BNE L1A4D + STA $CA +L1A4D JMP L1A35 + +*----------------------------------- +* WHO HAS THE LAST GEM? +*----------------------------------- + +L1A50 LDA $46 + BNE L1A60 + LDA #$1A ; YOU GOT THE LAST GEM + JSR printSTRING + JSR showBONUS + LDA #$00 + BEQ L1A67 + +L1A60 LDA #$19 ; THEY GOT THE LAST GEM + JSR printSTRING + LDA #$01 +L1A67 JSR playMUSIC + + INC $79 ; next level + LDA $79 + CMP #$25 ; 18x2 + 1 ? + BEQ L1A79 + LDA #$01 + STA $58 + JMP L096E + +L1A79 LDA TXTPAGE1 + JSR clearHGR1 + LDA #$18 ; I GIVE UP + JSR printSTRING + LDA #$3B + STA $F0 + STA $F2 + LDA #$22 + STA $F0+1 + EOR #$60 + STA $F2+1 + LDY $1A + LDX $54,Y + LDA L95F3,X + JSR printCHARACTER + LDX #$04 +L1A9E LDA L95F2 + JSR printCHARACTER + DEX + BNE L1A9E + LDY $1A + LDX L95FD,Y + SED + LDA |$0054,Y + SEC + ADC $4C,X + STA $4C,X + LDA #$FF + STA |$0054,Y + JSR L9589 + LDA #$08 + JSR playMUSIC + JMP L965B + +L1AC5 LDA L6500,Y + EOR #$FF + AND #$1F + STA $DB + LDA L6300,Y + CLC + ADC #$16 + TAX + LDA L6000,X + STA $F0 + LDA L6100,X + EOR $ED + STA $F0+1 + LDA L6000+1,X + STA $F2 + LDA L6100+1,X + EOR $ED + STA $F2+1 + LDA L6200,Y + TAY + INY + LDA #$FF + STA ($F0),Y + STA ($F2),Y + LDA $F0+1 + EOR #$60 + STA $F0+1 + LDA $F2+1 + EOR #$60 + STA $F2+1 + LDA #$FF + STA ($F0),Y + STA ($F2),Y + INC $00 + LDY $EC + BEQ L1B2A + LDA $DB + LDX $6F + BEQ L1B23 + LDX $01 + BNE L1B2A + STY $01 + LDX $00 + ADC $F000,X + AND #$1F +L1B23 STY $0F + LDY #$00 + JSR L6931 +L1B2A RTS + +L1B2B LDA $6E + STA $6F +L1B2F LDA #$63 + STA $D3 + LDA #$00 + STA $DA + LDX $6F + LDA L0808,X + BEQ L1B44 + INC $D3 + LDA $C7 + STA $DA +L1B44 LDA $6F + ASL + CLC + ADC $EC + TAX + LDA LAD4C,X + STA $EE + LDA LAD5C,X + STA $EF + LDY L0810,X + LDA L6200,Y + STA $F4 + LDA ($D2),Y + SEC + SBC $DA + LDY $6F + SBC L0848,Y + STA $DC + BCS L1B6F + LDA #$00 + STA $DC +L1B6F LDY $6F + LDA L0800,Y + TAY + LDA L6500,Y + CMP #$3F + BNE L1B82 + INC $DC + INC $DC + INC $DC +L1B82 LDA $DC + STA $F5 + STA L0820,X + LDX #$17 + STX $E7 + LDX #$00 +L1B8F LDY $F5 + LDA L6000,Y + STA $F0 + LDA L6100,Y + EOR $ED + STA $F0+1 + LDY $F4 + LDA ($F0),Y + STA ($EE,X) + INY + INC $EE + LDA ($F0),Y + STA ($EE,X) + INC $EE + INC $F5 + DEC $E7 + BNE L1B8F + DEC $6F + BMI L1BB9 + JMP L1B2F + +L1BB9 LDX #$00 +L1BBB LDY L0870,X + STY $DB + LDY L0871,X + STY $DA + LDA L0800,Y + LDY $DB + CMP L0800,Y + BCC L1BE7 + BNE L1BD6 + LDA |$0070,Y + BNE L1BE7 +L1BD6 LDA $DB + STA L0871,X + LDA $DA + STA L0870,X + DEX + BPL L1BBB + LDX #$01 + BNE L1BBB +L1BE7 INX + CPX $6E + BNE L1BBB + LDA $6E + STA $DF +L1BF0 LDX $DF + LDY L0870,X + STY $6F + LDA L0800,Y + STA $DC + CMP $5B + BCC L1C07 + LDA $7C + BNE L1C07 + JSR L0E55 +L1C07 LDA $DC + CMP $5A + BCC L1C14 + LDA $16 + BNE L1C14 + JSR L0E21 +L1C14 LDX $6F + LDY L0800,X + LDA L6700,Y + STA $5C + LDA L6200,Y + STA $F4 + LDA L0808,X + BEQ L1C2C + LDA #$00 + STA $5C +L1C2C LDA $6F + ASL + CLC + ADC $EC + TAY + LDA L0820,Y + STA $F5 + LDA $70,X + CMP #$09 + BCC L1C45 + CMP #$0C + BNE L1C72 + JMP L1CD4 + +L1C45 LDX $6F + LDY L0800,X + LDA L6200,Y + AND #$01 + STA $DC + LDA $70,X + ASL + ASL + CLC + ADC L0878,X + ASL + CLC + ADC $DC + ASL + TAY + LDA $9C00,Y + STA $FE + STA $E0 + LDA $9C01,Y + STA $FE+1 + CLC + ADC #$06 + STA $E0+1 + BNE L1C88 +L1C72 SEC + SBC #$09 + TAX + LDA $9C90,X + STA $FE + LDA $9C93,X + STA $FE+1 + LDA #L7F60 + STA $E0+1 +L1C88 LDX #$17 + STX $E7 + LDX #$00 +L1C8E LDY $F5 + LDA L6000,Y + STA $F0 + LDA L6100,Y + EOR $ED + STA $F0+1 + LDA #$02 + STA $E8 + LDY $F4 +L1CA2 LDA $5C + BNE L1CBB + LDA ($F0),Y + ORA ($FE,X) + STA ($F0),Y + INY + INC $FE + DEC $E8 + BNE L1CA2 + INC $F5 + DEC $E7 + BNE L1C8E + BEQ L1CD4 +L1CBB DEC $5C +L1CBD LDA ($F0),Y + AND ($E0,X) + ORA ($FE,X) + STA ($F0),Y + INY + INC $E0 + INC $FE + DEC $E8 + BNE L1CBD + INC $F5 + DEC $E7 + BNE L1C8E +L1CD4 LDX $6F + LDY $70,X + CPY #$02 + BNE L1D2B + LDA L0880,X + BEQ L1D2B + DEC L0868,X + BNE L1CF4 + LDY $56 + LDA LAD38,Y + LSR + STA L0868,X + DEC L0880,X + BEQ L1D2B +L1CF4 LDY L0880,X + LDA $F5 + SEC + SBC LAD70,Y + TAY + LDA L6000,Y + STA $F0 + LDA L6000+1,Y + STA $F2 + LDA L6100,Y + EOR $ED + STA $F0+1 + LDA L6100+1,Y + EOR $ED + STA $F2+1 + LDA $F4 + AND #$01 + TAY + LDA LAD75,Y + LDY $F4 + STA ($F0),Y + STA ($F2),Y + EOR #$7F + INY + STA ($F0),Y + STA ($F2),Y +L1D2B DEC $DF + BMI L1D32 + JMP L1BF0 + +L1D32 LDA $7C + BNE L1D39 + JSR L0E55 +L1D39 LDA $16 + BNE L1D40 + JSR L0E21 +L1D40 LDX $EC + STA $C054,X + LDA $ED + EOR #$60 + STA $ED + LDA $EC + EOR #$01 + STA $EC + LDA $67 + EOR #$01 + STA $67 + JSR L9589 + DEC $1E + BNE L1D6E + LDY $56 + LDA LAD38,Y + STA $1E + LSR + BCS L1D6E + LDA $1F + EOR #$01 + STA $1F +L1D6E LDX $47 + BMI L1DAD + LDX $6E + STX $6F +L1D76 LDY $59 + BNE L1DEF + LDY L0848 + BNE L1DEF + LDY L0800,X + CPY L0800 + BNE L1DD8 + LDY L0848,X + BNE L1DD8 + LDY L0808,X + CPY L0808 + BNE L1DD8 + LDY L0880,X + BNE L1DD8 + LDY $70,X + CPY #$09 + BCS L1DD8 + CPY #$07 + BNE L1DA9 + JSR L183B + JMP L1DD8 + +*----------------------------------- +* IS PLAYER DEAD? +*----------------------------------- + +L1DA9 LDA $47 + BNE L1DD5 +L1DAD LDA $25 + BEQ L1DD5 + + LDA #$07 ; player is dead + JSR playMUSIC + LDA #$01 + STA $47 + LDA #$00 + STA $CC + STA $CD + LDY $6E +L1DC2 LDA L6600,Y + AND #$7F + STA L6600,Y + DEY + BNE L1DC2 + LDX $1A + DEC $54,X ; NOP to get infinite lives (opcode is D6) + LDA #$05 + STA $CB +L1DD5 JMP L1DEF + +L1DD8 DEC $6F + BEQ L1DE0 + LDX $6F + BNE L1D76 +L1DE0 LDY $E6 + LDA L0ECC,Y + BEQ L1DEF + LDA L0EDC,Y + CMP L0800 + BEQ L1DA9 + +L1DEF LDA $CB + BEQ L1E5A + CLC + ADC L0848 + STA L0848 + BEQ L1E58 + CMP #$D0 + BCC L1E3C + LDA $19 + BNE L1E07 + JMP L149B + +L1E07 LDY $1A ; player index + LDA |$0054,Y ; is player alive? + BPL L1E11 ; yes + JMP L9635 ; no, player is dead + +L1E11 TYA + EOR #$01 + TAY + LDA |$0054,Y + BPL L1E1D + JMP L149B + +L1E1D JSR clearHGR1 + LDA #$1D ; GET READY + JSR printSTRING + LDA $1A + EOR #$01 + CLC + ADC #$1E ; PLAYER 1/2 + JSR printSTRING + JSR L96A0 + JSR L0AA5 + LDA #$00 + STA $58 + JMP L096E + +L1E3C CMP #$18 + BNE L1E44 + LDA #$FC + STA $CB +L1E44 LDX $47 + BNE L1E5A + SEC + LDA #$20 + STA $0F + SBC L0848 + LDY #$00 + JSR L6931 + JMP L1E5A + +L1E58 STA $CB +L1E5A LDA $CA + BNE L1E62 + STA $48 + BEQ L1E90 +L1E62 CMP #$CD + BNE L1E69 + JMP L1A50 + +L1E69 CLC + ADC $48 + STA $CA + LDX $6E +L1E70 LDA $CA + STA L0848,X + TXA + CLC + ADC #$02 + STA L0868,X + DEX + CPX #$01 + BNE L1E70 + LDA $48 + BMI L1E90 + BEQ L1E90 + CLC + ADC L0849 + BCS L1E90 + STA L0849 +L1E90 LDA $CA + BNE L1EAA + LDA $14 + CLC + ADC $15 + STA $14 + BEQ L1EA1 + CMP #$10 + BNE L1EAA +L1EA1 LDA $15 + EOR #$FF + CLC + ADC #$01 + STA $15 +L1EAA LDA $13 + BEQ L1ECF + LDA #$60 + SEC + SBC $13 + LSR + TAY + LDA L6AB4,Y + STA $0F + LDY #$00 + JSR L6931 + DEC $13 + BNE L1ECF + LDX $59 + BEQ L1ECF + LDA #$0C + STA $70,X + LDA #$00 + STA $59 +L1ECF LDA #$00 + STA $16 + STA $7C + LDA $7B + CMP #$01 + BNE L1EDE + JSR L0F38 +L1EDE LDA $56 + CMP #$08 + BNE L1F06 + LDA $7D + CMP #$FF + BEQ L1F06 + DEC $7D + BNE L1F06 + LDX $6E +L1EF0 LDA $70,X + CMP #$07 + BNE L1F03 + CPX $59 + BEQ L1F03 + LDA #$01 + STA $70,X + LDA #$00 + STA L0848,X +L1F03 DEX + BNE L1EF0 +L1F06 INC $00 + LDA $6E + STA $6F + JMP L1517 + + NOP + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + DB $00 + +*----------------------------------- +* INTERIM ENTRY POINT +*----------------------------------- + +L1F20 JSR showTITLE ; show title screen + JSR HOME + STA KBDSTROBE +L1F29 LDA KBD ; wait + BPL L1F29 + STA KBDSTROBE + BIT TXTSET + JMP L0900 ; to game + + DS \ + +*----------------------------------- +* SHOW BONUS +*----------------------------------- + + ORG $009500 + +showBONUS LDA #$40 + STA $F0 + STA $F2 + LDA #$22 + STA $F0+1 + EOR #$60 + STA $F2+1 + LDA $79 + CLC + ADC #$0A + STA $DB + LDX #$08 + LDA #$00 + STA $24 + SED +L951C ASL $DB + LDA $24 + ADC $24 + STA $24 + DEX + BNE L951C + CLD + LSR + LSR + LSR + LSR + TAX + LDA L95F2,X + JSR printCHARACTER + LDA $24 + AND #$0F + TAX + LDA L95F2,X + JSR printCHARACTER + LDA L95F2 + JSR printCHARACTER + LDA L95F2 + JSR printCHARACTER + SED + LDA $24 + CLC + JMP L9562 +L9551 LDY $1A + LDX L95FD,Y + SED + LDA $23 + CLC + ADC $4A,X + STA $4A,X + BCC L957E + LDA #$00 +L9562 LDY $1A + LDX L95FD,Y + ADC $4B,X + STA $4B,X + BCC L957E + LDA #$00 + ADC $4C,X + STA $4C,X + SEC +L9574 SBC #$07 + BMI L957E + BNE L9574 + LDA #$01 + STA $5F +L957E LDA $23 + CMP #$99 + BEQ L9589 + CLC + ADC #$01 + STA $23 +L9589 CLD + LDY $1A + LDX L95FD,Y + TXA + CLC + ADC #$02 + TAY + LDA #$00 + STA $2B + LDA L95FF,X + STA $F0 + STA $F2 + LDA L9600,X + STA $F0+1 + EOR #$60 + STA $F2+1 + LDA #$02 + STA $DC +L95AC LDA |$004A,Y + LSR + LSR + LSR + LSR + TAX + BNE L95BA + LDA $2B + BEQ L95C2 +L95BA INC $2B + LDA L95F2,X + JSR printCHARACTER +L95C2 LDA |$004A,Y + AND #$0F + TAX + BNE L95CE + LDA $2B + BEQ L95D6 +L95CE INC $2B + LDA L95F2,X + JSR printCHARACTER +L95D6 DEY + DEC $DC + BPL L95AC + LDA $5F + BNE L95E0 + RTS + +L95E0 LDA #$00 ; nb lives++ + STA $5F + LDX $1A + LDA $54,X + CMP #$06 + BCS L95F1 + INC $54,X + JSR L9604 +L95F1 RTS + +L95F2 DB $4F +L95F3 DB $31 + DB $32 + DB $33 + DB $34 + DB $35 + DB $36 + DB $37 + DB $38 + DB $39 + DB $4F +L95FD DB $00 ; index in score $4A..$4C / $4D..$4F + DB $03 +L95FF DB $82 +L9600 DB $20 + DB $00 + DB $02 + DB $21 + +L9604 LDA #$50 + STA $F0 + STA $F2 + LDA #$23 + STA $F0+1 + EOR #$60 + STA $F2+1 + LDX $1A + LDY $54,X + BMI L9635 ; dead? + CPY #$06 ; more than 6 lives + BCC L9620 ; make it 5 max + LDY #$05 + STY $54,X +L9620 DEY + BMI L962F + LDA #$23 + JSR printCHARACTER + INC $F0 + INC $F2 + JMP L9620 + +L962F LDA #$20 ; space + JSR printCHARACTER + RTS + +*----------------------------------- +* GAME OVER +*----------------------------------- + +L9635 PLA + PLA + LDA #$1C ; GAME OVER + JSR printSTRING + LDA $19 + BEQ L9648 + LDA $1A + CLC + ADC #$1E ; PLAYER 1/2 + JSR printSTRING +L9648 LDA #$04 + JSR playMUSIC + JSR L96A0 + CMP #$9B + BNE L965B +L9654 JSR L9703 + CMP #$9B + BNE L9654 +L965B LDA KBDSTROBE + LDA $19 + BEQ L9671 + LDA $1A + EOR #$01 + TAY + LDA |$0054,Y + BMI L9671 + STY $1A + JMP L096E + +L9671 LDA $79 + CMP #$09 + BCC L969D + LDA TXTPAGE1 + JSR clearHGR1 + LDA #$15 ; ? + JSR printSTRING + LDA $79 + CMP #$11 + BCC L9698 + LDA #$16 ; ? + JSR printSTRING + LDA $79 + CMP #$19 + BCC L9698 + LDA #$17 ; USE SECRET WARP + JSR printSTRING +L9698 LDX #$20 + JSR L96A2 +L969D JMP L093D + +L96A0 LDX #$08 +L96A2 LDY #$FF + STY $DB + STA KBDSTROBE +L96A9 LDA KBD + BMI L96B8 + DEY + BNE L96A9 + DEC $DB + BNE L96A9 + DEX + BNE L96A9 +L96B8 STA KBDSTROBE + RTS + +*----------------------------------- +* PRINT CHARACTER +*----------------------------------- +* The font is hidden in +* the HGR screen holes! + +printCHARACTER + STX $DA + STY $DB + SEC + SBC #$20 + LSR + BCS L96CC + LDY #$78 + STY $1B + BCC L96D1 +L96CC LDY #$F8 + STY $1B + CLC +L96D1 ADC #$20 + STA $1C + LDY #$00 + LDX #$00 +L96D9 LDA ($1B),Y + STA ($F0,X) + STA ($F2,X) + LDA #$04 + CLC + ADC $F0+1 + STA $F0+1 + EOR #$60 + STA $F2+1 + INY + CPY #$08 + BNE L96D9 + LDA $F0+1 + SEC + SBC #$20 + STA $F0+1 + EOR #$60 + STA $F2+1 + INC $F0 + INC $F2 + LDY $DB + LDX $DA + RTS + +L9703 LDA KBDSTROBE + LDA #$09 + STA $DA +L970A LDA #$60 + STA $DC +L970E LDX #$A5 + LDY #$E1 +L9712 LDA KBD + BMI L972E + DEX + BNE L9712 + DEY + BNE L9712 + DEC $DC + BNE L970E + DEC $DA + BNE L970A + LDA TXTPAGE1 + LDA TXTSET + JMP L9703 + +L972E STA KBDSTROBE + STA $DC + LDA $EC + EOR #$01 + TAX + LDA TXTCLR + LDA $C054,X + LDA $DC + RTS + +L9741 HEX 00000000000000000000000000000000 + HEX 00000000000000000000000000000000 + HEX 00000000000000000000000000000000 + HEX 00000000000000000000000000000000 + HEX 00000000000097970000000000000000 + HEX 00000000000000000000000000000000 + HEX 00000000000000000000000000000000 + HEX 00000000000000000000000000000000 + HEX 00000000000000000000000000000000 + HEX 00000000000000000000000000000000 + HEX 00000000000000000000000000000000 + HEX 000000000000000000000000000000 +L9800 HEX 5AF05AF05BE50FA50FA5A5AF05AF0550 + HEX FA50FA5AFA5AF05AF00FA50FA5AF0FA5 + HEX AF05AFFA50FA5AF050FA5AF05AA50FA5 + HEX AF05A503A9A3095CF656FC56F65CF656 + HEX FC03A9A309A303A903A9A3F656FC56FC + HEX 5CF65CF656A9A309A309A903A903A956 + HEX FC56FC56F65CF65CF6A305AF05AF4FA5 + HEX 0FA50FF056FC56FD43A903A903FC56FC + HEX 56FDF65CF65CF6A309A309A3A903A903 + HEX A956FC56FC565CF65CF656A9A309A309 + HEX 03A50FA5AFFA5AF05AF0FA50FA5AF00F + HEX A5AF05AFA50FA5AF0550FA5AF05A50FA + HEX 5AF05AA50FA5AF050FA5AF05AFFA50FA + HEX 5AF0FA5AF05AF00FA50FA5AFA5AF05AF + HEX 0550FA50FA5A5AF05AF05BE50FA50FA5 + HEX 5050505050505050D0D0D0D0D0D0D0D0 +L9900 HEX 0072307260729072C072007330736073 + HEX 9073C0739073C0739073C0739073C073 + HEX 00743074007430740074307400743074 + HEX 60749074607490746074907460749074 + HEX C0740075C0740075C0740075C0740075 + HEX 30756075307560753075607530756075 + HEX 90750076907500763076C0753076C075 + HEX 60769076607690766076907660769076 + HEX C0760077C0760077C0760077C0760077 + HEX C000307E7F7FCB4981428C508C498C42 + HEX 9050904990428750875052A3429A509A + HEX 499A42944C4953D443414CCC42855085 + HEX 498542555A5A4F46C600000000000000 + HEX 00000000000000000000000000000000 + HEX 00000000000000000000000000000000 + HEX 00A69CA69BA69A809A00000000000000 + + ORG $00A500 + +*----------------------------------- +* PRINT STRING +*----------------------------------- + +printSTRING ASL + TAY + LDA LA603,Y + STA $50 + LDA LA603+1,Y + STA $50+1 + CPY #$26 + BCC LA526 + LDY #$00 + LDA ($50),Y + STA $52 + INC $50 + BNE LA51C + INC $50+1 +LA51C LDA ($50),Y + INC $50 + BNE LA537 + INC $50+1 + BNE LA537 +LA526 CPY #$04 + BCC LA52C + LDY #$04 +LA52C LDA LA5E1,Y + STA $52 + INY + LDA LA5E1,Y + LDY #$00 +LA537 STA $53 + TAX + LDA L6100,X + STA $F0+1 + EOR #$60 + STA $F2+1 + LDA L6000,X + CLC + ADC $52 + STA $F0 + STA $F2 +LA54D LDA ($50),Y + INY + CMP #$28 + BEQ LA58D + CMP #$5B + BEQ LA572 + CMP #$21 + BEQ LA5A4 + CMP #$5D + BEQ LA595 + CMP #$29 + BEQ LA583 + CMP #$60 + BEQ LA57F + CMP #$7E + BEQ LA573 + JSR printCHARACTER + JMP LA54D +LA572 RTS + +LA573 LDA $F0 + CLC + ADC #$05 + STA $F0 + STA $F2 + JMP LA54D + +LA57F LDX #$19 + BNE LA585 +LA583 LDX #$0C +LA585 LDA #$20 + JSR printCHARACTER + DEX + BNE LA585 +LA58D LDA $53 + CLC + ADC #$08 + JMP LA537 + +LA595 LDX #$00 +LA597 LDA LA5E7,X + JSR printCHARACTER + INX + CPX #$10 + BNE LA597 + BEQ LA58D +LA5A4 LDX #$00 +LA5A6 LDA LA5F7,X + JSR printCHARACTER + INX + CPX #$0C + BNE LA5A6 + LDA #$A3 + STA $F0 + STA $F2 + LDA #$22 + STA $F0+1 + EOR #$60 + STA $F2+1 + LDA $79 + LSR + LSR + STA $56 + TAX + LDA L95F3,X + JSR printCHARACTER + LDA $56 + CMP #$09 + BNE LA572 + LDA $F0 + SEC + SBC #$02 + STA $F0 + STA $F2 + LDA #$31 + JSR printCHARACTER + RTS + +*----------------------------------- +* +*----------------------------------- + +LA5E1 HEX 0040 + HEX 1840 + HEX 1A48 +LA5E7 HEX 24242524252425242524252425242525 +LA5F7 ASC ' LEVEL ' +LA603 DA LA643 ; 0 UPPER LEFT FRAME + DA LA66F ; 1 UPPER RIGHT FRAME + DA LA696 ; 2 GET THE GEMS BENTLEY BER + DA LA6E8 ; 3 TREE WAVE + DA LA6F9 ; 4 DOOMSDOME + DA LA70A ; 5 BERTHILDAS CASTLE + DA LA727 ; 6 HIDDEN RAMP + DA LA738 ; 7 EXTRA LIVES EVERY 70000 + DA LA755 ; 8 CROSSROADS + DA LA766 ; 9 BERTHILDAS FORTRESS + DA LA783 ; 10 A NASTY TREE + DA LA794 ; 11 B HIDDEN SPIRAL + DA LA7B1 ; 12 C BERTHILDAS DUNGEON + DA LA7CE ; 13 D PYRAMID + DA LA7DF ; 14 E CROSS MAZE + DA LA7F0 ; 15 F BERTHILDAS PALACE + DA LA80D ; 16 10 IMPOSSIBLE STAIRCASE + DA LA82A ; 17 11 THE END + DA LA6B3 ; 18 12 ENTER TUNNEL AND PRESS... + DA LA83B ; 19 13 HINTS + DA LA8C4 ; 20 14 HINTS + DA LA972 ; 21 15 HINTS + DA LA9BA ; 22 16 HINTS + DA LAA11 ; 23 17 USE SECRET WARP + DA LAA5D ; 24 18 I GIVE UP + DA LAA9A ; 25 19 THEY GOT THE LAST GEM + DA LAAD4 ; 26 1A YOU GOT THE LAST GEM + DA LAB0E ; 27 1B (C) ATARI + DA LABDF ; 28 1C GAME OVER + DA LABFE ; 29 1D GET READY + DA LAC1D ; 30 1E PLAYER 1 + DA LAC3B ; 31 1F PLAYER 2 + +LA643 HEX 2427262726272627262528 + HEX 2424252425242524252528 + HEX 2424252425242524252528 + HEX 242627262726272627255B +LA66F HEX 2427262726272627262726272627262528 + HEX 5D5D5D5D5D + HEX 242627262726272627262726272627255B + +LA696 ASC 'GET THE GEMS()BENTLEY BEAR()!' +LA6B3 ASC 'ENTER TUNNEL(' + ASC 'AND PRESS (' + ASC 'JUMP BUTTON (' + ASC 'TO WARP TO (!' +LA6E8 ASC 'TREE WAVE ()))!' +LA6F9 ASC 'DOOMSDOME ()))!' +LA70A ASC 'BERTHILDAS (CASTLE ())!' +LA727 ASC 'HIDDEN RAMP ()))!' +LA738 ASC 'EXTRA LIVES (EVERY 7OOOO ())!' +LA755 ASC 'CROSSROADS ()))!' +LA766 ASC 'BERTHILDAS (FORTRESS ())!' +LA783 ASC 'NASTY TREE ()))!' +LA794 ASC 'HIDDEN (SPIRAL ())!' +LA7B1 ASC 'BERTHILDAS (DUNGEON ())!' +LA7CE ASC 'PYRAMID ()))!' +LA7DF ASC 'CROSS MAZE ()))!' +LA7F0 ASC 'BERTHILDAS (PALACE ())!' +LA80D ASC 'IMPOSSIBLE (STAIRCASE ())!' +LA82A ASC 'THE END ()))!' + +LA83B DB $00 + DB $40 + ASC '~~~ HINTS(((' + ASC '~ MAGIC HAT MAKES YOU INVINCIBLE((' + ASC '~ WEAR IT(~ AND YOU CAN KILL BERTHILDA((' + ASC ' CATCH GEM EATERS(' + ASC ' WHEN THEY ARE EATING([' +LA8C4 DB $00 + DB $98 + ASC ' STAY AWAY WHEN THEY ARE(' + ASC ' MOVING FROM GEM TO GEM((' + ASC '~ TAKE TOO MUCH TIME AND(' + ASC '~ THE SWARM RETURNS((' + ASC ' JUMP OVER TREES TO STUN THEM(((((' + ASC ' PRESS RETURN FOR OPTION SCREEN[' +LA972 DB $03 + DB $70 + ASC '~USE SECRET WARP NUMBER 1((' + ASC '~JUMP AT BACK CORNER OF(' + ASC '~~MAZE 1(' + ASC '~~LEVEL 1[' +LA9BA DB $03 + DB $A8 + ASC '~USE SECRET WARP NUMBER 2((' + ASC '~WEAR HAT AND(' + ASC '~JUMP AT BOTTOM OF HIDDEN RAMP(' + ASC '~~ON LEVEL 3[' +LAA11 DB $03 + DB $E0 + ASC '~USE SECRET WARP NUMBER 3((' + ASC '~JUMP AT BACK CORNER(' + ASC '~OF CROSSROADS ON LEVEL 5[' +LAA5D DB $00 + DB $80 + ASC '~I GIVE UP : YOU WIN((' + ASC '~YOU MUST BE VERY GOOD((' + ASC '~LIVES BONUS[' +LAA9A DB $08 + DB $88 + ASC '` THEY GOT THE LAST GEM (' + ASC '` NO BONUS (`[' +LAAD4 DB $08 + DB $88 + ASC '` YOU GOT THE LAST GEM (' + ASC '` BONUS (`[' +LAB0E DB $05 + DB $48 + ASC '~ATARISOFT PRESENTS(((' + ASC '~ CRYSTAL CASTLES((((' + ASC 'PRESS 1 FOR ONE PLAYER((' + ASC 'PRESS 2 FOR TWO PLAYER((' + ASC 'PRESS SPACE BAR TO START((' + ASC 'PRESS RETURN FOR HINT SCREEN((' + ASC '~~PLAYERS(((((' + ASC '~COPYRIGHT 1983 ATARI(~' + ASC 'ALL RIGHTS RESERVED[' +LABDF DB $08 + DB $88 + ASC '` GAME OVER (`[' +LABFE DB $08 + DB $88 + ASC '` GET READY (`[' +LAC1D DB $08 + DB $A0 + ASC ' PLAYER 1 (`[' +LAC3B DB $08 + DB $A0 + ASC ' PLAYER 2 (`[' + + ASC 'WRITTEN BY JOHN STOUFFER 6/1/84' + +*--- Index in levels + +LAC78 HEX 00010203040506070408090A0B0C040D + HEX 050806030C01010D050B090A050C0407 + HEX 0E08090A0F + +LAC9D DFB >L8000 ; Level data high pointer + DFB >L8100 + DFB >L8200 + DFB >L8300 + DFB >L8400 + DFB >L8500 + DFB >L8600 + DFB >L8700 + DFB >L8800 + DFB >L8900 + DFB >L8A00 + DFB >L8B00 + DFB >L8C00 + DFB >L8D00 + DFB >L8E00 + DFB >L8F00 + +LACAD DB $AA + DB $A5 + DB $85 + DB $D0 + DB $AA + DB $AA + DB $D5 + DB $D2 + DB $8A + DB $A8 + DB $D5 + DB $D5 +LACB9 DB $00 + DB $20 +LACBB DB $80 + DB $40 +LACBD DB $40 + DB $A0 + DB $60 + DB $60 + DB $C0 + DB $40 + DB $80 + DB $E0 + DB $60 + DB $A0 +LACC7 DB $7A + DB $57 + DB $75 + DB $2F +LACCB DB $FF + DB $01 + DB $10 + DB $F0 +LACCF DB $08 + DB $04 + DB $02 + DB $01 +LACD3 DB $00 + DB $08 + DB $10 + DB $18 + DB $20 +LACD8 DB $0A + DB $0C + DB $0E + DB $10 + DB $12 +LACDD DB $0A + DB $08 + DB $06 + DB $06 + DB $06 + DB $06 +LACE3 HEX 07050705060606060607070707070707 + HEX 07070707070707070707070707070707 + HEX 0707070707 + +LAD08 DA L15DD + DA L1141 + DA L120C + DA L1355 + DA L139C + DA L139C + DA L139C + DA L139C + DA L12C1 + DA L1933 + DA L1933 + DA L1933 + DA L1311 +LAD22 HEX 0004080C1014181C1C1C1C +LAD2D HEX 0007142128354249494949 +LAD38 HEX 09070504040303020202 +LAD42 HEX 07080C0F0F14141E1E1E +LAD4C HEX 004080C0004080C0004080C0004080C0 +LAD5C HEX A0A0A0A0A1A1A1A1A2A2A2A2A3A3A3A3 +LAD6C HEX 9D9E +LAD6E HEX 0020 +LAD70 HEX 000E0B0805 +LAD75 HEX 552A + + HEX ADD3B5ACD4B52089AD38B0D120FBAF4C + HEX 7FB33820DDB2A900A2059DF0B5CA10FA + HEX 6020DCABA9FFADADB520F7AFA9168D9D + HEX B3202FAE202FAEA20CBDAEB320C59FCA + HEX D0F78646ADF6B785442042AE20DFBC20 + HEX 2FAE182011B0B05DA2008E9CB3BDC6B4 + HEX F053304AA0A0BDC8B41002A0AA9820ED + HEX FDBDC8B4297FA0070A0AB00388D0FAB9 + HEX A7B320EDFDA9A020ED + +*----------------------------------- +* SHOW TITLE PAGE AND OPTIONS +*----------------------------------- + +LAE00 JSR clearHGR1 + LDA #$1B ; show (c) string + JSR printSTRING + JSR LAE53 + JSR copyHGR1TOHGR2 +LAE0E JSR showNBPLAYERS + JSR L9703 + STA TXTPAGE1 + CMP #"1" + BNE LAE22 + LDA #$00 + STA $19 + JMP LAE0E + +LAE22 CMP #"2" + BNE LAE2D + LDA #$01 + STA $19 + JMP LAE0E + +LAE2D CMP #$8D ; return to show hints + BEQ LAE36 + CMP #" " ; space to play + BNE LAE0E + RTS + +*----------------------------------- +* SHOW HINTS +*----------------------------------- + +LAE36 JSR clearHGR1 + LDA #$13 ; HINTS 1 + JSR printSTRING + LDA #$14 ; HINTS 2 + JSR printSTRING + JSR LAE53 ; show sprites + JSR copyHGR1TOHGR2 +LAE49 JSR L9703 + CMP #$8D + BNE LAE49 + JMP LAE00 + +LAE53 LDA #$00 ; index is 0 + STA $DB +LAE57 LDY $DB + LDA LAEB7,Y + STA $F4 ; get x + LDA LAEC1,Y + STA $F5 ; get y + LDA LAECB,Y + CMP #$FF ; end of data? + BEQ LAE7E ; yes + INC $DB ; next counter + ASL + TAY + LDA LAED6,Y + STA $FE ; get sprite data pointer + LDA LAED6+1,Y + STA $FE+1 + JSR LAE8F ; output sprite + JMP LAE57 ; loop + +LAE7E LDA #$55 ; fixes display + STA $28C6 + STA $2CC6 + LDA #$2A + STA $28C7 + STA $2CC7 + RTS + +LAE8F LDX #$00 ; output sprite + LDA #$17 + STA $E7 +LAE95 LDY $F5 ; two cols wide + LDA L6000,Y + STA $F0 + LDA L6100,Y + STA $F0+1 + LDY $F4 + LDA ($FE,X) + STA ($F0),Y + INY + INC $FE + LDA ($FE,X) + STA ($F0),Y + INC $FE + INC $F5 + DEC $E7 + BNE LAE95 + RTS + +LAEB7 DB $00 ; X + DB $02 + DB $24 + DB $1E + DB $21 + DB $00 + DB $08 + DB $10 + DB $18 + DB $20 +LAEC1 DB $44 ; Y + DB $5C + DB $64 + DB $7E + DB $96 + DB $AC + DB $CF + DB $CF + DB $CF + DB $CF +LAECB DB $00 ; sprite index + DB $01 + DB $02 + DB $03 + DB $04 + DB $05 + DB $06 + DB $06 + DB $06 + DB $06 + DB $FF +LAED6 DA L7660 ; sprite data + DA L7200 + DA L7590 + DA L7400 + DA L7430 + DA L76C0 + DA L7460 + +*----------------------------------- +* SHOW NB PLAYERS +*----------------------------------- + +showNBPLAYERS + LDA #$68 + STA $F0 + STA $F2 + LDA #$20 + STA $F0+1 + EOR #$60 + STA $F2+1 + LDY $19 + LDA L95F3,Y + JSR printCHARACTER + RTS + + DB $EC + DS \ ; $AE00 + DS $100 ; $AF00 +LB000 DS $1000 ; $B000 + +*----------------------------------- +* TITLE PICTURE +*----------------------------------- + + ORG $004000 + PUT TITLE.S + +*----------------------------------- +* +*----------------------------------- + +L6000 HEX 00000000000000000000000000000000 + HEX 00000000000000000000000000000000 + HEX 00000000000000000000000000000000 + HEX 00000000000000000000000000000000 + HEX 00000000000000008080808080808080 + HEX 00000000000000008080808080808080 + HEX 00000000000000008080808080808080 + HEX 00000000000000008080808080808080 + HEX 2828282828282828A8A8A8A8A8A8A8A8 + HEX 2828282828282828A8A8A8A8A8A8A8A8 + HEX 2828282828282828A8A8A8A8A8A8A8A8 + HEX 2828282828282828A8A8A8A8A8A8A8A8 + HEX 5050505050505050D0D0D0D0D0D0D0D0 + HEX 5050505050505050D0D0D0D0D0D0D0D0 + HEX 5050505050505050D0D0D0D0D0D0D0D0 + HEX 5050505050505050D0D0D0D0D0D0D0D0 +L6100 HEX FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + HEX FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + HEX FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + HEX FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + HEX 2024282C3034383C2024282C3034383C + HEX 2125292D3135393D2125292D3135393D + HEX 22262A2E32363A3E22262A2E32363A3E + HEX 23272B2F33373B3F23272B2F33373B3F + HEX 2024282C3034383C2024282C3034383C + HEX 2125292D3135393D2125292D3135393D + HEX 22262A2E32363A3E22262A2E32363A3E + HEX 23272B2F33373B3F23272B2F33373B3F + HEX 2024282C3034383C2024282C3034383C + HEX 2125292D3135393D2125292D3135393D + HEX 22262A2E32363A3E22262A2E32363A3E + HEX 23272B2F33373B3F23272B2F33373B3F + +*----------------------------------- +* MOVE FONT AND UNPACK +*----------------------------------- + +moveDATA LDA #$78 ; move font to the HGR screen holes + STA $FA + LDA #$20 + STA $FA+1 + LDA #>L63F9 + STA $F0+1 + LDA #L628C + STA $F0+1 + LDA #LB000 + STA $F2+1 + + LDY #$00 +L6245 LDA ($F0),Y + BEQ L6256 ; 0 outputs source++ #$00 bytes + BMI L626C ; FF outputs source++ #$FF bytes + STA ($F2),Y ; simple output + JSR L627E ; source++ + JSR L6285 ; dest++ + JMP L6245 + +L6256 JSR L627E ; source++ + LDA ($F0),Y ; get counter + JSR L627E ; source++ + TAX + LDA #$00 ; output counter #$00 +L6261 STA ($F2),Y + JSR L6285 ; dest++ + DEX + BNE L6261 + JMP L6245 ; loop + +L626C CMP #$80 ; exit if $80 + BNE L6271 + RTS + +L6271 JSR L627E ; source++ + LDA ($F0),Y ; get counter + JSR L627E ; source++ + TAX + LDA #$FF ; output counter #$FF + BMI L6261 + +L627E INC $F0 ; source++ + BNE L6284 + INC $F0+1 +L6284 RTS + +L6285 INC $F2 ; dest++ + BNE L628B + INC $F2+1 +L628B RTS + +*----------------------------------- +* SOMETHING IN RLE +*----------------------------------- + +L628C HEX 000FFF010001FF0F0001FF0F0001FF0F + HEX 0001FF0F0001FF0F0001FF0F0001FF0F + HEX 0001FF0F0001FF0F0001FF0F0001FF0F + HEX 0001FF0F0001FF2FFFFFFF01000BFF05 + HEX 000CFF04000CFF04000CFF040001FF0F + HEX 0001FF0F0001FF0F0001FF0F0001FF0F + HEX 0001FF6FFFFFFF01FF22000405080E0E + HEX 13FF070001FF0F03FF0F06FF0F08FF0F + HEX 0DFF011010FF0C13FF0F13FF6DFFFFFF + HEX 01FFFFFF01FF090003FF0D0003FF0D00 + HEX 04FF0C0001FF0F0001FF4E0CFF0F0CFF + HEX 0F0CFF47FFFFFF01FF610006090C1012 + HEX FF06000AFF8500060909090909090909 + HEX FF020001FF0F0001FF0F0001FF0F0001 + HEX FFBFFF8000030608FF0B06FF0F08FF0F + HEX 0CFF0F11FF0F11FF2F0004FF0C0001FF + HEX 0F0001FF270CFFB70F0D0B080002FF0A + HEX 0C0A08070002FF0A0907040003FF0A07 + HEX 0005FF0A0006FF0A0006FFAAFF1E10FF + HEX 0F13FF0F13FF0111FF0F0CFF0F06FF0F + HEX 03FF0F0001FF0F0001FF0F0001FF0F00 + HEX 01FF4FFF79110E0B070003FF1713FF0F + HEX 12FF0F0FFF0F0AFF0F04FF2880 + +*----------------------------------- +* FONT DATA +*----------------------------------- + +L63F9 HEX 00000000000000001818181818001800 + HEX 000000000000000000E39CEBFFBE0000 + HEX D5D5D5D5D5D5D5D5AAAAAAAAAAAAAAAA + HEX D5D5D5D5AAAAAAAAAAAAAAAAD5D5D5D5 + HEX 180C0606060C18001830606060301800 + HEX 187E3C183C7E18000018187E18180000 + HEX 00000000001C180C0000007E00000000 + HEX 0000000000000000006030180C060000 + HEX 1C36666666361C00181C181818183C00 + HEX 3C6660300C067E007E30303860663C00 + HEX 30383C367E3030007E023E6060663C00 + HEX 380C063E66663C007E303018180C0C00 + HEX 3C66663C66663C003C66667C30301C00 + HEX 000C0C00000C0C00001C1C00001C180C + HEX 30180C060C18300000007E007E000000 + HEX 0C18306030180C003C66301818001800 + HEX 3C46565636063C00183C66667E666600 + HEX 3E66663E66663E003C66060606663C00 + HEX 3E66666666663E007E06063E06067E00 + HEX 7E06063E060606007C06060676667C00 + HEX 6666667E666666003C18181818183C00 + HEX 6060606060663C0066361E0E1E366600 + HEX 0606060606067E00667E7E6666666600 + HEX 62666E7E766646003C66666666663C00 + HEX 3E66663E060606003C6666666E366C00 + HEX 3E66663E1E3666003C66063C60663C00 + HEX 7E181818181818006666666666663C00 + HEX 666666663C181800666666667E7E6600 + HEX 66363C183C36660066663C1818181800 + HEX 7E3030180C067E007E0E0E0E0E0E7E00 + HEX 00060C18306000003E30303030303E00 + HEX 0000183C660000000000000000000000 + HEX 000000000000000000003C607C667C00 + HEX 06067C6666667C0000007C0606067C00 + HEX 60607C6666667C0000003C667E067C00 + HEX 386C0C3E0C0C0C0000003C66667C603C + HEX 06063E666666660018001C1818183C00 + HEX 300038303030361C060666361E366600 + HEX 1C18181818183C000000667E7E666600 + HEX 00003E666666660000003C6666663C00 + HEX 00003E66663E060600007C66667C6060 + HEX 00007E0E0606060000007C063C603E00 + HEX 0C0C3E0C0C6C38000000666666766C00 + HEX 000066363C1C1800000066667E7E6600 + HEX 0000663C183C6600000066363C1C180E + HEX 00007E30180C7E00380C0C060C0C3800 + HEX 00000000000000000E18183018180E00 + HEX 2C1A0000000000000000000000000000 + HEX 00000000000000 + +*----------------------------------- +* SHOW THE ANIMATED TITLE SCREEN +*----------------------------------- + +showTITLE JSR L67CA + LDA #$20 + STA $E6 + LDA #$FF + STA $1C + JSR $F3F6 + BIT TXTPAGE1 + BIT MIXCLR + BIT HIRES + BIT TXTCLR + LDX #$00 + STX $51 + STX $52 + LDX #$03 + STX $50 + LDX #$18 + STX $53 +L6728 DEC $53 + BMI L6754 + LDA $53 + JSR BASCALC + LDY #$27 +L6733 LDX $51 + LDA L9900,X + LDX $50 +L673A DEX + BMI L6741 + LSR + LSR + BNE L673A +L6741 AND #$03 + DEC $50 + BPL L674D + LDX #$03 + STX $50 + INC $51 +L674D STA ($28),Y + DEY + BPL L6733 + BMI L6728 +L6754 LDA #$01 + STA $54 +L6758 LDA #$00 + STA $55 +L675C LDA $55 + ASL + ASL + ASL + STA $56 + LDX #$0F +L6765 STX $50 + JSR L67DC + LDX $50 + LDA $27 + STA $60,X + CLC + ADC #$20 + STA $70,X + DEX + LDA $26 + STA $60,X + STA $70,X + INC $56 + DEX + BPL L6765 + LDA $55 + JSR BASCALC + LDY #$27 +L6788 LDA ($28),Y + CMP $54 + BNE L67AA +L678E LDA ($70),Y +L6790 STA ($60),Y + INC L6790+1 + INC L6790+1 + INC L678E+1 + INC L678E+1 + BPL L678E + LDA #$60 + STA L6790+1 + LDA #$70 + STA L678E+1 +L67AA DEY + BPL L6788 + JSR L67E5 + INC $55 + LDY $55 + CPY #$18 + BNE L675C + INC $54 + LDA $54 + CMP #$01 + BEQ L67CA + CMP #$04 + BNE L6758 + LDA #$00 + STA $54 + BEQ L6758 + +L67CA LDX #$2F +L67CC LDA $50,X + PHA + LDA $02D0,X + STA $50,X + PLA + STA $02D0,X + DEX + BPL L67CC + RTS + +L67DC LDX #$00 + LDY #$00 + LDA $56 + JMP $F411 + +L67E5 LDX #$30 +L67E7 LDY #$01 + BIT SPKR +L67EC DEY + BNE L67EC + DEX + BNE L67E7 + LDA #$08 + JMP WAIT + + DB $41 + DB $01 + DB $2C + DB $30 + DB $C0 + DB $88 + DB $D0 + DB $FD + DB $CA + +L6800 HEX FC5C3F4F5F000000FC00020406080A0C + HEX FC882F3F5F880F00FC90FFEF1F6FDFCF + HEX FC88CFBF9F8FDFAFFCBE6F7F8FF0F2CC + HEX FC7F1F2F3F4F5F01FC69AFCFDF0CBF9F + HEX FCE45F4F3F2F1F0FFC800F1FF1119167 + HEX FC163F2F0F11211FFC107F6F5F4F3F2F + HEX FC117F6F5F4F003FFC8000102030FF46 + HEX FC167F6F5F4F3F2FFC007F6F880076F1 +L6880 HEX 00080101010C0C0C0008030303030303 + HEX 000802020205070C0008020206070202 + HEX 00080202070302030008020202020702 + HEX 00080207020202030008020107060103 + HEX 00080202020307020008020201040702 + HEX 00080202010607070008020202030702 + HEX 00080202020307020008020206040703 + HEX 00080301020207030008010101030502 + +*----------------------------------- +* PLAY MUSIC +*----------------------------------- + +playMUSIC ASL + TAX + LDA L6A71,X + STA $06 + LDA L6A71+1,X + STA $06+1 + LDY #$00 + LDA ($06),Y + STA $0C + STA $0D +L6914 INC $06 + BNE L691A + INC $06+1 +L691A LDY #$00 + STY $0F + STY $0E + LDA ($06),Y + CMP #$FF + BEQ L6989 + TAX + AND #$03 + TAY + TXA + LSR + LSR + BNE L6931 + DEC $0E +L6931 TAX + LDA #>L6969 + STA $10+1 + LDA L69D3,X + CLC + ADC #