Prev: 7CFC Up: Map Next: 7D83
7D30: Make a teacher conduct a class without ERIC
Used by the routine at 7DB2. Makes the teacher wipe the board (if there is one), tell the kids what to do, and then walk up and down until the end of the lesson.
Input
H Teacher's character number (0xA3-0xA6)
7D30 CALL $7128 A=identifier of the blackboard the teacher is next to
7D33 LD C,A Copy this to C
7D34 CP $EC Is the teacher on the top floor?
7D36 JR NZ,$7D3E Jump if not
7D38 INC L L=0x62
7D39 LD A,(HL) A=teacher's x-coordinate
7D3A CP $3A Is the teacher in the Map Room?
7D3C JR NC,$7D70 Jump if so (there's no blackboard in the Map Room)
7D3E LD BC,$71DC Hand over control to the routine at 71DC, making the teacher wipe the blackboard
7D41 CALL $7CF1
Control returns here when the teacher has finished wiping the blackboard.
7D44 LD L,$62 A=teacher's x-coordinate (equal to that of the left edge of the blackboard)
7D46 LD A,(HL)
7D47 ADD A,$03 Place the x-coordinate of the middle of the blackboard into byte 0x6B of the teacher's buffer, and the same value into byte 0x6C (which ensures that the routine at 633C will not relinquish control before the teacher has reached the middle of the blackboard)
7D49 LD L,$6B
7D4B LD (HL),A
7D4C INC L
7D4D LD (HL),A
7D4E LD BC,$633C Hand over control to the routine at 633C, making the teacher walk to the middle of the blackboard
7D51 CALL $7CF1
Control returns here when the teacher has reached the middle of the blackboard.
7D54 CALL $61A1 A=random number
7D57 CP $A0 Should the teacher write on the blackboard?
7D59 JR C,$7D70 Jump if not
7D5B LD BC,$7264 Hand over control to the routine at 7264, making the teacher write on the blackboard
7D5E CALL $7CF1
Control returns here when the teacher has finished writing on the blackboard.
7D61 CALL $61A1 A=random number
7D64 CP $A0 Should the teacher tell the kids to write an essay?
7D66 JR C,$7D70 Jump if not
7D68 LD BC,$F2D6 F2D6: 'WRITE AN ESSAY WITH THIS TITLE'
7D6B CALL $7D26 Make the teacher tell the kids to write an essay
7D6E JR $7D73
7D70 CALL $7CFC Make the teacher tell the kids to go to a page in their books
Now we enter a loop that makes the teacher walk up and down next to the blackboard (or the map).
7D73 LD L,$62 A=teacher's x-coordinate
7D75 LD A,(HL)
7D76 XOR $03 Store the x-coordinate of the location 1 or 3 spaces behind the teacher in byte 0x6B of his buffer
7D78 LD L,$6B
7D7A LD (HL),A
7D7B LD BC,$633C Hand over control to the routine at 633C, making the teacher turn round and walk 1 or 3 paces
7D7E CALL $7CF1
7D81 JR $7D73 Make the teacher turn round and walk 1 or 3 paces again
Prev: 7CFC Up: Map Next: 7D83