| Routines

7C75: Collect the bit mask and game status buffer address for an event identifier

Used by the routine at 7C8F, and also by the unused routines at 7C95 and 7CA1. The event identifier in A (0x00, 0x07-0x0C), taken modulo 8, corresponds to a bit in one of the bytes at 7F80 (A<=7) or 7F81 (A>=8). On exit, HL points to the appropriate byte and A holds the bit mask (single bit set), as follows:
Entry | Exit | Event
--- | --- | ---
0x00 | 0x01 | End of lesson
0x07 | 0x80 | Time to sit down for assembly
0x08 | 0x01 | Teacher has arrived at the top-floor room in the girls' skool
0x09 | 0x02 | Teacher has arrived at the middle-floor room in the girls' skool
0x0A | 0x04 | Teacher has arrived at the Blue Room
0x0B | 0x08 | Teacher has arrived at the Yellow Room
0x0C | 0x10 | Teacher has arrived at the Science Lab
Input
A | Event ID from a command list
7C75 | AND A | Set the carry flag if the event identifier is odd
7C76 | RRA
7C77 | LD E,A | Copy bits 1-3 of the event ID into bits 0-2 of E
7C78 | LD A,$00 | A=0x01 if the event ID is an even number, 0x02 if it's an odd number
7C7A | ADC A,A
7C7B | INC A
7C7C | RR E | Now bits 2 and 3 of the event ID are in bits 0 and 1 of E
7C7E | JR NC,$7C82 | Jump if the event ID is 0x00, 0x08, 0x09 or 0x0C (bit 1 reset)
7C80 | ADD A,A | A=0x04 (event ID = 0x0A) or 8 (event ID = 0x07 or 0x0B)
7C81 | ADD A,A
7C82 | SCF |
7C83 | RR E | E=0x80 (event ID <= 0x07) or 0x81
7C85 | JR NC,$7C8B | Jump if the event ID is 0x00, 0x08, 0x09, 0x0A or 0x0B (bit 2 reset)
7C87 | ADD A,A | A=0x10 (event ID = 0x0C) or 0x80 (event ID = 0x07)
7C88 | ADD A,A
7C89 | ADD A,A
7C8A | ADD A,A
7C8B | LD D,$7F | HL=7F80 or 7F81
7C8D | EX DE,HL
7C8E | RET |