Prev: 63DA Up: Map Next: 655B
651E: Redraw the tiles behind Horace and the guards if they've moved
Called from the main loop at 6229.
651E LD HL,($7C6D) Pick up Horace's new location.
6521 LD DE,($7C6B) Pick up Horace's current location.
6525 XOR A Clear the carry flag.
6526 SBC HL,DE Subtract Horace's current location from his new location.
6528 LD A,H Has Horace moved?
6529 OR L
652A JR Z,$653A Jump if not.
652C LD HL,($7C6B) Pick up Horace's current location.
652F LD DE,$7F87 Point DE at the graphic data for the blank sprite.
6532 CALL $6C0F Set HL' to the attribute file address for Horace's location.
6535 LD C,$3E This is the attribute byte for the blank sprite (INK 6: PAPER 7).
6537 CALL $6BD6 Draw the blank sprite over Horace's current location.
Now consider the guards.
653A LD HL,$6DAC Point HL at the last of the guard countdown timers.
653D LD B,$01 B will count the guards: 1, 2, 3 and 4.
653F PUSH BC Save the guard counter.
6540 LD A,(HL) Set the zero flag if this guard is in play.
6541 INC HL
6542 OR (HL)
6543 DEC HL Point HL at the next guard's countdown timer.
6544 DEC HL
6545 DEC HL
6546 PUSH HL Save the guard countdown timer pointer briefly.
6547 JR NZ,$6552 Jump if this guard is not in play yet.
6549 CALL $6A3F Copy the guard's buffer to the temporary location (6DB8).
654C CALL $655B Redraw the tiles behind the guard if he's moved.
654F CALL $6A6A Copy the guard's buffer back to its original location.
6552 POP HL Restore the guard countdown timer pointer to HL.
6553 POP BC Restore the guard counter to B.
6554 INC B Next guard.
6555 LD A,B Copy the guard counter to A.
6556 CP $05 Have we done all four guards yet?
6558 JR NZ,$653F If not, jump back to do the next one.
655A RET
Prev: 63DA Up: Map Next: 655B