Prev: 776E Up: Map Next: 77A2
776F: Deal with Sam when he's on the phone and has been asked 'WHO'S THERE?'
Used by the routine at 77D3. Waits for a keypress, and then queues message 0x28 (''{name}' I SAID ') followed by either message 0x2E ('I DUNNO NO {name}') or the message Sam is supposed to receive upon giving the correct name.
776F CALL $F1E3 Check for keypresses or hang up the phone
7772 RET Z Return if no key with an ASCII code in the range 0x30-0x7F was pressed
7773 CP $61 Is the ASCII code of the keypress less than 0x61 ('a')?
7775 RET C Return if so
7776 CP $68 Is the ASCII code of the keypress less than 0x68 ('h')?
7778 JR C,$777F Jump if so
777A CP $73 Was 's' pressed?
777C RET NZ Return if not
777D SUB $0B A=0x68
777F ADD A,$07 A=0x68-0x6F (message number of a name)
7781 LD ($7FD0),A Store this at 7FD0
7784 PUSH AF Save the name message number briefly
7785 LD A,$28 Message 0x28: ''{name}' I SAID '
7787 CALL $75CA Queue this message urgently
778A LD HL,($7F97) Collect from 7F97 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 6B72 (if the person Sam's calling has no message for him); the final byte of the phone message table is 0xFF, which does not match the message number of any name
778D POP AF Restore the name message number to A
778E CP (HL) Set the zero flag if Sam has used the correct name
778F LD A,$2E Message 0x2E: 'I DUNNO NO {name}'
7791 JR NZ,$7799 Jump unless Sam has used the correct name
This entry point is used by the routine at 77A3.
7793 DEC HL Point HL at the first byte of the phone entry
7794 LD (HL),$00 Mark the phone entry inactive
7796 INC HL Point HL at the third byte of the phone entry
7797 INC HL
7798 LD A,(HL) A=telephone message number
This entry point is used by the routines at 77A3 (with A=0x2B, 0x2C, 0x2D or 0x32) and 77D3 (with A=0x2F).
7799 LD HL,$0200 Clear 7F9A and set bit 1 of the telephone call status flags at 7F9B (to disconnect the call)
779C LD ($7F9A),HL
779F JP $75CA Queue the telephone message urgently
Prev: 776E Up: Map Next: 77A2