Prev: 655B Up: Map Next: 6622
65A1: Add to the score if Horace has eaten something
Called from the main loop at 6229.
65A1 LD A,($7C79) Pick up the tunnel timer.
65A4 AND A Is Horace in a tunnel?
65A5 RET NZ Return if so.
65A6 LD HL,($7C6D) Pick up Horace's new location.
65A9 CALL $6C20 Check the attribute bytes at this location.
65AC RET Z Return if there's nothing to eat there.
65AD CP $3C Has Horace run into a flower?
65AF JR NZ,$65BD Jump if not.
65B1 LD HL,($7C73) Add 10 to the score (Horace has eaten a flower).
65B4 LD BC,$000A
65B7 ADD HL,BC
65B8 LD ($7C73),HL
65BB JR $65C7
65BD LD HL,($7C73) Add 50 to the score (Horace has eaten a cherry or strawberry).
65C0 LD BC,$0032
65C3 ADD HL,BC
65C4 LD ($7C73),HL
This entry point is used by the routines at 6000 (when initialising a maze), 66A4 (when Horace has thrown the guards out of the park) and 686A (when Horace has sounded the alarm).
65C7 LD DE,$4000 Set DE to the display file address for the score (in a roundabout way).
65CA EX DE,HL
65CB LD BC,$000F
65CE ADD HL,BC
65CF EX DE,HL
65D0 CALL $6B21 Print the score.
65D3 LD HL,($7C73) Pick up the current score.
65D6 XOR A Clear the carry flag and set A=0.
65D7 LD BC,$2710 Perform trial subtractions of 10000 from the score.
65DA INC A
65DB SBC HL,BC
65DD JR NC,$65DA
65DF INC A This should be DEC A.
65E0 LD B,A Now B=INT(Score/10000)+2.
65E1 LD A,($7C77) Pick up the extra life indicator.
65E4 CP B Is it time to award an extra life?
65E5 JR Z,$6601 Jump if not.
65E7 LD A,B Update the extra life indicator.
65E8 LD ($7C77),A
65EB LD A,($7C78) Increment the number of lives.
65EE INC A
65EF LD ($7C78),A
65F2 LD HL,$4007 This is the display file address for the number of lives.
65F5 CALL $6C0F Set HL' to the corresponding attribute file address (unnecessarily).
65F8 LD A,($7C78) Pick up the number of lives remaining.
65FB 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.
65FD EX DE,HL Transfer the display file address to DE.
65FE CALL $6B4F Print the number of lives remaining.
Now make a sound effect.
6601 LD HL,$7C69 Pick up the sound on/off indicator.
6604 LD C,$10 Initialise C for the loop that follows.
6606 PUSH BC Save the loop counter (unnecessarily).
6607 LD B,C Set B equal to 8*C. This value determines the pitch.
6608 SLA B
660A SLA B
660C SLA B
660E PUSH BC Save the pitch parameter briefly.
660F LD A,$1F Flip the speaker off if the sound on/off indicator is on, or on otherwise.
6611 AND (HL)
6612 OUT ($FE),A
6614 DJNZ $6614 Produce a short delay.
6616 LD A,$07 Flip the speaker on.
6618 OUT ($FE),A
661A POP BC Restore the pitch parameter to B.
661B DJNZ $661B Produce another short delay.
661D POP BC Restore the loop counter to C (unnecessarily).
661E DEC C Finished yet?
661F JR NZ,$6606 Jump back if not.
6621 RET
Prev: 655B Up: Map Next: 6622