![]() |
Routines |
Step | Action | 1 | If there is a routine address in bytes 105/106 of the character's buffer, jump to it | 2 | Restart the command list if bits 1 and 0 of byte 122 are reset and set respectively | 3 | If there is a command list routine address in bytes 99/100 of the character's buffer, jump to it | 4 | Cancel any controlling routine address in bytes 124/125 of the character's buffer | 5 | Collect the next routine address from the command list and jump to it |
---|
Address | Description | 25404 | Guide character to intermediate destination | 25484 | Guide character up a staircase | 25488 | Guide character down a staircase | 29148 | Make teacher wipe blackboard (1) | 29175 | Make teacher wipe blackboard (2) | 29284 | Make character write on a blackboard | 29329 | Make character write on a blackboard | 31110 | Make a character speak | 31116 | Make a character speak | 31130 | Make a character speak (2) | 31648 | Make teacher track down the truant ERIC (1) | 31739 | Move character looking for ERIC one step in the right direction | 31944 | Make teacher wait for EINSTEIN to finish speaking (2) |
---|
H | Character number (152-169) |
25172 | LD L,106 | Bytes 105/106 may contain a routine address |
25174 | LD A,(HL) | Pick up the MSB in A |
25175 | AND A | Is there a routine address here? |
25176 | JR NZ,25241 | Jump to it if so |
25178 | LD L,121 | Byte 121 of the character buffers is apparently 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 |
25191 | LD L,122 | Pick up byte 122 of the character's buffer in A |
25193 | LD A,(HL) | |
25194 | RRCA | If bit 0 is set and bit 1 is reset, the command list will be restarted |
25195 | JR NC,25213 | |
25197 | RRCA | |
25198 | JR C,25213 | |
25200 | RES 0,(HL) | Reset bit 0 of byte 122 |
25202 | LD L,119 | Copy bytes 119 and 120 of the character's buffer (which hold the start address of the command list) 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 first instruction from the command list and run it |
25213 | LD L,100 | Bytes 99 and 100 of the character's buffer hold the address of the current 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) in bytes 124 and 125 of the character's buffer (effectively cancelling any controlling routine address placed there by 31834) |
25221 | LD (HL),159 | |
25223 | INC L | |
25224 | LD (HL),98 |
25226 | LD L,99 | Get the address of the next routine in the command list and place it in bytes 99 and 100 of the character's buffer and also in 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 | Make an indirect jump to the routine address in BC |
25247 | RET |