![]() |
Routines |
Prev: 26276 | Up: Map |
Used by the routine at 26276.
|
||||||||
26426 | LD A,(31864) | Decrement the number of lives. | ||||||
26429 | DEC A | |||||||
26430 | LD (31864),A | |||||||
26433 | XOR A | Reset the tunnel timer. | ||||||
26434 | LD (31865),A | |||||||
26437 | LD (28094),A | Reset the current guard's return delay counter. | ||||||
26440 | LD HL,16391 | This is the display file address for the score. | ||||||
26443 | CALL 27663 | Set HL' to the corresponding attribute file address (unnecessarily). | ||||||
26446 | LD A,(31864) | Pick up the number of lives remaining. | ||||||
26449 | ADD A,"0" | Convert it to the ASCII code of the digit. | ||||||
26451 | EX DE,HL | Transfer the display file address to DE. | ||||||
26452 | CALL 27471 | Print the number of lives remaining. | ||||||
The following loop produces the Horace-has-died colour-cycling effect.
|
||||||||
26455 | LD B,45 | Initialise the loop counter. | ||||||
26457 | PUSH BC | Save the loop counter. | ||||||
26458 | LD A,(31857) | Increment Horace's INK colour. | ||||||
26461 | INC A | |||||||
26462 | AND 7 | |||||||
26464 | OR 56 | |||||||
26466 | LD (31857),A | |||||||
26469 | PUSH AF | Save the attribute byte briefly. | ||||||
26470 | CALL 26674 | Draw Horace in this new colour. | ||||||
26473 | LD HL,22528 | This is the attribute file address for the 'P' of 'PASSES'. | ||||||
26476 | LD B,9 | B will count the characters in 'PASSES n ' (where 'n' in the number of lives remaining). | ||||||
26478 | POP AF | Restore the attribute byte to A. | ||||||
26479 | LD (HL),A | Change the INK colour of the number of remaining lives to match that of Horace. | ||||||
26480 | INC HL | |||||||
26481 | DJNZ 26479 | |||||||
26483 | LD C,20 | Initialise C for the loop that follows. | ||||||
26485 | LD A,31 | Flip the speaker off if the sound on/off indicator is on, or on otherwise. | ||||||
26487 | LD HL,31849 | |||||||
26490 | AND (HL) | |||||||
26491 | OUT (254),A | |||||||
26493 | CALL 27410 | Generate a pseudo-random number in A. | ||||||
26496 | OR 64 | Set bit 6 to make sure it's in the range 64-255. | ||||||
26498 | LD B,A | Use this value to produce a short delay. | ||||||
26499 | DJNZ 26499 | |||||||
26501 | LD A,7 | Flip the speaker on. | ||||||
26503 | OUT (254),A | |||||||
26505 | CALL 27410 | Generate another pseudo-random number in the range 64-255. | ||||||
26508 | OR 64 | |||||||
26510 | LD B,A | Use this value to produce a short delay. | ||||||
26511 | DJNZ 26511 | |||||||
26513 | DEC C | Finished yet? | ||||||
26514 | JR NZ,26485 | Jump back if not. | ||||||
26516 | POP BC | Restore the loop counter to B. | ||||||
26517 | DJNZ 26457 | Jump back for the next iteration. | ||||||
Now that's done, reinitialise Horace and the guards.
|
||||||||
26519 | LD A,56 | Reset the INK colour of the number of remaining lives to black. | ||||||
26521 | LD HL,22528 | |||||||
26524 | LD B,8 | |||||||
26526 | LD (HL),A | |||||||
26527 | INC HL | |||||||
26528 | DJNZ 26526 | |||||||
26530 | LD A,57 | Reset Horace's attribute byte (INK 1: PAPER 7). | ||||||
26532 | LD (31857),A | |||||||
26535 | LD HL,28076 | Point HL at the last of the four guard countdown timers. | ||||||
26538 | LD B,1 | B will count four guards (1, 2, 3, 4). | ||||||
26540 | PUSH BC | Save the guard counter. | ||||||
26541 | LD A,(HL) | Set the zero flag if this guard is in play. | ||||||
26542 | INC HL | |||||||
26543 | OR (HL) | |||||||
26544 | DEC HL | Point HL at the next guard's countdown timer. | ||||||
26545 | DEC HL | |||||||
26546 | DEC HL | |||||||
26547 | PUSH HL | Save the guard countdown timer pointer. | ||||||
26548 | JR NZ,26559 | Jump if this guard is not in play yet. | ||||||
26550 | CALL 27199 | Copy the guard's buffer into the temporary location (28088). | ||||||
26553 | CALL 25960 | Redraw the maze background tiles at this guard's location. | ||||||
26556 | CALL 27242 | Copy the guard's buffer back to the original location. | ||||||
26559 | POP HL | Restore the guard countdown timer pointer to HL. | ||||||
26560 | POP BC | Restore the guard counter to B. | ||||||
26561 | INC B | Next guard. | ||||||
26562 | LD A,B | Copy the guard counter to A. | ||||||
26563 | CP 5 | Have we done all four guards yet? | ||||||
26565 | JR NZ,26540 | If not, jump back to do the next one. | ||||||
26567 | LD HL,(31851) | Pick up Horace's current location. | ||||||
26570 | LD DE,32647 | Point DE at the graphic data for the blank sprite. | ||||||
26573 | CALL 27663 | Set HL' to the attribute file address corresponding to Horace's location. | ||||||
26576 | LD C,62 | This is the attribute byte for the blank sprite (INK 6: PAPER 7). | ||||||
26578 | CALL 27606 | Draw the blank sprite at Horace's location. | ||||||
26581 | LD A,(31864) | Pick up the number of lives remaining. | ||||||
26584 | AND A | Is it zero? | ||||||
26585 | JR Z,26601 | Jump if so. | ||||||
26587 | POP HL | Drop the return address from the stack. | ||||||
26588 | CALL 27170 | Initialise the guard countdown timers. | ||||||
26591 | LD A,(27403) | Pick up the game mode indicator. | ||||||
26594 | AND A | Is it demo mode? | ||||||
26595 | JP NZ,25002 | Jump if not. | ||||||
26598 | JP 24809 | Otherwise move to the next maze. | ||||||
Horace has just lost his last remaining life. This entry point is also used by the routine at 25167 when a key is pressed in demo mode.
|
||||||||
26601 | LD B,20 | This loop will have 20 iterations. | ||||||
26603 | PUSH BC | Save the loop counter. | ||||||
26604 | CALL 27255 | Make a sound effect. | ||||||
26607 | LD HL,22528 | Change the INK colour of the entire screen to B mod 8. | ||||||
26610 | LD DE,22529 | |||||||
26613 | LD A,B | |||||||
26614 | AND 7 | |||||||
26616 | ADD A,56 | |||||||
26618 | LD (HL),A | |||||||
26619 | LD BC,767 | |||||||
26622 | LDIR | |||||||
26624 | POP BC | Restore the loop counter to B. | ||||||
26625 | DJNZ 26603 | Jump back for the next iteration. | ||||||
26627 | POP HL | Drop the return address from the stack. | ||||||
26628 | LD A,(27403) | Pick up the game mode indicator. | ||||||
26631 | AND A | Is it demo mode? | ||||||
26632 | JP Z,24602 | Return to the title screen if so. | ||||||
26635 | LD HL,(31859) | Pick up the current score. | ||||||
26638 | LD BC,(31861) | Pick up the high score. | ||||||
26642 | XOR A | Clear the carry flag for subtraction. | ||||||
26643 | SBC HL,BC | Do we have a new high score? | ||||||
26645 | JP C,24602 | Return to the title screen if not. | ||||||
26648 | LD HL,(31859) | Pick up the current score. | ||||||
26651 | LD (31861),HL | Make it the new high score. | ||||||
26654 | JP 24602 | Return to the title screen. |
Prev: 26276 | Up: Map |