| Routines

631E: Check whether a signal has been raised

Used by the routines at 62D7 and 7DA7. On entry, A holds the event identifier, which will be one of:
A | Description | Flags | Bit
--- | --- | --- | ---
0x00 | End of lesson/playtime | 7FC8 | 0
0x08 | Teacher has arrived at the Map Room | 7FC9 | 0
0x09 | Teacher has arrived at the Reading Room | 7FC9 | 1
0x0A | Teacher has arrived at the Exam Room | 7FC9 | 2
0x0B | Teacher has arrived at the White Room | 7FC9 | 3
0x10 | Little boy no. 1 is ready to stampede | 7FCA | 0
0x11 | Little boy no. 1 is ready to stampede again | 7FCA | 1
0x1A | EINSTEIN or BOY WANDER is ready | 7FCB | 2
0x1B | MR WACKER is ready | 7FCB | 3
0x1C | ERIC has been told about EINSTEIN, BOY WANDER or ANGELFACE | 7FCB | 4
0x1D | EINSTEIN has told MR WACKER what ERIC's up to, or ERIC has mumps | 7FCB | 5
The routine returns with the zero flag reset if the corresponding signal has been raised.
Input
A | Event ID from a command list
631E | PUSH AF | Save the event identifier briefly
631F | AND $F8 | Keep only bits 3-7 (the byte index) and shift them into bits 0-4
6321 | RRCA
6322 | RRCA
6323 | RRCA
6324 | ADD A,$C8 | Modify the LD A,(m) instruction at 6334 below so that m is 7FC8, 7FC9, 7FCA or 7FCB
6326 | LD ($6335),A
6329 | POP AF | Restore the event identifier to A
632A | AND $07 | Keep only bits 0-2 (the bit index)
632C | ADD A,A | Modify the BIT n,A instruction at 6337 below so that n=A (0-7)
632D | ADD A,A
632E | ADD A,A
632F | ADD A,$47
6331 | LD ($6338),A
6334 | LD A,($7FC8) | Pick up the byte holding the signal flag for this event (the operand of this instruction is modified earlier in this routine)
6337 | BIT 0,A | Reset the zero flag if the signal has been raised (this instruction is modified earlier in this routine to check the appropriate bit)
6339 | RET |