Prev: 30626 Up: Map Next: 30675
30627: Check whether there is a telephone message for Sam
Used by the routine at 30675. On entry, A holds the identifier of either the telephone that Sam is holding (which was ringing when he picked it up), or the telephone that Sam is calling. If there is a message for Sam, it will be queued unless Sam needs to identify himself first, in which case message 37 ('A VOICE SAID 'WHO'S THERE?'') will be queued instead. If there is no message for Sam, the message that is queued will depend on who Sam is calling (Daisy, the police, or someone else).
Input
A Telephone identifier (see 27392)
HL 27467 or 27506
30627 LD E,A E=telephone identifier
30628 CALL 30442 Is the telephone ringing, or does the person on the other end have a message for Sam?
30631 JR C,30638 Jump if not
30633 INC HL Point HL at the second byte of the entry in the phone table
30634 LD A,(HL) Pick this up in A
30635 AND A Does Sam need to identify himself in order to receive the message?
30636 JR Z,30611 Jump if not to queue the message
30638 LD (32663),HL Store at 32663 the address of either the second byte of the relevant phone table entry (if the phone was ringing, or the person Sam's calling has a message for him), or the final byte of the phone message table at 27506 (if the person Sam's calling has no message for him)
30641 JP NC,30198 Jump if Sam must be asked to identify himself
30644 LD A,E A=telephone identifier
30645 CP 92 92 is the identifier of Sam's telephone
30647 LD A,50 Message 50: 'DAISY SAID 'NO MESSAGES SAM ''
30649 JR Z,30672 Jump if Sam called his office
30651 LD A,E A=telephone identifier
30652 CP 112 112 is the identifier of the telephone in the police station
30654 JR NZ,30663 Jump unless Sam called the police
30656 CALL 31236 Send the police after Sam
30659 LD A,51 Message 51: 'A VOICE SAID 'OK CRUISE WE'RE COMING''
30661 JR 30672 Queue this message
30663 CALL 61823 Get a random number in A
30666 AND 3 Keep only bits 0 and 1
30668 JR Z,30641 Jump if the result is 0 (25% of the time): ask Sam 'WHO'S THERE?'
30670 ADD A,42 A=43 (A VOICE SAID 'THERES NOONE HERE'), 44 (A VOICE SAID 'GET LOST - I'M TRYING TO SLEEP') or 45 (A VOICE SAID 'BE RIGHT WITH YOU')
30672 JP 30617 Queue this message
Prev: 30626 Up: Map Next: 30675