![]() |
Routines |
| Prev: 6821 | Up: Map | Next: 6907 |
|
Called from the main loop at 6229.
|
||||
| 686A | LD HL,($7C6B) | Pick up Horace's current location. | ||
| 686D | LD BC,($7CC4) | Pick up the location of the bell in the current maze. | ||
| 6871 | LD A,B | Has Horace already sounded the alarm? | ||
| 6872 | OR C | |||
| 6873 | RET Z | Return if so. | ||
| 6874 | AND A | Clear the carry flag. (This instruction is redundant.) | ||
| 6875 | SBC HL,BC | Subtract the bell's location from Horace's. | ||
| 6877 | LD A,H | Is Horace in exactly the same location as the bell? | ||
| 6878 | OR L | |||
| 6879 | JR Z,$68BE | Jump if so. | ||
| 687B | INC HL | Is Horace one space to the left of the bell? | ||
| 687C | LD A,H | |||
| 687D | OR L | |||
| 687E | JR Z,$68BE | Jump if so. | ||
| 6880 | DEC HL | Is Horace one space to the right of the bell? | ||
| 6881 | DEC HL | |||
| 6882 | LD A,H | |||
| 6883 | OR L | |||
| 6884 | JR Z,$68BE | Jump if so. | ||
| 6886 | LD BC,$0021 | Is Horace one space above the bell? | ||
| 6889 | ADD HL,BC | |||
| 688A | LD A,H | |||
| 688B | OR L | |||
| 688C | JR Z,$68BE | Jump if so. | ||
| 688E | XOR A | Clear the carry flag. (This instruction is redundant.) | ||
| 688F | LD BC,$0041 | Is Horace one space below the bell? | ||
| 6892 | SBC HL,BC | |||
| 6894 | LD A,H | |||
| 6895 | OR L | |||
| 6896 | JR Z,$68BE | Jump if so. | ||
|
Horace has not sounded the alarm.
|
||||
| 6898 | LD HL,($7CC4) | Pick up the location of the bell in the current maze. | ||
| 689B | LD A,($7CC6) | Increment the bell's animation frame counter. | ||
| 689E | INC A | |||
| 689F | LD ($7CC6),A | |||
| 68A2 | AND $38 | Keep only bits 3, 4 and 5. | ||
| 68A4 | CP $1F | Is the result 30 or less (i.e. bit 5 reset)? | ||
| 68A6 | JR C,$68AA | Jump if so. | ||
| 68A8 | XOR $38 | Flip bits 3 and 4, and reset bit 5. | ||
| 68AA | RLCA | BC=4*A. | ||
| 68AB | RLCA | |||
| 68AC | LD C,A | |||
| 68AD | LD B,$00 | |||
| 68AF | LD DE,$7F07 | This is the base address of the graphic data for the bell. | ||
| 68B2 | EX DE,HL | Point DE at the graphic data for the appropriate bell sprite. | ||
| 68B3 | ADD HL,BC | |||
| 68B4 | EX DE,HL | |||
| 68B5 | CALL $6C0F | Set HL' to the attribute file address of the bell's location. | ||
| 68B8 | LD C,$3A | This is the attribute byte (INK 2: PAPER 7). | ||
| 68BA | CALL $6BD6 | Draw the bell. | ||
| 68BD | RET | |||
|
Horace has sounded the alarm.
|
||||
| 68BE | LD HL,$0000 | Clear the bell location to indicate that Horace has sounded the alarm. | ||
| 68C1 | LD ($7CC4),HL | |||
| 68C4 | LD DE,$7F87 | Point DE at the graphic data for the blank sprite. | ||
| 68C7 | LD HL,($6FD1) | Pick up the bell location for the current maze. | ||
| 68CA | CALL $6C0F | Set HL' to the corresponding attribute file address. | ||
| 68CD | LD C,$3E | This is the attribute byte (INK 6: PAPER 7). | ||
| 68CF | CALL $6BD6 | Draw the blank sprite where the bell was. | ||
| 68D2 | CALL $6821 | Draw Horace. | ||
| 68D5 | LD HL,($7C73) | Add 60 to the score. | ||
| 68D8 | LD BC,$003C | |||
| 68DB | ADD HL,BC | |||
| 68DC | LD ($7C73),HL | |||
| 68DF | CALL $65C7 | Print the new score and make a sound effect. | ||
| 68E2 | LD A,($7C62) | Pick up the game speed parameter in A. | ||
| 68E5 | LD L,$00 | HL=128*A. | ||
| 68E7 | LD H,A | |||
| 68E8 | SRA H | |||
| 68EA | RR L | |||
| 68EC | LD ($6DAE),HL | Initialise the guard panic timer to this value. | ||
| 68EF | LD A,($6DBA) | Update the animation frame in the temporary guard buffer; these instructions are redundant and have no effect on any of the guards. | ||
| 68F2 | ADD A,$02 | |||
| 68F4 | AND $03 | |||
| 68F6 | LD ($6DBA),A | |||
| 68F9 | LD HL,($7C73) | Add 150 to the score. | ||
| 68FC | LD BC,$0096 | |||
| 68FF | ADD HL,BC | |||
| 6900 | LD ($7C73),HL | |||
| 6903 | CALL $65C7 | Print the new score and make a sound effect. | ||
| 6906 | RET | |||
| Prev: 6821 | Up: Map | Next: 6907 |