Prev: 6214 Up: Map Next: 62A0
6226: Move the characters
Called from the main loop at 6767.
6226 LD A,($7FFD) 7FFD holds the number of the last character moved
6229 CALL $6235 Move a character
622C LD A,($7FFD)
622F CALL $6235 Move another character
6232 LD A,($7FFD)
6235 CP $AB Get the number of the next character to be moved (0x98-0xAB) in A and copy it to 7FFD
6237 JR NZ,$623B
6239 LD A,$97
623B INC A
623C LD ($7FFD),A
623F LD H,A H=number of the character to be moved
6240 CALL $62B2 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 0x6F and 0x70 of the character's buffer, jump to it
2 Call the continual subcommand routine address in bytes 0x7C and 0x7D of the character's buffer (and then return to step 3)
3 If there is an interruptible subcommand routine address in bytes 0x69 and 0x6A of the character's buffer, jump to it
4 Restart the command list if bits 1 and 0 of byte 0x7A of the character's buffer are reset and set respectively
5 If there is a primary command routine address in bytes 0x63 and 0x64 of the character's buffer, jump to it
6 Replace any continual subcommand routine address in bytes 0x7C and 0x7D of the character's buffer with 629F (RET)
7 Collect the next primary command routine address from the command list, place it into bytes 0x63 and 0x64 of the character's buffer, and jump to it
The address of one of the following uninterruptible subcommand routines may be present in bytes 0x6F and 0x70 of a character's buffer:
Address Description
6A46 Deal with a character who has been knocked over
6C55 Deal with a character who's been dethroned (1)
6C64 Deal with a character who's been dethroned (2)
6C7C Deal with a character who is looking for a seat
6D1C Control the horizontal flight of a catapult pellet
6DC6 Control the vertical flight of a catapult pellet
6F80 Make ANGELFACE throw a punch (1)
6F8E Make ANGELFACE throw a punch (2)
6FE2 Make ANGELFACE throw a punch (3)
6FEF Make ANGELFACE throw a punch (4)
702C Make BOY WANDER fire his catapult (2)
703D Make BOY WANDER fire his catapult (3)
7048 Make BOY WANDER fire his catapult (4)
7067 Make BOY WANDER fire his catapult (5)
7072 Make BOY WANDER fire his catapult (6)
707F Make BOY WANDER his fire catapult (7)
F79E Make a character find ERIC
The address of one of the following continual subcommand routines will be present in bytes 0x7C and 0x7D of a character's buffer:
Address Description
629F RET (do nothing)
69F6 Make a little boy trip people up
6F1E Make ANGELFACE hit now and then
7000 Make BOY WANDER fire his catapult now and then
7DEA Make a character walk fast
FA2A 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 0x69 and 0x6A of a character's buffer:
Address Description
633C Guide a character to an intermediate destination
638C Guide a character up a staircase
6390 Guide a character down a staircase
71DC Make a teacher wipe a blackboard (1)
71F7 Make a teacher wipe a blackboard (2)
7264 Make a character write on a blackboard
7986 Make a character speak (1)
799A Make a character speak (2)
7BA0 Make a teacher find the truant ERIC
7BFB Move a character looking for ERIC from the midstride position
7CC8 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 0x63 and 0x64 of a character's buffer:
Address Description
629F Do nothing
62D7 Make a character walk up and down until a certain time
63BE Make a character go to a location
69E7 Make a character go to a random location
6A6E Make little boy no. 1 go to a place at random and trip people up on the way
6A82 Make a little boy find and follow little boy no. 1
6B32 Send a character on a mini-walkabout
6B3D Make a character walk up and down a few times or until a certain time
6B54 Lower the signal for a certain event
6B58 Raise the signal for a certain event
6CA0 Make a character find a seat
79BA Control EINSTEIN during class (1)
79CA Control EINSTEIN during class (2)
7C3F Restart the command list unless it's time to start the lesson
7C47 Restart the command list
7C5A Place a continual subcommand routine address into a character's buffer
7C6E Make a teacher perform dinner duty (1)
7C97 Make a teacher perform dinner duty (2)
7D30 Make a teacher conduct a class without ERIC
7D84 Make a teacher tell the kids to sit down
7D9E Make BOY WANDER write on a blackboard
7DA7 Make BOY WANDER write on a blackboard if the teacher hasn't arrived yet
7DB2 Make a teacher conduct a class
F300 Make a teacher conduct a class with ERIC
F400 Make a teacher conduct a question-and-answer session
F78E Make a character find ERIC
F7E0 Make MR WACKER give ERIC 2000 lines
F800 Make little boy no. 10 give ERIC a message
F9DC Make a teacher tell ERIC to go home, and end the game (1)
FA23 Restart command list 0xDC
6243 LD L,$70 Bytes 0x6F and 0x70 of the character's buffer may contain the address of an uninterruptible subcommand
6245 LD A,(HL) Pick up the MSB in A
6246 AND A Is there an uninterruptible subcommand routine address here?
6247 JR NZ,$6299 Jump to it if so
6249 LD L,$7C Pick up in DE the continual subcommand routine address from bytes 0x7C and 0x7D of the character's buffer; this is set to 629F (RET) initially by the startup routine at 6900
624B LD E,(HL)
624C INC L
624D LD D,(HL)
624E LD BC,$6254 Go to the continual subcommand routine address in bytes 0x7C and 0x7D of the character's buffer, and then return to 6254 (below)
6251 PUSH BC
6252 PUSH DE
6253 RET
This entry point is used by the routine at 62A0.
6254 LD L,$6A Bytes 0x69 and 0x6A of the character's buffer may contain the address of an interruptible subcommand
6256 LD A,(HL) Pick up the MSB in A
6257 AND A Is there an interruptible subcommand routine address here?
6258 JR NZ,$6299 Jump to it if so
625A LD L,$79 Byte 0x79 of the character buffers is unused and always contains zero; hence this jump is always made
625C LD A,(HL)
625D AND A
625E JR Z,$6267
6260 LD (HL),$00 If the value of byte 0x79 were not zero, this would treat it as the MSB of a routine address, copy it to byte 0x70, and then jump to that routine
6262 LD L,$70
6264 LD (HL),A
6265 JR $6299
If we get here, that means there's no uninterruptible subcommand routine address in bytes 0x6F and 0x70 and no interruptible subcommand routine address in bytes 0x69 and 0x6A 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 0x7A. This bit is set by the routine at 66E6 when starting a new lesson, and by the routine at F9BB 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 7C3F, 7C47).
6267 LD L,$7A Pick up byte 0x7A of the character's buffer in A
6269 LD A,(HL)
626A RRCA If bit 1 is reset (which it always is) and bit 0 is set, the command list will be restarted
626B JR NC,$627D
626D RRCA
626E JR C,$627D
The command list will be restarted.
6270 RES 0,(HL) Reset bit 0 of byte 0x7A
6272 LD L,$77 Copy the start address of the command list from bytes 0x77 and 0x78 of the character's buffer into bytes 0x75 and 0x76 (which hold the address currently reached in the command list); in effect, this restarts the command list
6274 LD E,$75
6276 LD D,H
6277 LDI
6279 LDI
627B JR $6283 Collect the address of the first command from the command list and jump to it
The command list was not marked for a restart.
627D LD L,$64 Bytes 0x63 and 0x64 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
627F LD A,(HL)
6280 AND A
6281 JR NZ,$6299
6283 LD L,$7C Place 629F (RET) into bytes 0x7C and 0x7D of the character's buffer, thus resetting the continual subcommand
6285 LD (HL),$9F
6287 INC L
6288 LD (HL),$62
This entry point is used by the routine at 7C5A.
628A LD L,$63 Get the address of the next primary command routine from the command list and place it into bytes 0x63 and 0x64 of the character's buffer and also into BC
628C CALL $618C
628F LD (HL),A
6290 LD C,A
6291 INC L
6292 CALL $618C
6295 LD (HL),A
6296 LD B,A
6297 JR $629C Make an indirect jump to the routine address in BC
6299 LD B,A Pick up in BC the address of the routine to hand over control of this character to
629A DEC L
629B LD C,(HL)
629C LD L,$7A
629E PUSH BC Prepare to make an indirect jump to the routine address in BC
This entry point is used by command lists 0x88, 0x8A, 0x8C, 0x8E, 0x92, 0x94, 0x96, 0x9A, 0x9C, 0x9E, 0xA2, 0xA4 and 0xA6.
629F RET
Prev: 6214 Up: Map Next: 62A0