| Routines

F800: Make little boy no. 10 give ERIC a message

Used by command lists 0xD0 and 0xD2. Makes little boy no. 10 tell ERIC about BOY WANDER having hidden a pea-shooter on the fire escape, EINSTEIN's intent to grass him up to MR WACKER, or ANGELFACE's medical condition.
Input
H | 0xA1 (little boy no. 10)
F800 | LD A,($7FFB) | Set bit 3 of ERIC's status flags at 7FFB, indicating that ERIC is being spoken to
F803 | SET 3,A
F805 | LD ($7FFB),A
F808 | LD A,$FF | Adjust the MSB of the lesson clock so that the lesson will not end until the drama has played out
F80A | LD ($7FF8),A
Figure out which message the boy should deliver, depending on what MR ROCKITT and MR WACKER are up to.
F80D | LD A,($A478) | Collect byte 0x78 of MR ROCKITT's buffer, which holds the MSB of the command list start address
F810 | CP $FA | This is the MSB of FADB (command list 0xDE)
F812 | LD BC,$FF00 | BC=FF00: 'Don't let ANGELFACE touch you...'
F815 | JR Z,$F822 | Jump if MR ROCKITT is using command list 0xDE
F817 | LD C,$35 | BC=FF35: 'EINSTEIN is going to tell MR WACKER...'
F819 | LD A,($A375) | Collect byte 0x75 of MR WACKER's buffer, which holds the LSB of the address reached in the command list
F81C | CP $3C | Is MR WACKER using command list 0xD8?
F81E | JR C,$F822 | Jump if not (he must be using command list 0xD6)
F820 | LD C,$8F | BC=FF8F: 'BOY WANDER has hidden a pea-shooter...'
Now BC holds the address of the message to be delivered.
F822 | CALL $7D26 | Make the little boy deliver his message
F825 | LD L,$68 | Initialise the message repetition delay counter in byte 0x68 of the little boy's buffer to 40
F827 | LD (HL),$28
F829 | LD BC,$ECE0 | ECE0: 'Press 'U' if you understood'
F82C | LD A,($7FCB) | Set bit 0 at 7FCB, indicating that the little boy is now waiting for acknowledgment from ERIC
F82F | SET 0,A
F831 | LD ($7FCB),A
F834 | CALL $7D26 | Make the little boy say 'Press 'U' if you understood'
F837 | LD A,($7FFB) | Collect ERIC's status flags from 7FFB
F83A | BIT 3,A | Has 'U' been pressed yet?
F83C | JR NZ,$F846 | Jump if not
ERIC has acknowledged delivery of the message ('U' was pressed).
F83E | LD A,$0C | Set the MSB of the lesson clock to 0x0C, giving enough time for the ensuing drama to play out
F840 | LD ($7FF8),A
F843 | JP $62A8 | Move to the next command in little boy no. 10's command list
ERIC has not yet acknowledged delivery of the message ('U' has not been pressed).
F846 | LD L,$68 | Decrement the message repetition delay counter in byte 0x68 of the little boy's buffer and return unless it has reached 0
F848 | DEC (HL)
F849 | RET NZ
F84A | LD A,($7FCB) | Reset bit 0 at 7FCB, indicating that the little boy is no longer waiting for acknowledgment from ERIC (because he's going to repeat the message first)
F84D | RES 0,A
F84F | LD ($7FCB),A
F852 | JP $F808 | Deliver the message to ERIC once again