Prev: 31996 Up: Map Next: 32131
32048: Make a teacher conduct a class without ERIC
Used by the routine at 32178. 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 (163-166)
32048 CALL 28968 A=identifier of the blackboard the teacher is next to
32051 LD C,A Copy this to C
32052 CP 236 Is the teacher on the top floor?
32054 JR NZ,32062 Jump if not
32056 INC L L=98
32057 LD A,(HL) A=teacher's x-coordinate
32058 CP 58 Is the teacher in the Map Room?
32060 JR NC,32112 Jump if so (there's no blackboard in the Map Room)
32062 LD BC,29148 Hand over control to the routine at 29148, making the teacher wipe the blackboard
32065 CALL 31985
Control returns here when the teacher has finished wiping the blackboard.
32068 LD L,98 A=teacher's x-coordinate (equal to that of the left edge of the blackboard)
32070 LD A,(HL)
32071 ADD A,3 Place the x-coordinate of the middle of the blackboard into byte 107 of the teacher's buffer, and the same value into byte 108 (which ensures that the routine at 25404 will not relinquish control before the teacher has reached the middle of the blackboard)
32073 LD L,107
32075 LD (HL),A
32076 INC L
32077 LD (HL),A
32078 LD BC,25404 Hand over control to the routine at 25404, making the teacher walk to the middle of the blackboard
32081 CALL 31985
Control returns here when the teacher has reached the middle of the blackboard.
32084 CALL 24993 A=random number
32087 CP 160 Should the teacher write on the blackboard?
32089 JR C,32112 Jump if not
32091 LD BC,29284 Hand over control to the routine at 29284, making the teacher write on the blackboard
32094 CALL 31985
Control returns here when the teacher has finished writing on the blackboard.
32097 CALL 24993 A=random number
32100 CP 160 Should the teacher tell the kids to write an essay?
32102 JR C,32112 Jump if not
32104 LD BC,62166 62166: 'WRITE AN ESSAY WITH THIS TITLE'
32107 CALL 32038 Make the teacher tell the kids to write an essay
32110 JR 32115
32112 CALL 31996 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).
32115 LD L,98 A=teacher's x-coordinate
32117 LD A,(HL)
32118 XOR 3 Store the x-coordinate of the location 1 or 3 spaces behind the teacher in byte 107 of his buffer
32120 LD L,107
32122 LD (HL),A
32123 LD BC,25404 Hand over control to the routine at 25404, making the teacher turn round and walk 1 or 3 paces
32126 CALL 31985
32129 JR 32115 Make the teacher turn round and walk 1 or 3 paces again
Prev: 31996 Up: Map Next: 32131