Prev: C3EA Up: Map Next: C5EB
C422: Duel Bonus Round
Used by the routine at C3C0.
Duel_Prep C422 LD HL,$C3EA Copies 33 bytes of data from Duel_Data to Dueller_01 (and across all three duellists).
C425 LD DE,$5BC0
C428 LD BC,$0033
C42B LDIR
C42D POP DE
C42E POP BC
C42F LD A,B
C430 LD IX,$5BC0 Calls Update_Duel_Timer with Dueller_01.
C434 CALL Update_Duel_Timer
C437 LD A,C
C438 LD IX,$5BD1 Calls Update_Duel_Timer with Dueller_02.
C43C CALL Update_Duel_Timer
C43F LD A,D
C440 LD IX,$5BE2 Calls Update_Duel_Timer with Dueller_03.
C444 CALL Update_Duel_Timer
C447 XOR A Reset the flags (writes 00 to Duel_Bang_Flag, Duel_Lose_Life and Duel_Extra_Life).
C448 LD HL,$C6E2
C44B LD (HL),A
C44C INC HL
C44D LD (HL),A
C44E INC HL
C44F LD (HL),A
C450 LD A,($C421) C421.
C453 OR $01
C455 CP $20
C457 LD DE,$0001
C45A JR NC,Duel_Clear_Screen
C45C LD B,A
C45D LD DE,$0020
Duel_Prep_Loop C460 DEC DE
C461 DJNZ Duel_Prep_Loop
Duel_Clear_Screen C463 LD ($C52E),DE ....
Clears down the screen buffer.
C467 LD HL,$4000 Writes 00 to all 1AFF bytes of the screen buffer (i.e. "blanks it").
C46A LD DE,$4001
C46D LD BC,$1AFF
C470 XOR A
C471 LD (HL),A
C472 LDIR
Writes the attributes for the playfield (sky, grass, footer).
C474 LD HL,$5880 Writes 28 to 5880 in the attribute buffer 0180 times...
Value Ink Paper Bright
00 05 00 00
C477 LD DE,$5881
C47A LD BC,$0180
C47D LD (HL),$28
C47F LDIR
C481 LD (HL),$20 ...continuing, writes 20 80 times...
Value Ink Paper Bright
00 04 00 00
C483 LD BC,$0080
C486 LDIR
C488 LD (HL),$07 ...and finally, writes 07 7F times.
Value Ink Paper Bright
07 00 00 00
C48A LD BC,$007F
C48D LDIR
Creates the footer.
C48F LD HL,$C655 Point to Playfield_Lives and print using Duel_Print_Lives.
C492 CALL Duel_Print_Lives
C495 CALL Draw_Lives_Images_Alias
C498 LD HL,$C64D Point to Playfield_Score and prints using Print_TwoToneText_Alias.
Value Ink Paper Bright
07 07 00 00
03 03 00 00
C49B LD DE,$50C0
C49E LD BC,$0703
C4A1 CALL Print_TwoToneText_Alias
C4A4 CALL Draw_Score_Alias Writes the players score.
Initialise duellers.
C4A7 LD IX,$5BC0 Initialise Dueller_01 (draws frame 1).
C4AB LD A,(IX+$0A)
C4AE CALL Duel_Draw_Bandit_Prep
C4B1 LD IX,$5BD1 Initialise Dueller_02 (draws frame 1).
C4B5 LD A,(IX+$0A)
C4B8 CALL Duel_Draw_Bandit_Prep
C4BB LD IX,$5BE2 Initialise Dueller_03 (draws frame 1).
C4BF LD A,(IX+$0A)
C4C2 CALL Duel_Draw_Bandit_Prep
Count down 5-4-3-2-1...0!
Countdown_Initialise C4C5 LD A,$35 Initialise countdown to "5" seconds (35 in ASCII), hold this at Duel_Timer.
Countdown_Loop C4C7 PUSH AF
C4C8 LD ($C6E0),A
C4CB CALL Duel_Print_Countdown
C4CE LD B,$31 Short halt loop (1 second pause).
Countdown_Halt_Loop C4D0 HALT
C4D1 DJNZ Countdown_Halt_Loop
C4D3 POP AF Keep looping back to Countdown_Loop until the countdown is "0" (30 in ASCII).
C4D4 DEC A
C4D5 CP $30
C4D7 JR NZ,Countdown_Loop
C4D9 LD A,$20 Blank the countdown timer by printing a "SPACE" (20 in ASCII) over the top of it.
C4DB LD ($C6E0),A
C4DE CALL Duel_Print_Countdown
C4E1 JR Duel_Start Jump to Duel_Start and start the duel!
Duel_Loop C4E3 LD IX,$5BC0 Calls Duel_Actions with Dueller_01.
C4E7 CALL Duel_Actions
C4EA LD IX,$5BD1 Calls Duel_Actions with Dueller_02.
C4EE CALL Duel_Actions
C4F1 LD IX,$5BE2 Calls Duel_Actions with Dueller_03.
C4F5 CALL Duel_Actions
C4F8 RET Return.
DRAW!
Duel_Start C4F9 LD DE,($C52E) DE=C52E and push it on the stack.
Duel_Start_Loop C4FD PUSH DE
C4FE CALL Duel_Loop
C501 POP DE
C502 DEC DE
C503 LD A,D
C504 OR E
C505 JR NZ,Duel_Start_Loop
C507 LD IX,$5BC0
C50B CALL Duel_Prep_1
C50E LD IX,$5BD1
C512 CALL Duel_Prep_1
C515 LD IX,$5BE2
C519 CALL Duel_Prep_1
C51C LD IX,$5BC0
C520 LD A,(IX+$08)
C523 OR (IX+$19)
C526 OR (IX+$2A)
C529 JP Z,Duel_Complete
C52C JR Duel_Start
C52E DEFW $001F
Duel_Actions C530 CALL Duel_Action_01
C533 CALL Duel_Action_04
C536 CALL Duel_Action_02
C539 CALL Duel_Action_04
C53C CALL Duel_Action_03
C53F CALL Duel_Action_04
C542 RET Return.
Duel_Action_01 C543 CALL Jump_Control_Method Calls Jump_Control_Method.
C546 BIT 4,A Return if bit 4 of A is zero.
C548 RET Z
C549 BIT 0,A If bit 0 is not zero then return setting A to 03.
C54B LD A,$03
C54D RET NZ
C54E XOR A Set A to zero and return.
C54F RET
Duel_Action_02 C550 CALL Jump_Control_Method Calls Jump_Control_Method.
C553 BIT 4,A Return if bit 4 of A is zero.
C555 RET Z
C556 BIT 1,A If bit 1 is not zero then return setting A to 01.
C558 LD A,$01
C55A RET NZ
C55B XOR A Set A to zero and return.
C55C RET
Duel_Action_03 C55D CALL Jump_Control_Method
C560 BIT 4,A
C562 RET Z
C563 AND $03
C565 LD A,$00
C567 RET NZ
C568 LD A,$02
C56A RET Return.
Duel_Action_04 C56B CP (IX+$03) If the dueller position has been changed to zero then jump to Duel_Dunno.
C56E JR Z,Duel_Dunno
C570 LD (IX+$0D),$00
C574 RET Return.
Duel_Dunno C575 LD A,(IX+$0D)
C578 AND A
C579 RET NZ
C57A LD A,$01
C57C LD (IX+$0D),A
C57F LD (IX+$00),A Set dueller state to 01.
C582 RET Return.
This entry point is used by the routines at Print_BonusScore and Dueller_Shot.
Duel_Prep_0 C583 PUSH IX
C585 CALL Shot_Sound_01_Alias
C588 POP IX
C58A RET
Duel_Prep_1 C58B LD A,(IX+$08) If IX+$08 is zero then return.
C58E AND A
C58F RET Z
C590 LD A,(IX+$09) If dueller frame index is 01 then jump to Duel_Prep_2.
C593 DEC A
C594 JR Z,Duel_Prep_2
C596 DEC A If dueller frame index is 02 then jump to Duel_Prep_3.
C597 JR Z,Duel_Prep_3
C599 DEC A If dueller frame index is 03 then jump to Duel_Prep_4.
C59A JR Z,Duel_Prep_4
C59C DEC A If dueller frame index is 04 then jump to Duel_Prep_5.
C59D JR Z,Duel_Prep_5
C59F JR Duel_Prep_6 Jump to Duel_Prep_6.
Duel_Prep_2 C5A1 LD HL,$C6E5 Dueller_Shot.
C5A4 CALL Dueller_Down
C5A7 DEC (IX+$01)
C5AA RET NZ
C5AB INC (IX+$09)
C5AE LD A,(IX+$0B)
C5B1 CALL Duel_Draw_Bandit_Prep
C5B4 RET
Duel_Prep_3 C5B5 DEC (IX+$10)
C5B8 RET NZ
C5B9 INC (IX+$09)
C5BC RET
Duel_Prep_4 C5BD LD HL,$C5F6
C5C0 CALL Dueller_Down
C5C3 DEC (IX+$02)
C5C6 RET NZ
C5C7 LD (IX+$08),A
C5CA INC A
C5CB LD ($C6E2),A
C5CE RET
Duel_Prep_5 C5CF DEC (IX+$0E)
C5D2 RET NZ
C5D3 INC (IX+$09)
C5D6 LD A,(IX+$0C)
C5D9 CALL Duel_Draw_Bandit_Prep
C5DC RET
Duel_Prep_6 C5DD DEC (IX+$0F)
C5E0 RET NZ
C5E1 LD A,$02
C5E3 CALL Duel_Draw_Bandit_Prep
C5E6 LD (IX+$08),$00
C5EA RET
Prev: C3EA Up: Map Next: C5EB