Prev: 25947 Up: Map Next: 26146
26017: Add to the score if Horace has eaten something
Called from the main loop at 25129.
26017 LD A,(31865) Pick up the tunnel timer.
26020 AND A Is Horace in a tunnel?
26021 RET NZ Return if so.
26022 LD HL,(31853) Pick up Horace's new location.
26025 CALL 27680 Check the attribute bytes at this location.
26028 RET Z Return if there's nothing to eat there.
26029 CP 60 Has Horace run into a flower?
26031 JR NZ,26045 Jump if not.
26033 LD HL,(31859) Add 10 to the score (Horace has eaten a flower).
26036 LD BC,10
26039 ADD HL,BC
26040 LD (31859),HL
26043 JR 26055
26045 LD HL,(31859) Add 50 to the score (Horace has eaten a cherry or strawberry).
26048 LD BC,50
26051 ADD HL,BC
26052 LD (31859),HL
This entry point is used by the routines at 24576 (when initialising a maze), 26276 (when Horace has thrown the guards out of the park) and 26730 (when Horace has sounded the alarm).
26055 LD DE,16384 Set DE to the display file address for the score (in a roundabout way).
26058 EX DE,HL
26059 LD BC,15
26062 ADD HL,BC
26063 EX DE,HL
26064 CALL 27425 Print the score.
26067 LD HL,(31859) Pick up the current score.
26070 XOR A Clear the carry flag and set A=0.
26071 LD BC,10000 Perform trial subtractions of 10000 from the score.
26074 INC A
26075 SBC HL,BC
26077 JR NC,26074
26079 INC A This should be DEC A.
26080 LD B,A Now B=INT(Score/10000)+2.
26081 LD A,(31863) Pick up the extra life indicator.
26084 CP B Is it time to award an extra life?
26085 JR Z,26113 Jump if not.
26087 LD A,B Update the extra life indicator.
26088 LD (31863),A
26091 LD A,(31864) Increment the number of lives.
26094 INC A
26095 LD (31864),A
26098 LD HL,16391 This is the display file address for the number of lives.
26101 CALL 27663 Set HL' to the corresponding attribute file address (unnecessarily).
26104 LD A,(31864) Pick up the number of lives remaining.
26107 ADD A,"0" Convert it into an ASCII code. This does not work if there are 10 or more lives remaining, which is a bug.
26109 EX DE,HL Transfer the display file address to DE.
26110 CALL 27471 Print the number of lives remaining.
Now make a sound effect.
26113 LD HL,31849 Pick up the sound on/off indicator.
26116 LD C,16 Initialise C for the loop that follows.
26118 PUSH BC Save the loop counter (unnecessarily).
26119 LD B,C Set B equal to 8*C. This value determines the pitch.
26120 SLA B
26122 SLA B
26124 SLA B
26126 PUSH BC Save the pitch parameter briefly.
26127 LD A,31 Flip the speaker off if the sound on/off indicator is on, or on otherwise.
26129 AND (HL)
26130 OUT (254),A
26132 DJNZ 26132 Produce a short delay.
26134 LD A,7 Flip the speaker on.
26136 OUT (254),A
26138 POP BC Restore the pitch parameter to B.
26139 DJNZ 26139 Produce another short delay.
26141 POP BC Restore the loop counter to C (unnecessarily).
26142 DEC C Finished yet?
26143 JR NZ,26118 Jump back if not.
26145 RET
Prev: 25947 Up: Map Next: 26146