Routines
 Prev: 7B96 Up: Map Next: 7BFB
7BA0: Make a teacher find the truant ERIC
Used by the routine at 7C6E, which also places the address of this interruptible subcommand routine into bytes 0x69 and 0x6A of the teacher's buffer when ERIC is absent during dinner or class. It makes the teacher run after and stalk ERIC until he goes to wherever he should be (the dinner hall or the classroom).
Input
H Teacher's character number (0xA3-0xA6)
7BA0 CALL \$79FD Get ERIC's coordinates in DE
7BA3 CALL \$7DEA Make this teacher walk fast
7BA6 CALL \$7ADC Determine which way the teacher needs to go to find ERIC
7BA9 AND A Are ERIC and this teacher in the same location?
7BAA JR Z,\$7BB0 Jump if so
7BAC CP \$03 Is this teacher going up or down a staircase?
7BAE JR C,\$7BCF Jump if so
7BB0 LD L,\$7A If this teacher's command list has been marked for a restart (by the routine at 66E6), terminate this interruptible subcommand and restart now
7BB2 BIT 0,(HL)
7BB4 JP NZ,\$62A4
7BB7 LD B,A
7BB8 CALL \$79D4 Check whether ERIC is where he should be
7BBB LD A,B
7BBC JR NZ,\$7BCF Jump if ERIC is not where he should be
ERIC is back where he should be, so it's time for the teacher to resume his classroom duties.
7BBE LD L,\$75 Pick up in DE the address the teacher has reached in his command list
7BC0 LD E,(HL)
7BC1 INC L
7BC2 LD D,(HL)
7BC3 LD B,\$02 0xBE is the LSB of the address of the routine at 63BE; point DE at the second-from-last occurrence of this routine address in the teacher's command list (which will take him to the side of the blackboard where he waits for EINSTEIN to grass, or back to the dinner hall)
7BC5 DEC DE
7BC6 LD A,(DE)
7BC7 CP \$BE
7BC9 JR NZ,\$7BC5
7BCB DJNZ \$7BC5
7BCD JR \$7B96 Restart the teacher's command list from this point
ERIC is not where he should be, or the teacher is on a staircase.
7BCF AND A Are ERIC and the teacher in exactly the same location?
7BD0 JR NZ,\$7BDF Jump if not
7BD2 LD A,(\$5C78) 5C78=LSB of FRAMES system variable
7BD5 AND A This LSB will be 0 once every 5.12 seconds
7BD6 RET NZ Return if it's not zero now
7BD7 CALL \$6214 Update the SRB for the teacher's current animatory state
7BDA XOR \$80 Make the teacher turn round
7BDC JP \$61B0 Update the teacher's animatory state and update the SRB
This entry point is used by the routine at F78E with H holding the number of a character looking for ERIC (which will be little boy no. 10 or a teacher), and A holding 1, 2, 3 or 4 (indicating the character's next move).
7BDF CP \$03 Set the carry flag if the chaser is on a staircase
7BE1 LD BC,\$0000 DE will hold the appropriate x- and y-coordinate increments for the chaser's next move (to the midstride position), and BC will hold the appropriate x- and y-coordinate increments for the chaser's move after that (from the midstride position); initialise these increments to 0
7BE4 LD DE,\$0000
7BE7 LD L,\$60 Byte 0x60 of the buffer holds the animatory state of ERIC's chaser
7BE9 JR C,\$7C18 Jump if the chaser is currently going up or down stairs
7BEB JR NZ,\$7BF4 Jump if the chaser must go right (A=4)
7BED BIT 7,(HL) Is the chaser facing right?
7BEF JR NZ,\$7BD7 Turn him round if so
7BF1 DEC C C=-1
7BF2 JR \$7C25
7BF4 BIT 7,(HL) Is the chaser facing left?
7BF6 JR Z,\$7BD7 Turn him round if so
7BF8 INC C C=1
7BF9 JR \$7C25
 Prev: 7B96 Up: Map Next: 7BFB