![]() |
Routines |
| Prev: 77A3 | Up: Map | Next: 7866 |
| 77D3 | LD HL,$7F9B | The telephone call status flags are stored at 7F9B | ||
| 77D6 | BIT 6,(HL) | Has someone asked Sam 'WHO'S THERE?' | ||
| 77D8 | JP NZ,$776F | Jump if so | ||
| 77DB | BIT 1,(HL) | Is the telephone call still in progress? | ||
| 77DD | JR Z,$77E3 | Jump if so | ||
| 77DF | CALL $F1E3 | Hang up if 'h' was pressed | ||
| 77E2 | RET | |||
|
The telephone call is still in progress.
|
||||
| 77E3 | BIT 7,(HL) | Has Sam picked up a telephone that was ringing? | ||
| 77E5 | JR Z,$77F3 | Jump if not | ||
| 77E7 | CALL $F1E3 | Hang up if 'h' was pressed | ||
| 77EA | LD A,($7FD3) | A=ID of the telephone that Sam is holding | ||
| 77ED | LD HL,$6B4B | The ringing phone location table is at 6B4B | ||
| 77F0 | JP $77A3 | Check whether there is a message for Sam | ||
| 77F3 | BIT 5,(HL) | Is the destination telephone ringing? | ||
| 77F5 | JR Z,$7806 | Jump if not | ||
| 77F7 | CALL $F1E3 | Hang up if 'h' was pressed | ||
| 77FA | CALL $772F | Is the telephone that Sam is calling either off-screen or close enough to a character that can pick it up? | ||
| 77FD | RET NC | Return if not | ||
| 77FE | LD A,($7F9A) | A=ID of the telephone that Sam is calling | ||
| 7801 | LD HL,$6B72 | The phone message table is at 6B72 | ||
| 7804 | JR $77F0 | Check whether Sam has called someone who has a message for him | ||
|
Sam is still dialling the telephone number.
|
||||
| 7806 | BIT 4,(HL) | Are we currently making the sound effect of a digit being dialled? | ||
| 7808 | JR NZ,$7830 | Jump if so | ||
| 780A | CALL $F1E3 | Check for keypresses and hang up if 'h' was pressed | ||
| 780D | RET Z | Return if no key with an ASCII code in the range 0x30-0x7F was pressed | ||
| 780E | CP $3A | Was the ASCII code of the keypress greater than 0x39 ('9')? | ||
| 7810 | RET NC | Return if so | ||
| 7811 | CP $30 | Was the ASCII code less than 0x30 ('0')? | ||
| 7813 | RET C | Return if so | ||
| 7814 | LD HL,$7F91 | Store the ASCII code of the digit in the first available space at 7F92 | ||
| 7817 | INC L | |||
| 7818 | BIT 5,(HL) | |||
| 781A | JR NZ,$7817 | |||
| 781C | LD (HL),A | |||
| 781D | SUB $30 | A=digit that was dialled (0-9) | ||
| 781F | JR NZ,$7823 | Jump unless '0' was dialled | ||
| 7821 | LD A,$0A | The digit '0' will give 10 clicks | ||
| 7823 | INC A | A=1-11 | ||
| 7824 | LD ($E614),A | Store this in byte 0x14 of Sam's buffer | ||
| 7827 | LD L,$9B | HL=7F9B (telephone call status flags) | ||
| 7829 | LD (HL),$10 | Set bit 4 | ||
| 782B | LD A,$2A | Message 0x2A: 'I DIALLED {number}' | ||
| 782D | JP $75CA | Queue this message urgently | ||
|
The sound effect of a digit being dialled is currently in progress.
|
||||
| 7830 | LD HL,$E608 | Set Sam's main action timer (in byte 0x08 of his buffer) to 3 | ||
| 7833 | LD (HL),$03 | |||
| 7835 | LD L,$14 | Point HL at byte 0x14 of Sam's buffer | ||
| 7837 | DEC (HL) | Are there any more clicks to make? | ||
| 7838 | JP NZ,$EC69 | Make a click if so | ||
|
Sam has finished dialling a digit of the telephone number. Check whether the number dialled so far is valid.
|
||||
| 783B | LD HL,$7F9B | Clear all the telephone call status flags at 7F9B | ||
| 783E | LD (HL),$00 | |||
| 7840 | LD L,$92 | Collect the ASCII code of the first digit that was dialled from 7F92 | ||
| 7842 | LD A,(HL) | |||
| 7843 | CP $30 | Was it '0'? | ||
| 7845 | JR Z,$7861 | Jump if so (no telephone numbers start with 0) | ||
| 7847 | INC L | Add the ASCII codes of the second and third digits to the first | ||
| 7848 | ADD A,(HL) | |||
| 7849 | INC L | |||
| 784A | ADD A,(HL) | |||
| 784B | INC L | Point HL at the fourth digit | ||
| 784C | CP $AB | Set the zero flag if '999' was dialled | ||
| 784E | LD A,$70 | 0x70 is the ID of the telephone in the police station | ||
| 7850 | JR Z,$785A | Jump if Sam has dialled the police | ||
| 7852 | BIT 5,(HL) | Has Sam dialled four digits yet? | ||
| 7854 | RET Z | Return if not | ||
| 7855 | CALL $7A17 | Has Sam dialled a valid telephone number? | ||
| 7858 | JR NZ,$7861 | Jump if not | ||
| 785A | LD HL,$7FD3 | 7FD3 holds the ID of the telephone Sam is holding | ||
| 785D | CP (HL) | Does it match the ID of the telephone Sam is calling? | ||
| 785E | JP NZ,$7A0C | Jump if not to place the call | ||
| 7861 | LD A,$2F | Message 0x2F: ' THE NUMBER WAS UNOBTAINABLE' | ||
| 7863 | JP $7799 | Disconnect the call and queue this message urgently | ||
| Prev: 77A3 | Up: Map | Next: 7866 |