| Routines

30458: 'T' pressed - telephone

The address of this routine is found in the table of keypress handling routines at 60672. It is called from the main loop at 61483 when 'T' is pressed.
Input
H | 230 (Sam)
30458 | CALL 29854 | Is Sam standing next to a telephone?
30461 | RET Z | Return if not
30462 | LD HL,32658 | The buffer at 32658 will hold the digits dialled by Sam
30465 | LD BC,1280 | B=5, C=0
30468 | LD (HL),C | Initialise the digit buffer at 32658 by filling it with zeroes
30469 | INC L
30470 | DJNZ 30468
30472 | LD L,155 | HL=32667 (telephone call status flags)
30474 | CCF | A=128 if the phone is ringing, 0 otherwise
30475 | SBC A,A
30476 | AND 128
30478 | LD (HL),A | Set bit 7 at 32667 if Sam has picked up a ringing telephone
30479 | LD L,252 | HL=32764 (Sam's status flags)
30481 | LD (HL),16 | Set bit 4: Sam is on the phone
30483 | LD L,211 | Store the phone's identifier at 32723
30485 | LD (HL),E
30486 | JR NZ,30495 | Jump if the phone is ringing
30488 | LD A,2 | Subtract $2 from Sam's cash supply
30490 | CALL 28300
30493 | JR 30501 |
Sam has picked up a telephone that is ringing.
30495 | LD A,(23673) | Collect the second byte of the FRAMES system variable, which is incremented every 5.12s
30498 | LD L,153 | Copy this byte to 32665
30500 | LD (HL),A
30501 | LD A,41 | Message 41: 'I LIFTED THE PHONE '
This entry point is used by the unused routine at 31284 with A=39: 'I HUNG UP'.
30503 | CALL 30154 | Queue the message urgently
This entry point is used by the routine at 61923.
30506 | LD H,230 | 230=Sam
30508 | JP 60654 | Make a sound effect