Skool Daze Routines
29284: Make character write on a blackboard
Used indirectly by the routines at 32048, 32158 and 62278.
H Character number (152-169)
29284 CALL 28968 Collect the identifier of the nearest blackboard in A
29287 LD C,A BC=32749 (Reading Room blackboard), 32751 (White Room blackboard), 32753 (Exam Room blackboard)
29288 LD B,127
29290 INC C
29291 LD A,(BC) A=number of character who last wrote on board
29292 AND A Is the board dirty?
29293 JP NZ,25252 Jump if so
29296 NOP
29297 NOP
29298 NOP
29299 LD A,H Store this character's number in the blackboard buffer, indicating that he wrote on it
29300 LD (BC),A
29301 LD L,110 Zero out bytes 109 and 110 of the character's buffer (which normally hold the submessage address)
29303 LD (HL),0
29305 DEC L
29306 LD (HL),0
29308 ADD A,67 A=234 (BOY WANDER) or 230-233 (a teacher)
29310 CP 234 Are we dealing with a teacher?
29312 JR C,29316 Jump if so
29314 LD A,229 A=229 if we're dealing with BOY WANDER
29316 DEC L A holds the MSB of the blackboard message address; store this in byte 108 of the character's buffer
29317 LD (HL),A
29318 DEC L Get a random multiple of 32 in A; this will be the LSB of the blackboard message address, which is stored in byte 107 of the character's buffer
29319 CALL 24993
29322 AND 224
29324 LD (HL),A
29325 LD L,105 Replace the address of this routine in bytes 105 and 106 of the character's buffer with that of 29329 below
29327 LD (HL),145
29329 CALL 28994 Write a single letter on the blackboard
29332 JR NZ,29351 Jump unless the character has finished writing
29334 CALL 25108 Update SRB for current location of character
29337 AND 248 A=base animatory state of teacher writing on board
29339 BIT 6,A Is a teacher writing on the board?
29341 JR NZ,29345 Jump if so
29343 AND 240 A=base animatory state of BOY WANDER
29345 CALL 25008 Update character's animatory state and update SRB
29348 JP 25252 Remove the routine address (29329) from bytes 105 and 106 of the character's buffer
29351 CALL 25108 Update SRB for current location of character
29354 BIT 6,A Set the zero flag if BOY WANDER is writing on the board
29356 LD B,A B=current animatory state of character
29357 JR NZ,29375 Jump if a teacher is writing on the board
BOY WANDER is writing on the board. Determine his next animatory state: 60/188 or 61/189.
29359 AND 127
29361 CP 60 60=BOY WANDER writing on board (stage 1)
29363 LD A,122 A/2=61=BOY WANDER writing on board (stage 2)
29365 JR Z,29369 Jump if BOY WANDER is in writing stage 1
29367 LD A,120 A/2=60=BOY WANDER writing on board (stage 1)
29369 RL B Slide the direction bit into bit 7 of A, which will then hold BOY WANDER's next animatory state
29371 RRA
29372 JP 25008 Update BOY WANDER's animatory state and update SRB
A teacher is writing on the board. Toggle the status of his arm (up/down).
29375 AND 248 A=base animatory state of teacher
29377 CP B Is the teacher's arm raised?
29378 JR NZ,29382 Jump if not
29380 ADD A,5 A=animatory state of teacher with arm raised
29382 JP 25008 Update teacher's animatory state and update SRB