Skool Daze Routines
62208: Make teacher wipe board and conduct class with ERIC and EINSTEIN
Continues from the routine at 32178.
H Character number of teacher (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 ERIC is not here
62219 CALL 31968 Make teacher give lines to EINSTEIN for telling tales (if in the mood)
62222 CALL 31996 Make teacher tell kids to read their books
62225 CALL 31188 Check whether ERIC is in class
62228 LD A,(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 teacher track down ERIC
62241 RLCA
62242 LD B,11 Lines message 11: AND STAY THIS TIME
62244 JR C,62247
62246 DEC B B=10: NEVER BE LATE AGAIN
62247 LD A,172 172=ERIC
62249 CALL 31908 Give lines to ERIC
62252 LD A,(32712) Set bit 7 (next absence lines message should be 'AND STAY THIS TIME') and bit 6 (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
62265 CALL 24993 Get random number in A
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 a tale
62284 CALL 31968 Give lines to EINSTEIN for telling tales (if in the mood)
62287 INC L Was the teacher in the mood?
62288 JR NZ,62297 Jump if so
62290 LD B,8 Lines message 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 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 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 Get random number in A
62332 CP 200
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
62343 LD (BC),A
62344 DEC C Point BC at the start of the message
62345 CALL 31919 Make EINSTEIN tell a tale
62348 CALL 31968 Give lines to EINSTEIN for telling tales (if in the mood)
62351 INC L Was the teacher in the mood?
62352 JR NZ,62369 Jump if so
62354 LD A,(61715) A=16 (ERIC) or 17 (BOY WANDER)
62357 RRCA
62358 LD A,167 167=BOY WANDER
62360 JR C,62364 Jump if EINSTEIN blamed BOY WANDER for writing on board
62362 LD A,172 172=ERIC
62364 LD B,12 Lines message 12: DON'T TOUCH BLACKBOARDS
62366 CALL 31908 Give lines to ERIC or BOY WANDER
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 in byte 107 of the teacher's buffer, and the same value in 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 Get random number in A
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 Get random number in A
62407 CP 160 Should the teacher tell the kids to write an essay?
62409 JR C,62419 Jump if not (160 times out of 256)
62411 LD BC,62166 62166='WRITE AN ESSAY WITH THIS TITLE'
62414 CALL 32038 Make teacher tell kids to write an essay
62417 JR 62429
62419 CALL 24993 Get random number in A
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 teacher tell kids to go to a page in their books
62429 CALL 31952 Is ERIC in class?
62432 JP NZ,62213 Jump if not
62435 LD L,98 A=teacher's x-coordinate
62437 LD A,(HL)
62438 XOR 3 Store the x-coordinate of the location 3 spaces behind the teacher in byte 107 of his buffer, and the same value in byte 108 (which ensures that the routine at 25404 will not relinquish control before the teacher has reached that destination)
62440 LD L,107
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 3 paces
62448 CALL 31985
62451 JR 62429 Make teacher turn round and walk 3 paces again