Routines |
Prev: 663D | Up: Map | Next: 673A |
Called from the main loop at 6229.
|
||||
66A4 | LD HL,($7C6D) | Pick up Horace's new location. | ||
66A7 | CALL $6C20 | Check the attribute bytes at Horace's new location. | ||
66AA | CP $3B | Has Horace run into a guard? | ||
66AC | RET NZ | Return if not. | ||
66AD | LD HL,($6DAE) | Pick up the guard panic timer. | ||
66B0 | LD A,H | Are the guards panicking at the moment? | ||
66B1 | OR L | |||
66B2 | JP Z,$673A | Jump if not. | ||
66B5 | LD HL,($7C73) | Add 100 to the score (Horace has thrown the guards out of the park). | ||
66B8 | LD BC,$0064 | |||
66BB | ADD HL,BC | |||
66BC | LD ($7C73),HL | |||
66BF | CALL $65C7 | Print the score. | ||
66C2 | LD HL,$0000 | Reset the guard panic timer. | ||
66C5 | LD ($6DAE),HL | |||
Now make the 'caught a guard' sound effect.
|
||||
66C8 | LD HL,$7C69 | Pick up the sound on/off indicator. | ||
66CB | LD C,$0F | Initialise C for the loop that follows. | ||
66CD | PUSH BC | Save the loop counter (unnecessarily). | ||
66CE | LD A,C | Set B and E equal to 8*(15-C). This value determines the pitch. | ||
66CF | XOR $0F | |||
66D1 | LD B,A | |||
66D2 | SLA B | |||
66D4 | SLA B | |||
66D6 | SLA B | |||
66D8 | LD E,B | |||
66D9 | LD D,$08 | This value determines the duration. | ||
66DB | LD B,E | Produce a sound (if the sound on/off indicator is on) with pitch and duration determined by E and D. | ||
66DC | LD A,$1F | |||
66DE | AND (HL) | |||
66DF | OUT ($FE),A | |||
66E1 | LD A,(IX+$00) | |||
66E4 | LD (IX+$00),A | |||
66E7 | DJNZ $66E1 | |||
66E9 | LD A,$07 | |||
66EB | OUT ($FE),A | |||
66ED | LD B,E | |||
66EE | LD A,(IX+$00) | |||
66F1 | LD (IX+$00),A | |||
66F4 | DJNZ $66EE | |||
66F6 | DEC D | |||
66F7 | JR NZ,$66DB | |||
66F9 | POP BC | Restore the loop counter to C (unnecessarily). | ||
66FA | DEC C | Finished yet? | ||
66FB | JR NZ,$66CD | Jump back if not. | ||
Now we throw the guards out of the park.
|
||||
66FD | LD HL,$6DA6 | Point HL at the first guard countdown timer. | ||
6700 | LD B,$04 | There are four guards. | ||
6702 | PUSH BC | Save the guard counter. | ||
6703 | LD A,(HL) | Set the zero flag if this guard is already in play. | ||
6704 | INC HL | |||
6705 | OR (HL) | |||
6706 | PUSH HL | Save the guard countdown timer pointer. | ||
6707 | JR NZ,$6735 | Jump if this guard has not appeared yet. | ||
6709 | CALL $6A3F | Copy this guard's buffer into the temporary location (6DB8). | ||
670C | CALL $6568 | Redraw the tiles behind the guard. | ||
670F | LD HL,($7C6D) | Pick up Horace's new location. | ||
6712 | CALL $6C20 | Check the attribute bytes at this location. | ||
6715 | CP $3B | Set the zero flag if there's a guard here. (This instruction is redundant.) | ||
6717 | LD HL,($6FD5) | Pick up the entrance location for the current maze. | ||
671A | LD ($6DB8),HL | Make this the guard's new location. | ||
671D | LD ($6DBC),HL | |||
6720 | CALL $6C68 | Copy the maze background tiles into the temporary guard buffer. | ||
6723 | LD A,$01 | Initialise the guard's animation frame. | ||
6725 | LD ($6DBA),A | |||
6728 | LD A,$5A | Initialise the guard's return delay counter. | ||
672A | LD ($6DBE),A | |||
672D | JR $6732 | |||
672F | CALL $663D | Draw the guard (this instruction is never executed). | ||
6732 | CALL $6A6A | Copy the guard's buffer back to the original location. | ||
6735 | POP HL | Restore the guard countdown timer pointer to HL. | ||
6736 | POP BC | Restore the guard counter to B. | ||
6737 | DJNZ $6702 | Jump back to deal with the next guard. | ||
6739 | RET |
Prev: 663D | Up: Map | Next: 673A |