Prev: 62197 Up: Map Next: 62453
62208: Make a teacher conduct a class with ERIC
Continues from the routine at 32178. Makes a teacher conduct a class with ERIC, from the point of reaching the left edge of the blackboard or map (where the teacher waits for EINSTEIN to show up) until the end of the lesson.
Input
H Teacher's character number (163-166)
62208 CALL 31952 Make the teacher wait for EINSTEIN to sit down
62211 JR Z,62252 Jump if ERIC is in the room
This entry point is used by the routine at 62464.
62213 LD BC,61699 61699: 'Please Sir...ERIC is not here'
62216 CALL 31919 Make EINSTEIN say this
62219 CALL 31968 Make the teacher give lines to EINSTEIN for telling tales (if he's in the mood)
62222 CALL 31996 Make the teacher tell the kids to read their books
62225 CALL 31188 Set the zero flag if ERIC is in class
62228 LD A,(32712) Collect the lesson status flags from 32712
62231 JR Z,62241 Jump if ERIC is in class
62233 SET 7,A Set bit 7 at 32712, indicating that the next lines message for absence (if any) should be no. 11 (AND STAY THIS TIME)
62235 LD (32712),A
62238 JP 31867 Make the teacher track down ERIC
62241 RLCA Set the carry flag if the absence lines reprimand should be...
62242 LD B,11 ...11: AND STAY THIS TIME
62244 JR C,62247 Jump if this is the appropriate lines reprimand
62246 DEC B B=10: NEVER BE LATE AGAIN
62247 LD A,172 172=ERIC
62249 CALL 31908 Give lines to ERIC
ERIC is in class now.
62252 LD A,(32712) Set bit 7 (indicating that the next absence lines message should be 'AND STAY THIS TIME') and bit 6 (indicating that the lesson has started) at 32712
62255 OR 192
62257 LD (32712),A
62260 CALL 31952 Is ERIC in class?
62263 JR NZ,62213 Jump if not
This is EINSTEIN's opportunity to tell tales about hitting and blackboard defacement.
62265 CALL 24993 A=random number
62268 CP 226 Should EINSTEIN tell the teacher that ERIC hit him?
62270 JR C,62302 Jump if not (226 times out of 256)
62272 LD BC,61689 61689: 'Please Sir...ERIC hit me'
62275 CP C The result of this comparison is ignored
62276 JR 62281
62278 LD BC,61741 This instruction is never executed; anyway, 61741='WHAT HAPPENED IN THE YEAR THAT I WAS BORN'
62281 CALL 31919 Make EINSTEIN tell the teacher that ERIC hit him
62284 CALL 31968 Make the teacher give lines to EINSTEIN for telling tales (if he's in the mood)
62287 INC L Did the teacher give lines to EINSTEIN?
62288 JR NZ,62297 Jump if so
62290 LD B,8 Lines reprimand 8: NOW DON'T DO IT AGAIN
62292 LD A,172 172=ERIC
62294 CALL 31908 Give ERIC lines
62297 CALL 31952 Is ERIC in class?
62300 JR NZ,62213 Jump if not
62302 CALL 28968 A=identifier of the blackboard closest to the teacher
62305 LD C,A Transfer this to C
62306 CP 236 Are we on the top floor?
62308 JR NZ,62316 Jump if not
62310 INC L L=98
62311 LD A,(HL) A=teacher's x-coordinate
62312 CP 58 Are we in the Map Room?
62314 JR NC,62419 Jump if so (no blackboard in there)
62316 INC C BC=32749 (Reading Room blackboard), 32751 (White Room blackboard) or 32753 (Exam Room blackboard)
62317 LD B,127
62319 LD A,(BC) A=number of the character who last wrote on the board
62320 AND A Is the board clean?
62321 JR Z,62369 Jump if so
62323 CP 167 Did a teacher write on the board?
62325 JR C,62369 Jump if so
62327 JR NZ,62338 Jump unless BOY WANDER wrote on the board
62329 CALL 24993 A=random number
62332 CP 200 Set the carry flag 200 times out of 256
62334 LD A,17 17='BOY WANDER'
62336 JR C,62340 Jump if EINSTEIN is going to blame BOY WANDER
62338 LD A,16 16='ERIC'
62340 LD BC,61715 Insert ERIC's or BOY WANDER's name into the 'X wrote on the blackboard' message at 61714
62343 LD (BC),A
62344 DEC C Point BC at the start of the message
62345 CALL 31919 Make EINSTEIN tell a tale about ERIC or BOY WANDER writing on the blackboard
62348 CALL 31968 Make the teacher give lines to EINSTEIN for telling tales (if he's in the mood)
62351 INC L Did the teacher give lines to EINSTEIN?
62352 JR NZ,62369 Jump if so
62354 LD A,(61715) A=16 ('ERIC') or 17 ('BOY WANDER')
62357 RRCA Set the carry flag if EINSTEIN blamed BOY WANDER
62358 LD A,167 167=BOY WANDER
62360 JR C,62364 Jump if EINSTEIN blamed BOY WANDER for writing on the board
62362 LD A,172 172=ERIC
62364 LD B,12 Lines reprimand 12: DON'T TOUCH BLACKBOARDS
62366 CALL 31908 Make the teacher give lines to ERIC or BOY WANDER
With EINSTEIN's tales now safely told, it's time to wipe the blackboard.
62369 LD BC,29148 Hand over control to the routine at 29148, making the teacher wipe the blackboard
62372 CALL 31985
Control returns here after the teacher has wiped the blackboard.
62375 LD L,98 A=teacher's x-coordinate (equal to that of the left edge of the blackboard)
62377 LD A,(HL)
62378 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)
62380 LD L,107
62382 LD (HL),A
62383 INC L
62384 LD (HL),A
62385 LD BC,25404 Hand over control to the routine at 25404, making the teacher walk to the middle of the blackboard
62388 CALL 31985
Control returns here when the teacher has walked to the middle of the blackboard.
62391 CALL 24993 A=random number
62394 CP 180 Should the teacher write on the blackboard?
62396 JR C,62419 Jump if not (180 times out of 256)
62398 LD BC,29284 Hand over control to the routine at 29284, making the teacher write on the blackboard
62401 CALL 31985
Control returns here when the teacher has finished writing on the blackboard.
62404 CALL 24993 A=random number
62407 CP 160 Should the teacher tell the kids to write an essay?
62409 JR C,62419 Jump if not (10 times out of 16)
62411 LD BC,62166 62166: 'WRITE AN ESSAY WITH THIS TITLE'
62414 CALL 32038 Make the teacher tell the kids to write an essay
62417 JR 62429
62419 CALL 24993 A=random number
62422 CP 240 Is this going to be a questions-and-answers lesson?
62424 JR C,62464 Jump if so (15 times out of 16)
62426 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), checking periodically whether ERIC has gone AWOL.
62429 CALL 31952 Is ERIC in class?
62432 JP NZ,62213 Jump if not
62435 LD L,98 Collect the teacher's x-coordinate from byte 98 of his buffer
62437 LD A,(HL)
62438 XOR 3 Now A holds the x-coordinate of the location 1 or 3 spaces behind the teacher
62440 LD L,107 Place this into byte 107 of his buffer, and the same value into byte 108 (which ensures that the routine at 25404 will not relinquish control before the teacher has reached that destination)
62442 LD (HL),A
62443 INC L
62444 LD (HL),A
62445 LD BC,25404 Hand over control to the routine at 25404, making the teacher turn round and walk 1 or 3 paces
62448 CALL 31985
62451 JR 62429 Make the teacher turn round and walk 1 or 3 paces again
Prev: 62197 Up: Map Next: 62453