Prev: 26657 Up: Map Next: 26887
26730: Draw the bell and check whether Horace has sounded the alarm
Called from the main loop at 25129.
26730 LD HL,(31851) Pick up Horace's current location.
26733 LD BC,(31940) Pick up the location of the bell in the current maze.
26737 LD A,B Has Horace already sounded the alarm?
26738 OR C
26739 RET Z Return if so.
26740 AND A Clear the carry flag. (This instruction is redundant.)
26741 SBC HL,BC Subtract the bell's location from Horace's.
26743 LD A,H Is Horace in exactly the same location as the bell?
26744 OR L
26745 JR Z,26814 Jump if so.
26747 INC HL Is Horace one space to the left of the bell?
26748 LD A,H
26749 OR L
26750 JR Z,26814 Jump if so.
26752 DEC HL Is Horace one space to the right of the bell?
26753 DEC HL
26754 LD A,H
26755 OR L
26756 JR Z,26814 Jump if so.
26758 LD BC,33 Is Horace one space above the bell?
26761 ADD HL,BC
26762 LD A,H
26763 OR L
26764 JR Z,26814 Jump if so.
26766 XOR A Clear the carry flag. (This instruction is redundant.)
26767 LD BC,65 Is Horace one space below the bell?
26770 SBC HL,BC
26772 LD A,H
26773 OR L
26774 JR Z,26814 Jump if so.
Horace has not sounded the alarm.
26776 LD HL,(31940) Pick up the location of the bell in the current maze.
26779 LD A,(31942) Increment the bell's animation frame counter.
26782 INC A
26783 LD (31942),A
26786 AND 56 Keep only bits 3, 4 and 5.
26788 CP 31 Is the result 30 or less (i.e. bit 5 reset)?
26790 JR C,26794 Jump if so.
26792 XOR 56 Flip bits 3 and 4, and reset bit 5.
26794 RLCA BC=4*A.
26795 RLCA
26796 LD C,A
26797 LD B,0
26799 LD DE,32519 This is the base address of the graphic data for the bell.
26802 EX DE,HL Point DE at the graphic data for the appropriate bell sprite.
26803 ADD HL,BC
26804 EX DE,HL
26805 CALL 27663 Set HL' to the attribute file address of the bell's location.
26808 LD C,58 This is the attribute byte (INK 2: PAPER 7).
26810 CALL 27606 Draw the bell.
26813 RET
Horace has sounded the alarm.
26814 LD HL,0 Clear the bell location to indicate that Horace has sounded the alarm.
26817 LD (31940),HL
26820 LD DE,32647 Point DE at the graphic data for the blank sprite.
26823 LD HL,(28625) Pick up the bell location for the current maze.
26826 CALL 27663 Set HL' to the corresponding attribute file address.
26829 LD C,62 This is the attribute byte (INK 6: PAPER 7).
26831 CALL 27606 Draw the blank sprite where the bell was.
26834 CALL 26657 Draw Horace.
26837 LD HL,(31859) Add 60 to the score.
26840 LD BC,60
26843 ADD HL,BC
26844 LD (31859),HL
26847 CALL 26055 Print the new score and make a sound effect.
26850 LD A,(31842) Pick up the game speed parameter in A.
26853 LD L,0 HL=128*A.
26855 LD H,A
26856 SRA H
26858 RR L
26860 LD (28078),HL Initialise the guard panic timer to this value.
26863 LD A,(28090) Update the animation frame in the temporary guard buffer; these instructions are redundant and have no effect on any of the guards.
26866 ADD A,2
26868 AND 3
26870 LD (28090),A
26873 LD HL,(31859) Add 150 to the score.
26876 LD BC,150
26879 ADD HL,BC
26880 LD (31859),HL
26883 CALL 26055 Print the new score and make a sound effect.
26886 RET
Prev: 26657 Up: Map Next: 26887