Prev: 25108 Up: Map Next: 25248
25126: Move the characters
Called from the main loop at 26471.
Input
Output
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:
Address Description
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:
Address Description
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:
Address Description
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
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?
25159 JR NZ,25241 Jump to it if so
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?
25176 JR NZ,25241 Jump to it if so
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
25239 JR 25244 Make an indirect jump to the routine address in BC
25241 LD B,A Pick up in BC the address of the routine to hand over control of this character to
25242 DEC L
25243 LD C,(HL)
25244 LD L,122
25246 PUSH BC Prepare to make an indirect jump to the routine address in BC
This entry point is used by command lists 136, 138, 140, 142, 146, 148, 150, 154, 156, 158, 162, 164 and 166.
25247 RET
Prev: 25108 Up: Map Next: 25248