Routines
 Prev: 25108 Up: Map Next: 25248
25126: Move the characters
Called from the main loop at 26471.
25126 LD A,(32765) 32765 holds the number of the last character moved
25129 CALL 25141 Move a character
25132 LD A,(32765)
25135 CALL 25141 Move another character
25138 LD A,(32765)
25141 CP 171 Get the number of the next character to be moved (152-171) in A and copy it to 32765
25143 JR NZ,25147
25145 LD A,151
25147 INC A
25148 LD (32765),A
25151 LD H,A H=number of the character to be moved
25152 CALL 25266 Stop now unless it's time to move this character
The character shall be moved. From this point, the following steps are taken:
Step Action
1 If there is an uninterruptible subcommand routine address in bytes 111 and 112 of the character's buffer, jump to it
2 Call the continual subcommand routine address in bytes 124 and 125 of the character's buffer (and then return to step 3)
3 If there is an interruptible subcommand routine address in bytes 105 and 106 of the character's buffer, jump to it
4 Restart the command list if bits 1 and 0 of byte 122 of the character's buffer are reset and set respectively
5 If there is a primary command routine address in bytes 99 and 100 of the character's buffer, jump to it
6 Replace any continual subcommand routine address in bytes 124 and 125 of the character's buffer with 25247 (RET)
7 Collect the next primary command routine address from the command list, place it into bytes 99 and 100 of the character's buffer, and jump to it
The address of one of the following uninterruptible subcommand routines may be present in bytes 111 and 112 of a character's buffer:
27206 Deal with a character who has been knocked over
27733 Deal with a character who's been dethroned (1)
27748 Deal with a character who's been dethroned (2)
27772 Deal with a character who is looking for a seat
27932 Control the horizontal flight of a catapult pellet
28102 Control the vertical flight of a catapult pellet
28544 Make ANGELFACE throw a punch (1)
28558 Make ANGELFACE throw a punch (2)
28642 Make ANGELFACE throw a punch (3)
28655 Make ANGELFACE throw a punch (4)
28716 Make BOY WANDER fire his catapult (2)
28733 Make BOY WANDER fire his catapult (3)
28744 Make BOY WANDER fire his catapult (4)
28775 Make BOY WANDER fire his catapult (5)
28786 Make BOY WANDER fire his catapult (6)
28799 Make BOY WANDER his fire catapult (7)
63390 Make a character find ERIC
The address of one of the following continual subcommand routines will be present in bytes 124 and 125 of a character's buffer:
25247 RET (do nothing)
27126 Make a little boy trip people up
28446 Make ANGELFACE hit now and then
28672 Make BOY WANDER fire his catapult now and then
32234 Make a character walk fast
64042 Check whether ANGELFACE is touching ERIC
The address of one of the following interruptible subcommand routines (or an entry point thereof) may be present in bytes 105 and 106 of a character's buffer:
25404 Guide a character to an intermediate destination
25484 Guide a character up a staircase
25488 Guide a character down a staircase
29148 Make a teacher wipe a blackboard (1)
29175 Make a teacher wipe a blackboard (2)
29284 Make a character write on a blackboard
31110 Make a character speak (1)
31130 Make a character speak (2)
31648 Make a teacher find the truant ERIC
31739 Move a character looking for ERIC from the midstride position
31944 Make a teacher wait for EINSTEIN to finish speaking
The address of one of the following primary command routines (or an entry point thereof) may be present in bytes 99 and 100 of a character's buffer:
25247 Do nothing
25303 Make a character walk up and down until a certain time
25534 Make a character go to a location
27111 Make a character go to a random location
27246 Make little boy no. 1 go to a place at random and trip people up on the way
27266 Make a little boy find and follow little boy no. 1
27442 Send a character on a mini-walkabout
27453 Make a character walk up and down a few times or until a certain time
27476 Lower the signal for a certain event
27480 Raise the signal for a certain event
27808 Make a character find a seat
31162 Control EINSTEIN during class (1)
31178 Control EINSTEIN during class (2)
31807 Restart the command list unless it's time to start the lesson
31815 Restart the command list
31834 Place a continual subcommand routine address into a character's buffer
31854 Make a teacher perform dinner duty (1)
31895 Make a teacher perform dinner duty (2)
32048 Make a teacher conduct a class without ERIC
32132 Make a teacher tell the kids to sit down
32158 Make BOY WANDER write on a blackboard
32167 Make BOY WANDER write on a blackboard if the teacher hasn't arrived yet
32178 Make a teacher conduct a class
62208 Make a teacher conduct a class with ERIC
62464 Make a teacher conduct a question-and-answer session
63374 Make a character find ERIC
63456 Make MR WACKER give ERIC 2000 lines
63488 Make little boy no. 10 give ERIC a message
63964 Make a teacher tell ERIC to go home, and end the game (1)
64035 Restart command list 220
25155 LD L,112 Bytes 111 and 112 of the character's buffer may contain the address of an uninterruptible subcommand
25157 LD A,(HL) Pick up the MSB in A
25158 AND A Is there an uninterruptible subcommand routine address here?
25161 LD L,124 Pick up in DE the continual subcommand routine address from bytes 124 and 125 of the character's buffer; this is set to 25247 (RET) initially by the startup routine at 26880
25163 LD E,(HL)
25164 INC L
25165 LD D,(HL)
25166 LD BC,25172 Go to the continual subcommand routine address in bytes 124 and 125 of the character's buffer, and then return to 25172 (below)
25169 PUSH BC
25170 PUSH DE
25171 RET
This entry point is used by the routine at 25248.
25172 LD L,106 Bytes 105 and 106 of the character's buffer may contain the address of an interruptible subcommand
25174 LD A,(HL) Pick up the MSB in A
25175 AND A Is there an interruptible subcommand routine address here?
25178 LD L,121 Byte 121 of the character buffers is unused and always contains zero; hence this jump is always made
25180 LD A,(HL)
25181 AND A
25182 JR Z,25191
25184 LD (HL),0 If the value of byte 121 were not zero, this would treat it as the MSB of a routine address, copy it to byte 112, and then jump to that routine
25186 LD L,112
25188 LD (HL),A
25189 JR 25241
If we get here, that means there's no uninterruptible subcommand routine address in bytes 111 and 112 and no interruptible subcommand routine address in bytes 105 and 106 of the character's buffer at the moment. We take this opportunity to check whether a command list restart has been requested, by inspecting bit 0 of byte 122. This bit is set by the routine at 26342 when starting a new lesson, and by the routine at 63931 when ERIC has accumulated 10000 lines or more and MR WACKER must find him and send him home. In addition, a command in the command list may have requested a restart (see 31807, 31815).
25191 LD L,122 Pick up byte 122 of the character's buffer in A
25193 LD A,(HL)
25194 RRCA If bit 1 is reset (which it always is) and bit 0 is set, the command list will be restarted
25195 JR NC,25213
25197 RRCA
25198 JR C,25213
The command list will be restarted.
25200 RES 0,(HL) Reset bit 0 of byte 122
25202 LD L,119 Copy the start address of the command list from bytes 119 and 120 of the character's buffer into bytes 117 and 118 (which hold the address currently reached in the command list); in effect, this restarts the command list
25204 LD E,117
25206 LD D,H
25207 LDI
25209 LDI
25211 JR 25219 Collect the address of the first command from the command list and jump to it
The command list was not marked for a restart.
25213 LD L,100 Bytes 99 and 100 of the character's buffer hold the address of the current primary command routine from the command list; jump to this routine address if it's present
25215 LD A,(HL)
25216 AND A
25217 JR NZ,25241
25219 LD L,124 Place 25247 (RET) into bytes 124 and 125 of the character's buffer, thus resetting the continual subcommand
25221 LD (HL),159
25223 INC L
25224 LD (HL),98
This entry point is used by the routine at 31834.
25226 LD L,99 Get the address of the next primary command routine from the command list and place it into bytes 99 and 100 of the character's buffer and also into BC
25228 CALL 24972
25231 LD (HL),A
25232 LD C,A
25233 INC L
25234 CALL 24972
25237 LD (HL),A
25238 LD B,A