Prev: 76BC Up: Map Next: 76F9
76DD: Check whether Sam is standing next to a ringing telephone
Continues from the routine at 749E. On entry, E holds the identifier of the telephone that Sam is standing next to. Returns with the zero flag always reset, and the carry flag reset if the telephone is ringing.
Input
E Telephone identifier
76DD LD A,($5C79) Collect the second byte of the FRAMES system variable, which is incremented every 5.12s
76E0 LD HL,$7F99 7F99 holds the value of the second byte of the FRAMES system variable as it was the last time Sam lifted a ringing telephone
76E3 SUB (HL) Subtract the current value
76E4 CP $03 Has less than 10.24s passed since Sam last lifted a ringing telephone?
76E6 RET C Return with the carry flag set if so
76E7 LD HL,$6B4B Point HL at the ringing phone location table at 6B4B
This entry point is used by the routine at 77A3 (with HL=6B4B or 6B72).
76EA LD A,E A=telephone identifier
76EB CP (HL) Does it match the first byte of the phone entry?
76EC JR Z,$76F7 Jump if so
76EE LD A,(HL) Have we reached the end of the phone table?
76EF ADD A,$02
76F1 RET C Return with the carry flag set if so
76F2 INC HL Point HL at the first byte of the next entry in the phone table
76F3 INC HL
76F4 INC HL
76F5 JR $76EA Check the next entry
76F7 AND A Reset the carry and zero flags
76F8 RET
Prev: 76BC Up: Map Next: 76F9