![]() |
Routines |
| Prev: | Up: Map |
|
|||||||
| 24576 | DI | Disable interrupts. | |||||
| 24577 | LD A,(23672) | Initialise the pseudo-random number address. | |||||
| 24580 | LD L,A | ||||||
| 24581 | AND 31 | ||||||
| 24583 | LD H,A | ||||||
| 24584 | LD A,(HL) | ||||||
| 24585 | LD L,A | ||||||
| 24586 | AND 31 | ||||||
| 24588 | LD H,A | ||||||
| 24589 | LD (31847),HL | ||||||
| 24592 | LD HL,31850 | Initialise the 'T' pressed indicator to 'off' (bit 4 set). | |||||
| 24595 | LD (HL),16 | ||||||
| 24597 | LD HL,31849 | Initialise the sound indicator to 'on'. | |||||
| 24600 | LD (HL),31 | ||||||
|
This entry point is used by the routine at 26426 when a game has ended.
|
|||||||
| 24602 | LD HL,22528 | INK 7: PAPER 7 | |||||
| 24605 | LD DE,22529 | ||||||
| 24608 | LD BC,767 | ||||||
| 24611 | LD (HL),63 | ||||||
| 24613 | LDIR | ||||||
| 24615 | LD HL,16384 | Clear the display file. | |||||
| 24618 | LD DE,16385 | ||||||
| 24621 | LD BC,6143 | ||||||
| 24624 | LD (HL),0 | ||||||
| 24626 | LDIR | ||||||
| 24628 | LD HL,22528 | INK 0: PAPER 7 | |||||
| 24631 | LD DE,22529 | ||||||
| 24634 | LD BC,767 | ||||||
| 24637 | LD (HL),56 | ||||||
| 24639 | LDIR | ||||||
| 24641 | LD A,0 | Signal demo mode. | |||||
| 24643 | LD (27403),A | ||||||
| 24646 | LD HL,140 | Initialise the title screen countdown timer. | |||||
| 24649 | LD (27400),HL | ||||||
| 24652 | LD DE,16544 | Print 'HUNGRY' in big letters. | |||||
| 24655 | LD HL,28303 | ||||||
| 24658 | LD BC,160 | ||||||
| 24661 | CALL 27982 | ||||||
| 24664 | LD DE,18560 | Print 'HORACE' in big letters. | |||||
| 24667 | LD HL,28463 | ||||||
| 24670 | LD BC,160 | ||||||
| 24673 | CALL 27982 | ||||||
| 24676 | LD A,(27403) | Pick up the game mode indicator. | |||||
| 24679 | PUSH AF | Save it briefly. | |||||
| 24680 | LD A,1 | Signal game mode (to force the copyright message to be printed). | |||||
| 24682 | LD (27403),A | ||||||
| 24685 | LD HL,20672 | This is the display file address for the copyright message. | |||||
| 24688 | CALL 27663 | Set HL' to the corresponding attribute file address (unnecessarily). | |||||
| 24691 | EX DE,HL | Transfer the display file address to DE. | |||||
| 24692 | LD HL,27303 | Print 'Copyright © 1982 Beam Software' and 'PRESS ANY KEY TO START PLAY'. | |||||
| 24695 | LD A,(HL) | ||||||
| 24696 | CP 255 | ||||||
| 24698 | JR Z,24706 | ||||||
| 24700 | INC HL | ||||||
| 24701 | CALL 27471 | ||||||
| 24704 | JR 24695 | ||||||
| 24706 | POP AF | Restore the game mode indicator. | |||||
| 24707 | LD (27403),A | ||||||
| 24710 | LD HL,22688 | Change the colour of the words 'HUNGRY HORACE' on the title screen. | |||||
| 24713 | LD DE,22689 | ||||||
| 24716 | LD BC,159 | ||||||
| 24719 | LD A,(HL) | ||||||
| 24720 | INC A | ||||||
| 24721 | AND 63 | ||||||
| 24723 | OR 56 | ||||||
| 24725 | LD (HL),A | ||||||
| 24726 | LDIR | ||||||
| 24728 | LD HL,22912 | ||||||
| 24731 | LD DE,22913 | ||||||
| 24734 | LD BC,159 | ||||||
| 24737 | LD A,(HL) | ||||||
| 24738 | INC A | ||||||
| 24739 | AND 63 | ||||||
| 24741 | OR 56 | ||||||
| 24743 | LD (HL),A | ||||||
| 24744 | LDIR | ||||||
| 24746 | CALL 27255 | Make the title screen sound effect. | |||||
| 24749 | LD HL,(27400) | Decrement the title screen countdown timer. | |||||
| 24752 | DEC HL | ||||||
| 24753 | LD (27400),HL | ||||||
| 24756 | LD A,H | Is it zero now? | |||||
| 24757 | OR L | ||||||
| 24758 | JR Z,24777 | Jump if so. | |||||
| 24760 | LD A,0 | Read the keyboard. | |||||
| 24762 | IN A,(254) | ||||||
| 24764 | AND 31 | Is a key being pressed? | |||||
| 24766 | CP 31 | ||||||
| 24768 | JR Z,24710 | Jump if not. | |||||
| 24770 | LD A,1 | Signal that a game (not demo mode) has started. | |||||
| 24772 | LD (27403),A | ||||||
| 24775 | JR 24777 | This instruction is redundant. | |||||
| 24777 | LD A,255 | Initialise the maze number. | |||||
| 24779 | LD (31843),A | ||||||
| 24782 | LD A,8 | Initialise the game speed parameter. | |||||
| 24784 | LD (31842),A | ||||||
| 24787 | LD A,3 | Initialise the number of lives remaining. | |||||
| 24789 | LD (31864),A | ||||||
| 24792 | LD HL,0 | Initialise the score. | |||||
| 24795 | LD (31859),HL | ||||||
| 24798 | LD A,0 | Initialise the active guard counter. | |||||
| 24800 | LD (27402),A | ||||||
| 24803 | LD (31863),A | Initialise the extra life indicator. | |||||
| 24806 | CALL 27170 | Initialise the guard countdown timers. | |||||
| 24809 | LD A,(31843) | Pick up the current maze number (0-3). | |||||
| 24812 | INC A | Is it 0, 1 or 2? | |||||
| 24813 | AND 252 | ||||||
| 24815 | JR Z,24828 | Jump if so. | |||||
| 24817 | LD A,(31842) | Decrement the game speed parameter (unless it's already 1). This increases the speed of the game. | |||||
| 24820 | DEC A | ||||||
| 24821 | JR NZ,24825 | ||||||
| 24823 | LD A,1 | ||||||
| 24825 | LD (31842),A | ||||||
| 24828 | LD A,(31843) | Increment the maze number. | |||||
| 24831 | INC A | ||||||
| 24832 | AND 3 | ||||||
| 24834 | LD (31843),A | ||||||
| 24837 | LD A,(31843) | Pick up the current maze number. | |||||
| 24840 | CP 0 | Is it maze 1? | |||||
| 24842 | JR NZ,24855 | Jump if not. | |||||
| 24844 | LD HL,28631 | Copy the tunnel offset and bell, initial guard and entrance locations for maze 1 to 28623. | |||||
| 24847 | CALL 27294 | ||||||
| 24850 | LD HL,29431 | Point HL at the layout data for maze 1. | |||||
| 24853 | JR 24896 | ||||||
| 24855 | CP 1 | Is it maze 2? | |||||
| 24857 | JR NZ,24870 | Jump if not. | |||||
| 24859 | LD HL,28639 | Copy the tunnel offset and bell, initial guard and entrance locations for maze 2 to 28623. | |||||
| 24862 | CALL 27294 | ||||||
| 24865 | LD HL,28663 | Point HL at the layout data for maze 2. | |||||
| 24868 | JR 24896 | ||||||
| 24870 | CP 2 | Is it maze 3? | |||||
| 24872 | JR NZ,24885 | Jump if not. | |||||
| 24874 | LD HL,28647 | Copy the tunnel offset and bell, initial guard and entrance locations for maze 3 to 28623. | |||||
| 24877 | CALL 27294 | ||||||
| 24880 | LD HL,30199 | Point HL at the layout data for maze 3. | |||||
| 24883 | JR 24896 | ||||||
| 24885 | LD HL,28655 | Copy the tunnel offset and bell, initial guard and entrance locations for maze 4 to 28623. | |||||
| 24888 | CALL 27294 | ||||||
| 24891 | LD HL,30967 | Point HL at the layout data for maze 4. | |||||
| 24894 | JR 24896 | ||||||
| 24896 | LD DE,16384 | Draw the current maze. | |||||
| 24899 | LD BC,768 | ||||||
| 24902 | CALL 27509 | ||||||
| 24905 | LD A,(27403) | Pick up the game mode indicator. | |||||
| 24908 | AND A | Is it demo mode? | |||||
| 24909 | JR Z,24932 | Jump if so. | |||||
| 24911 | LD HL,16384 | This is the display file address for 'PASSES SCORE BEST'. | |||||
| 24914 | CALL 27663 | Set HL' to the corresponding attribute file address (unnecessarily). | |||||
| 24917 | EX DE,HL | Transfer the display file address to DE. | |||||
| 24918 | LD HL,31815 | Print 'PASSES SCORE BEST'. | |||||
| 24921 | LD A,(HL) | ||||||
| 24922 | CP 255 | ||||||
| 24924 | JR Z,24975 | ||||||
| 24926 | INC HL | ||||||
| 24927 | CALL 27471 | ||||||
| 24930 | JR 24921 | ||||||
| 24932 | LD A,1 | Signal game mode (to force the 'DEMO MODE' text to be printed). | |||||
| 24934 | LD (27403),A | ||||||
| 24937 | LD HL,16384 | This is the display file address for 'DEMO MODE PRESS ANY KEY TO PLAY'. | |||||
| 24940 | CALL 27663 | Set HL' to the corresponding attribute file address (unnecessarily). | |||||
| 24943 | EX DE,HL | Transfer the display file address to DE. | |||||
| 24944 | LD HL,27367 | Print 'DEMO MODE PRESS ANY KEY TO PLAY'. | |||||
| 24947 | LD A,(HL) | ||||||
| 24948 | CP 255 | ||||||
| 24950 | JR Z,24958 | ||||||
| 24952 | INC HL | ||||||
| 24953 | CALL 27471 | ||||||
| 24956 | JR 24947 | ||||||
| 24958 | LD A,0 | Restore the game mode indicator to demo mode. | |||||
| 24960 | LD (27403),A | ||||||
| 24963 | LD HL,22528 | Make 'DEMO MODE' flash. | |||||
| 24966 | LD B,9 | ||||||
| 24968 | LD A,(HL) | ||||||
| 24969 | ADD A,128 | ||||||
| 24971 | LD (HL),A | ||||||
| 24972 | INC HL | ||||||
| 24973 | DJNZ 24968 | ||||||
| 24975 | LD HL,(28625) | Copy the bell location to 31940. | |||||
| 24978 | LD (31940),HL | ||||||
| 24981 | LD HL,16391 | This is the display file address for the number of lives remaining. | |||||
| 24984 | CALL 27663 | Set HL' to the corresponding attribute file address (unnecessarily). | |||||
| 24987 | LD A,(31864) | Pick up the number of lives remaining. | |||||
| 24990 | ADD A,"0" | Convert it to the ASCII code for the corresponding digit. | |||||
| 24992 | EX DE,HL | Transfer the display file address to DE. | |||||
| 24993 | CALL 27471 | Print the number of lives remaining. | |||||
| 24996 | LD HL,2000 | Initialise the lunch-drop countdown timer. | |||||
| 24999 | LD (31845),HL | ||||||
|
This entry point is used by the routine at 26426 after Horace has lost a life.
|
|||||||
| 25002 | LD HL,(31940) | Pick up the bell location. | |||||
| 25005 | LD A,H | Has Horace sounded the alarm? | |||||
| 25006 | OR L | ||||||
| 25007 | JR Z,25015 | Jump if so. | |||||
| 25009 | LD HL,(28625) | Reinitialise the bell location. | |||||
| 25012 | LD (31940),HL | ||||||
| 25015 | LD B,4 | There are four guards. | |||||
| 25017 | PUSH BC | Copy the guard's buffer into the temporary location (28088). | |||||
| 25018 | CALL 27199 | ||||||
| 25021 | POP BC | ||||||
| 25022 | PUSH BC | Save the guard counter. | |||||
| 25023 | SLA B | Point HL at one of the guard countdown timers at 28070. | |||||
| 25025 | LD C,B | ||||||
| 25026 | LD B,0 | ||||||
| 25028 | XOR A | ||||||
| 25029 | LD HL,28078 | ||||||
| 25032 | SBC HL,BC | ||||||
| 25034 | LD A,(HL) | Is this guard in play? | |||||
| 25035 | INC HL | ||||||
| 25036 | OR (HL) | ||||||
| 25037 | JR NZ,25044 | Jump if not. | |||||
| 25039 | LD HL,(28627) | Pick up the initial guard location for the current maze. | |||||
| 25042 | JR 25047 | ||||||
| 25044 | LD HL,(28629) | Pick up the bell location for the current maze. | |||||
| 25047 | LD (28088),HL | Initialise the guard's current and new locations. | |||||
| 25050 | LD (28092),HL | ||||||
| 25053 | LD HL,28095 | Clear the four maze background tiles in the temporary guard buffer. | |||||
| 25056 | LD C,4 | ||||||
| 25058 | LD (HL),62 | ||||||
| 25060 | INC HL | ||||||
| 25061 | LD B,8 | ||||||
| 25063 | LD (HL),0 | ||||||
| 25065 | INC HL | ||||||
| 25066 | DJNZ 25063 | ||||||
| 25068 | DEC C | ||||||
| 25069 | JR NZ,25058 | ||||||
| 25071 | CALL 27242 | Copy the guard's buffer back to the original location. | |||||
| 25074 | POP BC | Restore the guard counter to B. | |||||
| 25075 | DJNZ 25017 | Jump back to prepare the next guard. | |||||
| 25077 | LD HL,(28629) | Pick up Horace's initial location for the current maze. | |||||
| 25080 | LD (31851),HL | Initialise Horace's current and new locations. | |||||
| 25083 | LD (31853),HL | ||||||
| 25086 | LD A,1 | Initialise Horace's animation frame. | |||||
| 25088 | LD (31856),A | ||||||
| 25091 | LD A,(31842) | Initialise the sprite movement timer (using the value of the game speed parameter). | |||||
| 25094 | LD (31841),A | ||||||
| 25097 | LD HL,(31859) | Print the score and make a sound effect. | |||||
| 25100 | CALL 26055 | ||||||
| 25103 | LD HL,(31861) | Pick up the high score. | |||||
| 25106 | LD DE,16384 | Set DE to the display file address for the high score (in a roundabout way). | |||||
| 25109 | EX DE,HL | ||||||
| 25110 | LD BC,26 | ||||||
| 25113 | ADD HL,BC | ||||||
| 25114 | EX DE,HL | ||||||
| 25115 | CALL 27425 | Print the high score. | |||||
| 25118 | LD HL,0 | Initialise the guard panic timer. | |||||
| 25121 | LD (28078),HL | ||||||
| 25124 | LD A,57 | Initialise Horace's attribute byte (INK 1: PAPER 7). | |||||
| 25126 | LD (31857),A | ||||||
|
Here we enter the main loop.
|
|||||||
| 25129 | CALL 25167 | Read the keyboard and change Horace's sprite accordingly. | |||||
| 25132 | CALL 25399 | Move Horace and the guards. | |||||
| 25135 | CALL 25886 | Redraw the tiles behind Horace and the guards if they've moved. | |||||
| 25138 | CALL 26017 | Add to the score if Horace has eaten something. | |||||
| 25141 | CALL 26146 | Draw the guards. | |||||
| 25144 | CALL 26276 | Check whether Horace has run into a guard. | |||||
| 25147 | CALL 26657 | Draw Horace. | |||||
| 25150 | CALL 26730 | Draw the bell and check whether Horace has sounded the alarm. | |||||
| 25153 | CALL 26887 | Check whether a guard should drop his lunch. | |||||
| 25156 | CALL 26988 | Decrement the guard countdown timers. | |||||
| 25159 | CALL 27022 | Toggle the sound on/off if 'T' is pressed. | |||||
| 25162 | CALL 27044 | Ring the bell if necessary. | |||||
| 25165 | JR 25129 | Jump back to the start of the main loop. | |||||
| Prev: | Up: Map |