Prev: 30396 Up: Map Next: 30457
30429: Check whether Sam is standing next to a ringing telephone
Continues from the routine at 29854. 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
30429 LD A,(23673) Collect the second byte of the FRAMES system variable, which is incremented every 5.12s
30432 LD HL,32665 32665 holds the value of the second byte of the FRAMES system variable as it was the last time Sam lifted a ringing telephone
30435 SUB (HL) Subtract the current value
30436 CP 3 Has less than 10.24s passed since Sam last lifted a ringing telephone?
30438 RET C Return with the carry flag set if so
30439 LD HL,27467 Point HL at the ringing phone location table at 27467
This entry point is used by the routine at 30627 (with HL=27467 or 27506).
30442 LD A,E A=telephone identifier
30443 CP (HL) Does it match the first byte of the phone entry?
30444 JR Z,30455 Jump if so
30446 LD A,(HL) Have we reached the end of the phone table?
30447 ADD A,2
30449 RET C Return with the carry flag set if so
30450 INC HL Point HL at the first byte of the next entry in the phone table
30451 INC HL
30452 INC HL
30453 JR 30442 Check the next entry
30455 AND A Reset the carry and zero flags
30456 RET
Prev: 30396 Up: Map Next: 30457