Prev: 32021 Up: Map Next: 32054
32032: Make any nearby teacher give ERIC lines if necessary (1)
Used by the routine at 63156. Makes any nearby teacher give ERIC lines for rule breakages other than hitting, firing a catapult, firing a waterpistol, writing on a blackboard, or dropping a stinkbomb.
32032 LD HL,32758 Decrement the LSB of the lines-giving delay counter at 32758
32035 DEC (HL)
32036 RET NZ Return unless it's time to inspect the MSB
32037 LD (HL),15 Reset the LSB to 15
32039 INC L HL=32759 (MSB of the lines-giving delay counter)
32040 INC (HL) Has the lines-giving delay counter reached 0?
32041 DEC (HL)
32042 JR Z,32049 Jump if so
32044 DEC (HL) Otherwise decrement the MSB of the counter
32045 LD A,(HL) Pick up the MSB in A
32046 CP 6 Has enough time passed since the last time ERIC was given lines?
32048 RET NC Return if not
The MSB of the lines-giving delay counter (which is reset to 10 by the routine at 32062 when ERIC is given lines) is now 5 or less. This means the minimum interval between two lines-givings (75 passes through the main loop) has elapsed. However, the teacher who gave ERIC lines last time must wait until the MSB reaches zero before he can give ERIC lines again.
32049 CALL 32000 A=location identifier for ERIC
32052 JR 32062 Skip over the routine at 32054
Prev: 32021 Up: Map Next: 32054