![]() |
Routines |
| Prev: 26173 | Up: Map | Next: 26426 |
|
Called from the main loop at 25129.
|
||||
| 26276 | LD HL,(31853) | Pick up Horace's new location. | ||
| 26279 | CALL 27680 | Check the attribute bytes at Horace's new location. | ||
| 26282 | CP 59 | Has Horace run into a guard? | ||
| 26284 | RET NZ | Return if not. | ||
| 26285 | LD HL,(28078) | Pick up the guard panic timer. | ||
| 26288 | LD A,H | Are the guards panicking at the moment? | ||
| 26289 | OR L | |||
| 26290 | JP Z,26426 | Jump if not. | ||
| 26293 | LD HL,(31859) | Add 100 to the score (Horace has thrown the guards out of the park). | ||
| 26296 | LD BC,100 | |||
| 26299 | ADD HL,BC | |||
| 26300 | LD (31859),HL | |||
| 26303 | CALL 26055 | Print the score. | ||
| 26306 | LD HL,0 | Reset the guard panic timer. | ||
| 26309 | LD (28078),HL | |||
|
Now make the 'caught a guard' sound effect.
|
||||
| 26312 | LD HL,31849 | Pick up the sound on/off indicator. | ||
| 26315 | LD C,15 | Initialise C for the loop that follows. | ||
| 26317 | PUSH BC | Save the loop counter (unnecessarily). | ||
| 26318 | LD A,C | Set B and E equal to 8*(15-C). This value determines the pitch. | ||
| 26319 | XOR 15 | |||
| 26321 | LD B,A | |||
| 26322 | SLA B | |||
| 26324 | SLA B | |||
| 26326 | SLA B | |||
| 26328 | LD E,B | |||
| 26329 | LD D,8 | This value determines the duration. | ||
| 26331 | LD B,E | Produce a sound (if the sound on/off indicator is on) with pitch and duration determined by E and D. | ||
| 26332 | LD A,31 | |||
| 26334 | AND (HL) | |||
| 26335 | OUT (254),A | |||
| 26337 | LD A,(IX+0) | |||
| 26340 | LD (IX+0),A | |||
| 26343 | DJNZ 26337 | |||
| 26345 | LD A,7 | |||
| 26347 | OUT (254),A | |||
| 26349 | LD B,E | |||
| 26350 | LD A,(IX+0) | |||
| 26353 | LD (IX+0),A | |||
| 26356 | DJNZ 26350 | |||
| 26358 | DEC D | |||
| 26359 | JR NZ,26331 | |||
| 26361 | POP BC | Restore the loop counter to C (unnecessarily). | ||
| 26362 | DEC C | Finished yet? | ||
| 26363 | JR NZ,26317 | Jump back if not. | ||
|
Now we throw the guards out of the park.
|
||||
| 26365 | LD HL,28070 | Point HL at the first guard countdown timer. | ||
| 26368 | LD B,4 | There are four guards. | ||
| 26370 | PUSH BC | Save the guard counter. | ||
| 26371 | LD A,(HL) | Set the zero flag if this guard is already in play. | ||
| 26372 | INC HL | |||
| 26373 | OR (HL) | |||
| 26374 | PUSH HL | Save the guard countdown timer pointer. | ||
| 26375 | JR NZ,26421 | Jump if this guard has not appeared yet. | ||
| 26377 | CALL 27199 | Copy this guard's buffer into the temporary location (28088). | ||
| 26380 | CALL 25960 | Redraw the tiles behind the guard. | ||
| 26383 | LD HL,(31853) | Pick up Horace's new location. | ||
| 26386 | CALL 27680 | Check the attribute bytes at this location. | ||
| 26389 | CP 59 | Set the zero flag if there's a guard here. (This instruction is redundant.) | ||
| 26391 | LD HL,(28629) | Pick up the entrance location for the current maze. | ||
| 26394 | LD (28088),HL | Make this the guard's new location. | ||
| 26397 | LD (28092),HL | |||
| 26400 | CALL 27752 | Copy the maze background tiles into the temporary guard buffer. | ||
| 26403 | LD A,1 | Initialise the guard's animation frame. | ||
| 26405 | LD (28090),A | |||
| 26408 | LD A,90 | Initialise the guard's return delay counter. | ||
| 26410 | LD (28094),A | |||
| 26413 | JR 26418 | |||
| 26415 | CALL 26173 | Draw the guard (this instruction is never executed). | ||
| 26418 | CALL 27242 | Copy the guard's buffer back to the original location. | ||
| 26421 | POP HL | Restore the guard countdown timer pointer to HL. | ||
| 26422 | POP BC | Restore the guard counter to B. | ||
| 26423 | DJNZ 26370 | Jump back to deal with the next guard. | ||
| 26425 | RET | |||
| Prev: 26173 | Up: Map | Next: 26426 |