Up: Map Next: 6229
6000: The game has just loaded
6000 DI Disable interrupts.
6001 LD A,($5C78) Initialise the pseudo-random number address.
6004 LD L,A
6005 AND $1F
6007 LD H,A
6008 LD A,(HL)
6009 LD L,A
600A AND $1F
600C LD H,A
600D LD ($7C67),HL
6010 LD HL,$7C6A Initialise the 'T' pressed indicator to 'off' (bit 4 set).
6013 LD (HL),$10
6015 LD HL,$7C69 Initialise the sound indicator to 'on'.
6018 LD (HL),$1F
This entry point is used by the routine at 673A when a game has ended.
601A LD HL,$5800 INK 7: PAPER 7
601D LD DE,$5801
6020 LD BC,$02FF
6023 LD (HL),$3F
6025 LDIR
6027 LD HL,$4000 Clear the display file.
602A LD DE,$4001
602D LD BC,$17FF
6030 LD (HL),$00
6032 LDIR
6034 LD HL,$5800 INK 0: PAPER 7
6037 LD DE,$5801
603A LD BC,$02FF
603D LD (HL),$38
603F LDIR
6041 LD A,$00 Signal demo mode.
6043 LD ($6B0B),A
6046 LD HL,$008C Initialise the title screen countdown timer.
6049 LD ($6B08),HL
604C LD DE,$40A0 Print 'HUNGRY' in big letters.
604F LD HL,$6E8F
6052 LD BC,$00A0
6055 CALL $6D4E
6058 LD DE,$4880 Print 'HORACE' in big letters.
605B LD HL,$6F2F
605E LD BC,$00A0
6061 CALL $6D4E
6064 LD A,($6B0B) Pick up the game mode indicator.
6067 PUSH AF Save it briefly.
6068 LD A,$01 Signal game mode (to force the copyright message to be printed).
606A LD ($6B0B),A
606D LD HL,$50C0 This is the display file address for the copyright message.
6070 CALL $6C0F Set HL' to the corresponding attribute file address (unnecessarily).
6073 EX DE,HL Transfer the display file address to DE.
6074 LD HL,$6AA7 Print 'Copyright © 1982 Beam Software' and 'PRESS ANY KEY TO START PLAY'.
6077 LD A,(HL)
6078 CP $FF
607A JR Z,$6082
607C INC HL
607D CALL $6B4F
6080 JR $6077
6082 POP AF Restore the game mode indicator.
6083 LD ($6B0B),A
The following loop cycles the colour of the words 'HUNGRY HORACE' and plays a sound effect, either 140 times or until a key is pressed.
6086 LD HL,$58A0 Change the colour of the words 'HUNGRY HORACE' on the title screen.
6089 LD DE,$58A1
608C LD BC,$009F
608F LD A,(HL)
6090 INC A
6091 AND $3F
6093 OR $38
6095 LD (HL),A
6096 LDIR
6098 LD HL,$5980
609B LD DE,$5981
609E LD BC,$009F
60A1 LD A,(HL)
60A2 INC A
60A3 AND $3F
60A5 OR $38
60A7 LD (HL),A
60A8 LDIR
60AA CALL $6A77 Make the title screen sound effect.
60AD LD HL,($6B08) Decrement the title screen countdown timer.
60B0 DEC HL
60B1 LD ($6B08),HL
60B4 LD A,H Is it zero now?
60B5 OR L
60B6 JR Z,$60C9 Jump if so.
60B8 LD A,$00 Read the keyboard.
60BA IN A,($FE)
60BC AND $1F Is a key being pressed?
60BE CP $1F
60C0 JR Z,$6086 Jump if not.
60C2 LD A,$01 Signal that a game (not demo mode) has started.
60C4 LD ($6B0B),A
60C7 JR $60C9 This instruction is redundant.
60C9 LD A,$FF Initialise the maze number.
60CB LD ($7C63),A
60CE LD A,$08 Initialise the game speed parameter.
60D0 LD ($7C62),A
60D3 LD A,$03 Initialise the number of lives remaining.
60D5 LD ($7C78),A
60D8 LD HL,$0000 Initialise the score.
60DB LD ($7C73),HL
60DE LD A,$00 Initialise the active guard counter.
60E0 LD ($6B0A),A
60E3 LD ($7C77),A Initialise the extra life indicator.
60E6 CALL $6A22 Initialise the guard countdown timers.
This entry point is used when moving from one maze to the next by the routines at 673A (in demo mode) and 6A1E (in game mode).
60E9 LD A,($7C63) Pick up the current maze number (0-3).
60EC INC A Is it 0, 1 or 2?
60ED AND $FC
60EF JR Z,$60FC Jump if so.
60F1 LD A,($7C62) Decrement the game speed parameter (unless it's already 1). This increases the speed of the game.
60F4 DEC A
60F5 JR NZ,$60F9
60F7 LD A,$01
60F9 LD ($7C62),A
60FC LD A,($7C63) Increment the maze number.
60FF INC A
6100 AND $03
6102 LD ($7C63),A
6105 LD A,($7C63) Pick up the current maze number.
6108 CP $00 Is it maze 1?
610A JR NZ,$6117 Jump if not.
610C LD HL,$6FD7 Copy the tunnel offset and bell, initial guard and entrance locations for maze 1 to 6FCF.
610F CALL $6A9E
6112 LD HL,$72F7 Point HL at the layout data for maze 1.
6115 JR $6140
6117 CP $01 Is it maze 2?
6119 JR NZ,$6126 Jump if not.
611B LD HL,$6FDF Copy the tunnel offset and bell, initial guard and entrance locations for maze 2 to 6FCF.
611E CALL $6A9E
6121 LD HL,$6FF7 Point HL at the layout data for maze 2.
6124 JR $6140
6126 CP $02 Is it maze 3?
6128 JR NZ,$6135 Jump if not.
612A LD HL,$6FE7 Copy the tunnel offset and bell, initial guard and entrance locations for maze 3 to 6FCF.
612D CALL $6A9E
6130 LD HL,$75F7 Point HL at the layout data for maze 3.
6133 JR $6140
6135 LD HL,$6FEF Copy the tunnel offset and bell, initial guard and entrance locations for maze 4 to 6FCF.
6138 CALL $6A9E
613B LD HL,$78F7 Point HL at the layout data for maze 4.
613E JR $6140
6140 LD DE,$4000 Draw the current maze.
6143 LD BC,$0300
6146 CALL $6B75
6149 LD A,($6B0B) Pick up the game mode indicator.
614C AND A Is it demo mode?
614D JR Z,$6164 Jump if so.
614F LD HL,$4000 This is the display file address for 'PASSES   SCORE       BEST'.
6152 CALL $6C0F Set HL' to the corresponding attribute file address (unnecessarily).
6155 EX DE,HL Transfer the display file address to DE.
6156 LD HL,$7C47 Print 'PASSES   SCORE       BEST'.
6159 LD A,(HL)
615A CP $FF
615C JR Z,$618F
615E INC HL
615F CALL $6B4F
6162 JR $6159
6164 LD A,$01 Signal game mode (to force the 'DEMO MODE' text to be printed).
6166 LD ($6B0B),A
6169 LD HL,$4000 This is the display file address for 'DEMO MODE  PRESS ANY KEY TO PLAY'.
616C CALL $6C0F Set HL' to the corresponding attribute file address (unnecessarily).
616F EX DE,HL Transfer the display file address to DE.
6170 LD HL,$6AE7 Print 'DEMO MODE  PRESS ANY KEY TO PLAY'.
6173 LD A,(HL)
6174 CP $FF
6176 JR Z,$617E
6178 INC HL
6179 CALL $6B4F
617C JR $6173
617E LD A,$00 Restore the game mode indicator to demo mode.
6180 LD ($6B0B),A
6183 LD HL,$5800 Make 'DEMO MODE' flash.
6186 LD B,$09
6188 LD A,(HL)
6189 ADD A,$80
618B LD (HL),A
618C INC HL
618D DJNZ $6188
618F LD HL,($6FD1) Copy the bell location to 7CC4.
6192 LD ($7CC4),HL
6195 LD HL,$4007 This is the display file address for the number of lives remaining.
6198 CALL $6C0F Set HL' to the corresponding attribute file address (unnecessarily).
619B LD A,($7C78) Pick up the number of lives remaining.
619E ADD A,"0" Convert it to the ASCII code for the corresponding digit.
61A0 EX DE,HL Transfer the display file address to DE.
61A1 CALL $6B4F Print the number of lives remaining.
61A4 LD HL,$07D0 Initialise the lunch-drop countdown timer.
61A7 LD ($7C65),HL
This entry point is used by the routine at 673A after Horace has lost a life.
61AA LD HL,($7CC4) Pick up the bell location.
61AD LD A,H Has Horace sounded the alarm?
61AE OR L
61AF JR Z,$61B7 Jump if so.
61B1 LD HL,($6FD1) Reinitialise the bell location.
61B4 LD ($7CC4),HL
61B7 LD B,$04 There are four guards.
61B9 PUSH BC Copy the guard's buffer into the temporary location (6DB8).
61BA CALL $6A3F
61BD POP BC
61BE PUSH BC Save the guard counter.
61BF SLA B Point HL at one of the guard countdown timers at 6DA6.
61C1 LD C,B
61C2 LD B,$00
61C4 XOR A
61C5 LD HL,$6DAE
61C8 SBC HL,BC
61CA LD A,(HL) Is this guard in play?
61CB INC HL
61CC OR (HL)
61CD JR NZ,$61D4 Jump if not.
61CF LD HL,($6FD3) Pick up the initial guard location for the current maze.
61D2 JR $61D7
61D4 LD HL,($6FD5) Pick up the bell location for the current maze.
61D7 LD ($6DB8),HL Initialise the guard's current and new locations.
61DA LD ($6DBC),HL
61DD LD HL,$6DBF Clear the four maze background tiles in the temporary guard buffer.
61E0 LD C,$04
61E2 LD (HL),$3E
61E4 INC HL
61E5 LD B,$08
61E7 LD (HL),$00
61E9 INC HL
61EA DJNZ $61E7
61EC DEC C
61ED JR NZ,$61E2
61EF CALL $6A6A Copy the guard's buffer back to the original location.
61F2 POP BC Restore the guard counter to B.
61F3 DJNZ $61B9 Jump back to prepare the next guard.
61F5 LD HL,($6FD5) Pick up Horace's initial location for the current maze.
61F8 LD ($7C6B),HL Initialise Horace's current and new locations.
61FB LD ($7C6D),HL
61FE LD A,$01 Initialise Horace's animation frame.
6200 LD ($7C70),A
6203 LD A,($7C62) Initialise the sprite movement timer (using the value of the game speed parameter).
6206 LD ($7C61),A
6209 LD HL,($7C73) Print the score and make a sound effect.
620C CALL $65C7
620F LD HL,($7C75) Pick up the high score.
6212 LD DE,$4000 Set DE to the display file address for the high score (in a roundabout way).
6215 EX DE,HL
6216 LD BC,$001A
6219 ADD HL,BC
621A EX DE,HL
621B CALL $6B21 Print the high score.
621E LD HL,$0000 Initialise the guard panic timer.
6221 LD ($6DAE),HL
6224 LD A,$39 Initialise Horace's attribute byte (INK 1: PAPER 7).
6226 LD ($7C71),A
This routine continues into the main loop at 6229.
Up: Map Next: 6229