Prev: 31844 Up: Map Next: 31887
31861: Collect the bit mask and game status buffer address for an event identifier
Used by the routine at 31887, and also by the unused routines at 31893 and 31905. The event identifier in A (0, 7-12), taken modulo 8, corresponds to a bit in one of the bytes at 32640 (A<=7) or 32641 (A>=8). On exit, HL points to the appropriate byte and A holds the bit mask (single bit set), as follows:
Entry Exit Event
0 1 End of lesson
7 128 Time to sit down for assembly
8 1 Teacher has arrived at the top-floor room in the girls' skool
9 2 Teacher has arrived at the middle-floor room in the girls' skool
10 4 Teacher has arrived at the Blue Room
11 8 Teacher has arrived at the Yellow Room
12 16 Teacher has arrived at the Science Lab
Input
A Event ID from a command list
31861 AND A Set the carry flag if the event identifier is odd
31862 RRA
31863 LD E,A Copy bits 1-3 of the event ID into bits 0-2 of E
31864 LD A,0 A=1 if the event ID is an even number, 2 if it's an odd number
31866 ADC A,A
31867 INC A
31868 RR E Now bits 2 and 3 of the event ID are in bits 0 and 1 of E
31870 JR NC,31874 Jump if the event ID is 0, 8, 9 or 12 (bit 1 reset)
31872 ADD A,A A=4 (event ID = 10) or 8 (event ID = 7 or 11)
31873 ADD A,A
31874 SCF
31875 RR E E=128 (event ID <= 7) or 129
31877 JR NC,31883 Jump if the event ID is 0, 8, 9, 10 or 11 (bit 2 reset)
31879 ADD A,A A=16 (event ID = 12) or 128 (event ID = 7)
31880 ADD A,A
31881 ADD A,A
31882 ADD A,A
31883 LD D,127 HL=32640 or 32641
31885 EX DE,HL
31886 RET
Prev: 31844 Up: Map Next: 31887