![]() |
Routines |
| Prev: 50209 | Up: Map | Next: 50563 |
|
Used by the routine at 50112.
|
|||||||||||||||
| Duel_Prep | 50210 | LD HL,50154 | Copies 51 bytes of data from Duel_Data to Dueller_01 (and across all three duellists). | ||||||||||||
| 50213 | LD DE,23488 | ||||||||||||||
| 50216 | LD BC,51 | ||||||||||||||
| 50219 | LDIR | ||||||||||||||
| 50221 | POP DE | D contains the time for the third dueller. | |||||||||||||
| 50222 | POP BC | B contains the time for the first dueller. C contains the time for the third dueller. | |||||||||||||
| 50223 | LD A,B | ||||||||||||||
| 50224 | LD IX,23488 | Calls Update_Duel_Timer with Dueller_01. | |||||||||||||
| 50228 | CALL Update_Duel_Timer | ||||||||||||||
| 50231 | LD A,C | ||||||||||||||
| 50232 | LD IX,23505 | Calls Update_Duel_Timer with Dueller_02. | |||||||||||||
| 50236 | CALL Update_Duel_Timer | ||||||||||||||
| 50239 | LD A,D | ||||||||||||||
| 50240 | LD IX,23522 | Calls Update_Duel_Timer with Dueller_03. | |||||||||||||
| 50244 | CALL Update_Duel_Timer | ||||||||||||||
| 50247 | XOR A | Reset the flags (writes 0 to Duel_Bang_Flag, Duel_Lose_Life and Duel_Extra_Life). | |||||||||||||
| 50248 | LD HL,50914 | ||||||||||||||
| 50251 | LD (HL),A | ||||||||||||||
| 50252 | INC HL | ||||||||||||||
| 50253 | LD (HL),A | ||||||||||||||
| 50254 | INC HL | ||||||||||||||
| 50255 | LD (HL),A | ||||||||||||||
| 50256 | LD A,(50209) | Get the flag at 50209, which contains a speed increase factor for the duel. | |||||||||||||
| 50259 | OR 1 | Ensure bit 1 is set. | |||||||||||||
| 50261 | CP 32 | Are we at maximum speed? | |||||||||||||
| 50263 | LD DE,1 | If so, set the speed to 1 (fastest) and move on. | |||||||||||||
| 50266 | JR NC,Duel_Clear_Screen | ||||||||||||||
| 50268 | LD B,A | Subtract the speed increase from the basic speed of 32. | |||||||||||||
| 50269 | LD DE,32 | ||||||||||||||
| Duel_Prep_Loop | 50272 | DEC DE | |||||||||||||
| 50273 | DJNZ Duel_Prep_Loop | ||||||||||||||
| Duel_Clear_Screen | 50275 | LD (50478),DE | Put the speed in 50478. | ||||||||||||
|
Clears down the screen buffer.
|
|||||||||||||||
| 50279 | LD HL,16384 | Writes 0 to all 6911 bytes of the screen buffer (i.e. "blanks it"). | |||||||||||||
| 50282 | LD DE,16385 | ||||||||||||||
| 50285 | LD BC,6911 | ||||||||||||||
| 50288 | XOR A | ||||||||||||||
| 50289 | LD (HL),A | ||||||||||||||
| 50290 | LDIR | ||||||||||||||
|
Writes the attributes for the playfield (sky, grass, footer).
|
|||||||||||||||
| 50292 | LD HL,22656 | Writes 40 to 22656 in the attribute buffer 384 times...
|
|||||||||||||
| 50295 | LD DE,22657 | ||||||||||||||
| 50298 | LD BC,384 | ||||||||||||||
| 50301 | LD (HL),40 | ||||||||||||||
| 50303 | LDIR | ||||||||||||||
| 50305 | LD (HL),32 | ...continuing, writes 32 128 times...
|
|||||||||||||
| 50307 | LD BC,128 | ||||||||||||||
| 50310 | LDIR | ||||||||||||||
| 50312 | LD (HL),7 | ...and finally, writes 7 127 times.
|
|||||||||||||
| 50314 | LD BC,127 | ||||||||||||||
| 50317 | LDIR | ||||||||||||||
|
Creates the footer.
|
|||||||||||||||
| 50319 | LD HL,50773 | Point to Playfield_Lives and print using Duel_Print_Lives. | |||||||||||||
| 50322 | CALL Duel_Print_Lives | ||||||||||||||
| 50325 | CALL Draw_Lives_Images_Alias | ||||||||||||||
| 50328 | LD HL,50765 | Point to Playfield_Score and prints using Print_TwoToneText_Alias.
|
|||||||||||||
| 50331 | LD DE,20672 | ||||||||||||||
| 50334 | LD BC,1795 | ||||||||||||||
| 50337 | CALL Print_TwoToneText_Alias | ||||||||||||||
| 50340 | CALL Draw_Score_Alias | Writes the players score. | |||||||||||||
|
Initialise duellers.
|
|||||||||||||||
| 50343 | LD IX,23488 | Initialise Dueller_01 (draws frame 1). | |||||||||||||
| 50347 | LD A,(IX+10) | ||||||||||||||
| 50350 | CALL Duel_Draw_Bandit_Prep | ||||||||||||||
| 50353 | LD IX,23505 | Initialise Dueller_02 (draws frame 1). | |||||||||||||
| 50357 | LD A,(IX+10) | ||||||||||||||
| 50360 | CALL Duel_Draw_Bandit_Prep | ||||||||||||||
| 50363 | LD IX,23522 | Initialise Dueller_03 (draws frame 1). | |||||||||||||
| 50367 | LD A,(IX+10) | ||||||||||||||
| 50370 | CALL Duel_Draw_Bandit_Prep | ||||||||||||||
|
Count down 5-4-3-2-1...0!
|
|||||||||||||||
| Countdown_Initialise | 50373 | LD A,53 | Initialise countdown to "5" seconds (53 in ASCII), hold this at Duel_Timer. | ||||||||||||
| Countdown_Loop | 50375 | PUSH AF | |||||||||||||
| 50376 | LD (50912),A | ||||||||||||||
| 50379 | CALL Duel_Print_Countdown | ||||||||||||||
| 50382 | LD B,49 | Short halt loop (1 second pause). | |||||||||||||
| Countdown_Halt_Loop | 50384 | HALT | |||||||||||||
| 50385 | DJNZ Countdown_Halt_Loop | ||||||||||||||
| 50387 | POP AF | Keep looping back to Countdown_Loop until the countdown is "0" (48 in ASCII). | |||||||||||||
| 50388 | DEC A | ||||||||||||||
| 50389 | CP 48 | ||||||||||||||
| 50391 | JR NZ,Countdown_Loop | ||||||||||||||
| 50393 | LD A,32 | Blank the countdown timer by printing a "SPACE" (32 in ASCII) over the top of it. | |||||||||||||
| 50395 | LD (50912),A | ||||||||||||||
| 50398 | CALL Duel_Print_Countdown | ||||||||||||||
| 50401 | JR Duel_Start | Jump to Duel_Start and start the duel! | |||||||||||||
| Duel_Loop | 50403 | LD IX,23488 | Calls Duel_Actions with Dueller_01. | ||||||||||||
| 50407 | CALL Duel_Actions | ||||||||||||||
| 50410 | LD IX,23505 | Calls Duel_Actions with Dueller_02. | |||||||||||||
| 50414 | CALL Duel_Actions | ||||||||||||||
| 50417 | LD IX,23522 | Calls Duel_Actions with Dueller_03. | |||||||||||||
| 50421 | CALL Duel_Actions | ||||||||||||||
| 50424 | RET | Return. | |||||||||||||
|
DRAW!
|
|||||||||||||||
| Duel_Start | 50425 | LD DE,(50478) | Get the drawing speed from 50478 and push it on the stack. | ||||||||||||
| Duel_Start_Loop | 50429 | PUSH DE | |||||||||||||
| 50430 | CALL Duel_Loop | Gather user input and set flags if the gun was fired. | |||||||||||||
| 50433 | POP DE | Restore speed value and loop round. | |||||||||||||
| 50434 | DEC DE | ||||||||||||||
| 50435 | LD A,D | ||||||||||||||
| 50436 | OR E | ||||||||||||||
| 50437 | JR NZ,Duel_Start_Loop | ||||||||||||||
|
A "tick" (defined by the duel speed) has elapsed, so update the characters.
|
|||||||||||||||
| 50439 | LD IX,23488 | Update the first character. | |||||||||||||
| 50443 | CALL 50571 | ||||||||||||||
| 50446 | LD IX,23505 | Update the second character. | |||||||||||||
| 50450 | CALL 50571 | ||||||||||||||
| 50453 | LD IX,23522 | Update the third character. | |||||||||||||
| 50457 | CALL 50571 | ||||||||||||||
| 50460 | LD IX,23488 | Are all three duellers shot? | |||||||||||||
| 50464 | LD A,(IX+8) | ||||||||||||||
| 50467 | OR (IX+25) | ||||||||||||||
| 50470 | OR (IX+42) | ||||||||||||||
| 50473 | JP Z,Duel_Complete | Jump forward if so. | |||||||||||||
| 50476 | JR Duel_Start | Otherwise run the loop again. | |||||||||||||
|
Holds the speed of the duel, from 31 (slowest) to 1 (fastest).
|
|||||||||||||||
| 50478 | DEFW 31 | ||||||||||||||
|
Run the duel actions. This entry point is used by the routine in Countdown_Initialise.
|
|||||||||||||||
| Duel_Actions | 50480 | CALL Duel_Action_01 | Check for shooting door 3. | ||||||||||||
| 50483 | CALL Duel_Action_04 | Take action on this. | |||||||||||||
| 50486 | CALL Duel_Action_02 | Check for shooting door 2. | |||||||||||||
| 50489 | CALL Duel_Action_04 | Take action on this. | |||||||||||||
| 50492 | CALL Duel_Action_03 | Check for shooting door 1. | |||||||||||||
| 50495 | CALL Duel_Action_04 | Take action on this. | |||||||||||||
| 50498 | RET | Return. | |||||||||||||
|
Check for shooting at position 3.
|
|||||||||||||||
| Duel_Action_01 | 50499 | CALL Jump_Control_Method | Check for the player shooting. | ||||||||||||
| 50502 | BIT 4,A | Return if bit 4 of A is zero, meaning the player didn't shoot. | |||||||||||||
| 50504 | RET Z | ||||||||||||||
| 50505 | BIT 0,A | If bit 0 is not zero then user fired at the right position, so set A to position 3. | |||||||||||||
| 50507 | LD A,3 | ||||||||||||||
| 50509 | RET NZ | ||||||||||||||
| 50510 | XOR A | Otherwise set A to zero for "didn't shoot" and return. | |||||||||||||
| 50511 | RET | ||||||||||||||
|
Check for shooting at position 1.
|
|||||||||||||||
| Duel_Action_02 | 50512 | CALL Jump_Control_Method | Check for the player shooting. | ||||||||||||
| 50515 | BIT 4,A | Return if bit 4 of A is zero, meaning the player didn't shoot. | |||||||||||||
| 50517 | RET Z | ||||||||||||||
| 50518 | BIT 1,A | If bit 1 is not zero then user fired at the left position, so set A to position 1. | |||||||||||||
| 50520 | LD A,1 | ||||||||||||||
| 50522 | RET NZ | ||||||||||||||
| 50523 | XOR A | Otherwise set A to zero for "didn't shoot" and return. | |||||||||||||
| 50524 | RET | ||||||||||||||
|
Check for shooting at position 2.
|
|||||||||||||||
| Duel_Action_03 | 50525 | CALL Jump_Control_Method | Check for the player shooting. | ||||||||||||
| 50528 | BIT 4,A | Return if bit 4 of A is zero, meaning the player didn't shoot. | |||||||||||||
| 50530 | RET Z | ||||||||||||||
| 50531 | AND 3 | If bits 2 and 3 are set, set A to zero for "didn't shoot" and return. | |||||||||||||
| 50533 | LD A,0 | ||||||||||||||
| 50535 | RET NZ | ||||||||||||||
| 50536 | LD A,2 | Otherwise user fired at the middle position, so set A to position 2. | |||||||||||||
| 50538 | RET | ||||||||||||||
|
Compare a user action with a dueller.
|
|||||||||||||||
| Duel_Action_04 | 50539 | CP (IX+3) | If the user has fired at this dueller then jump to Duel_Fired. | ||||||||||||
| 50542 | JR Z,Duel_Fired | ||||||||||||||
| 50544 | LD (IX+13),0 | Set the dueller to "not fired at" | |||||||||||||
| 50548 | RET | Return. | |||||||||||||
|
Take action after the player shot a dueller.
|
|||||||||||||||
| Duel_Fired | 50549 | LD A,(IX+13) | Get the "fired at" flag. | ||||||||||||
| 50552 | AND A | Is it zero? | |||||||||||||
| 50553 | RET NZ | Return if not. | |||||||||||||
| 50554 | LD A,1 | Set "fired at" and "fired at by player" flags. | |||||||||||||
| 50556 | LD (IX+13),A | ||||||||||||||
| 50559 | LD (IX+0),A | ||||||||||||||
| 50562 | RET | Return. | |||||||||||||
| Prev: 50209 | Up: Map | Next: 50563 |