![]() |
Routines |
| Prev: C421 | Up: Map | Next: C583 |
|
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 | D contains the time for the third dueller. | |||||||||||||
| C42E | POP BC | B contains the time for the first dueller. C contains the time for the third dueller. | |||||||||||||
| 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) | Get the flag at C421, which contains a speed increase factor for the duel. | |||||||||||||
| C453 | OR $01 | Ensure bit 1 is set. | |||||||||||||
| C455 | CP $20 | Are we at maximum speed? | |||||||||||||
| C457 | LD DE,$0001 | If so, set the speed to 1 (fastest) and move on. | |||||||||||||
| C45A | JR NC,Duel_Clear_Screen | ||||||||||||||
| C45C | LD B,A | Subtract the speed increase from the basic speed of 20. | |||||||||||||
| C45D | LD DE,$0020 | ||||||||||||||
| Duel_Prep_Loop | C460 | DEC DE | |||||||||||||
| C461 | DJNZ Duel_Prep_Loop | ||||||||||||||
| Duel_Clear_Screen | C463 | LD ($C52E),DE | Put the speed in C52E. | ||||||||||||
|
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...
|
|||||||||||||
| C477 | LD DE,$5881 | ||||||||||||||
| C47A | LD BC,$0180 | ||||||||||||||
| C47D | LD (HL),$28 | ||||||||||||||
| C47F | LDIR | ||||||||||||||
| C481 | LD (HL),$20 | ...continuing, writes 20 80 times...
|
|||||||||||||
| C483 | LD BC,$0080 | ||||||||||||||
| C486 | LDIR | ||||||||||||||
| C488 | LD (HL),$07 | ...and finally, writes 07 7F times.
|
|||||||||||||
| 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.
|
|||||||||||||
| 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) | Get the drawing speed from C52E and push it on the stack. | ||||||||||||
| Duel_Start_Loop | C4FD | PUSH DE | |||||||||||||
| C4FE | CALL Duel_Loop | Gather user input and set flags if the gun was fired. | |||||||||||||
| C501 | POP DE | Restore speed value and loop round. | |||||||||||||
| C502 | DEC DE | ||||||||||||||
| C503 | LD A,D | ||||||||||||||
| C504 | OR E | ||||||||||||||
| C505 | JR NZ,Duel_Start_Loop | ||||||||||||||
|
A "tick" (defined by the duel speed) has elapsed, so update the characters.
|
|||||||||||||||
| C507 | LD IX,$5BC0 | Update the first character. | |||||||||||||
| C50B | CALL $C58B | ||||||||||||||
| C50E | LD IX,$5BD1 | Update the second character. | |||||||||||||
| C512 | CALL $C58B | ||||||||||||||
| C515 | LD IX,$5BE2 | Update the third character. | |||||||||||||
| C519 | CALL $C58B | ||||||||||||||
| C51C | LD IX,$5BC0 | Are all three duellers shot? | |||||||||||||
| C520 | LD A,(IX+$08) | ||||||||||||||
| C523 | OR (IX+$19) | ||||||||||||||
| C526 | OR (IX+$2A) | ||||||||||||||
| C529 | JP Z,Duel_Complete | Jump forward if so. | |||||||||||||
| C52C | JR Duel_Start | Otherwise run the loop again. | |||||||||||||
|
Holds the speed of the duel, from 1F (slowest) to 01 (fastest).
|
|||||||||||||||
| C52E | DEFW $001F | ||||||||||||||
|
Run the duel actions. This entry point is used by the routine in Countdown_Initialise.
|
|||||||||||||||
| Duel_Actions | C530 | CALL Duel_Action_01 | Check for shooting door 3. | ||||||||||||
| C533 | CALL Duel_Action_04 | Take action on this. | |||||||||||||
| C536 | CALL Duel_Action_02 | Check for shooting door 2. | |||||||||||||
| C539 | CALL Duel_Action_04 | Take action on this. | |||||||||||||
| C53C | CALL Duel_Action_03 | Check for shooting door 1. | |||||||||||||
| C53F | CALL Duel_Action_04 | Take action on this. | |||||||||||||
| C542 | RET | Return. | |||||||||||||
|
Check for shooting at position 3.
|
|||||||||||||||
| Duel_Action_01 | C543 | CALL Jump_Control_Method | Check for the player shooting. | ||||||||||||
| C546 | BIT 4,A | Return if bit 4 of A is zero, meaning the player didn't shoot. | |||||||||||||
| C548 | RET Z | ||||||||||||||
| C549 | BIT 0,A | If bit 0 is not zero then user fired at the right position, so set A to position 03. | |||||||||||||
| C54B | LD A,$03 | ||||||||||||||
| C54D | RET NZ | ||||||||||||||
| C54E | XOR A | Otherwise set A to zero for "didn't shoot" and return. | |||||||||||||
| C54F | RET | ||||||||||||||
|
Check for shooting at position 1.
|
|||||||||||||||
| Duel_Action_02 | C550 | CALL Jump_Control_Method | Check for the player shooting. | ||||||||||||
| C553 | BIT 4,A | Return if bit 4 of A is zero, meaning the player didn't shoot. | |||||||||||||
| C555 | RET Z | ||||||||||||||
| C556 | BIT 1,A | If bit 1 is not zero then user fired at the left position, so set A to position 01. | |||||||||||||
| C558 | LD A,$01 | ||||||||||||||
| C55A | RET NZ | ||||||||||||||
| C55B | XOR A | Otherwise set A to zero for "didn't shoot" and return. | |||||||||||||
| C55C | RET | ||||||||||||||
|
Check for shooting at position 2.
|
|||||||||||||||
| Duel_Action_03 | C55D | CALL Jump_Control_Method | Check for the player shooting. | ||||||||||||
| C560 | BIT 4,A | Return if bit 4 of A is zero, meaning the player didn't shoot. | |||||||||||||
| C562 | RET Z | ||||||||||||||
| C563 | AND $03 | If bits 2 and 3 are set, set A to zero for "didn't shoot" and return. | |||||||||||||
| C565 | LD A,$00 | ||||||||||||||
| C567 | RET NZ | ||||||||||||||
| C568 | LD A,$02 | Otherwise user fired at the middle position, so set A to position 02. | |||||||||||||
| C56A | RET | ||||||||||||||
|
Compare a user action with a dueller.
|
|||||||||||||||
| Duel_Action_04 | C56B | CP (IX+$03) | If the user has fired at this dueller then jump to Duel_Fired. | ||||||||||||
| C56E | JR Z,Duel_Fired | ||||||||||||||
| C570 | LD (IX+$0D),$00 | Set the dueller to "not fired at" | |||||||||||||
| C574 | RET | Return. | |||||||||||||
|
Take action after the player shot a dueller.
|
|||||||||||||||
| Duel_Fired | C575 | LD A,(IX+$0D) | Get the "fired at" flag. | ||||||||||||
| C578 | AND A | Is it zero? | |||||||||||||
| C579 | RET NZ | Return if not. | |||||||||||||
| C57A | LD A,$01 | Set "fired at" and "fired at by player" flags. | |||||||||||||
| C57C | LD (IX+$0D),A | ||||||||||||||
| C57F | LD (IX+$00),A | ||||||||||||||
| C582 | RET | Return. | |||||||||||||
| Prev: C421 | Up: Map | Next: C583 |