Prev: F1E3 Up: Map Next: F280
F1FC: Move the characters
Called from the main loop at F02B.
F1FC LD HL,$7FA2 The blown fuse delay counters are stored at 7FA2
F1FF LD B,$05 Set A to a non-zero value if any of the fuses are currently blown
F201 LD A,(HL)
F202 INC L
F203 OR (HL)
F204 DJNZ $F202
F206 LD ($7FB4),A Store this value at 7FB4
F209 CALL $F20F Move one character
F20C CALL $F20F Move the next character
F20F LD HL,$7FFB 7FFB holds the number of the character just moved
F212 INC (HL) Increment this
F213 LD A,(HL) A=number of the character to move next
F214 CP $E6 Is it Sam?
F216 JR NZ,$F21B Jump if not
F218 LD A,$D7 Rewind to character 0xD7 (we don't want to move Sam)
F21A LD (HL),A Store the number of the character to be moved next
F21B LD H,A H=number of the character to move next (0xD7-0xE5)
First check whether the character is immobilised by a blown fuse.
F21C LD A,($7FB4) Collect the blown fuse indicator from 7FB4
F21F AND A Are any fuses currently blown?
F220 CALL NZ,$714C If so, check to see whether the character is immobilised by a blown fuse
F223 RET C Return if the character is immobilised
Now to determine whether to move the character this time round. The answer will be yes if bit 7 of byte 0x03 of the character's buffer is set (indicating that he is running), or if bit 6 of byte 0x03 (which is flipped on each pass through this routine) is set.
F224 LD L,$03 Point HL at byte 0x03 of the character's buffer
F226 BIT 7,(HL) Is the character running?
F228 JR NZ,$F231 Jump if so
F22A LD A,(HL) Flip bit 6 of byte 0x03 of the character's buffer
F22B XOR $40
F22D LD (HL),A
F22E AND $40 Is bit 6 set now?
F230 RET Z Return if not
The character will be moved. From this point, the following steps are taken:
Step Action
1 If there is an uninterruptible subcommand routine address in bytes 0x12 and 0x13 of the character's buffer, jump to it
2 If there is a continual subcommand routine address in bytes 0x1B and 0x1C of the character's buffer - which there never is - call it (and then return to step 3)
3 If there is an interruptible subcommand routine address in bytes 0x0E and 0x0F of the character's buffer, jump to it
4 Restart the command list if bit 4 of byte 0x03 of the character's buffer is set (and carry on to step 5)
5 If there is a primary command routine address in bytes 0x08 and 0x09 of the character's buffer, jump to it
6 Remove any continual subcommand routine address from bytes 0x1B and 0x1C of the character's buffer
7 Collect the next primary command routine address from the command list, place it into bytes 0x08 and 0x09 of the character's buffer, and jump to it
The address of one of the following uninterruptible subcommand routines (or an entry point thereof) may be present in bytes 0x12 and 0x13 of the character's buffer:
Address Description
7BB6 Control the hook while it's flying
FA05 Deal with a character who has been knocked over
FA83 Deal with a character who has nearly recovered from being knocked over
FB4B Control a character who has stepped off the roof of a building
The address of one of the following interruptible subcommand routines (or an entry point thereof) may be present in bytes 0x0E and 0x0F of the character's buffer:
Address Description
621E Control the sniper while active
7A57 Make a gangster walk up or down until Sam arrives
F346 Control a character who is knocking on or opening a door (1)
F359 Control a character who has knocked on a door and is waiting for an answer
F383 Control a character who is knocking on or opening a door (3)
F5AC Guide a character up or down staircases
F5CE Guide a character across a floor to his destination
F5FB Guide a character from one spot on the sidewalk or road to another
F6E9 Make a character walk up or down
F846 Make a cat run up or down
The address of one of the following primary command routines (or an entry point thereof) may be present in bytes 0x08 and 0x09 of the character's buffer:
Address Description
615D Reset a gangster's location and restart the command list
61F9 Make the gangster at no. 15 lie in wait for Sam
62DB Control the sniper
6329 Make a gangster chase Sam
634C Control a banknote
72AA Control a policeman (1)
72B1 Control a policeman (2)
7A6A Make a gangster walk up and down while watching for Sam
7B6A Let Sam out of jail if necessary
E70B Do nothing
F600 Make a character go to a location
F6DE Restart the command list
F731 Make a character drop Sam
F748 Make a character walk up and down until somebody knocks on a door
F7BF Make a character open a door that has been knocked on
F820 Make a character walk up and down for a while
F82A Control a cat
F231 LD L,$13 Is there an uninterruptible subcommand routine address in bytes 0x12 and 0x13 of the character's buffer?
F233 LD A,(HL)
F234 AND A
F235 JR NZ,$F27B Jump if so
F237 LD A,H A=number of the character being moved (0xD7-0xE5)
F238 CP $DE Does the character belong to one of the character groups 0xD7-0xDD?
F23A JR C,$F24D Jump if so
We're dealing with one of the primary characters (0xDE-0xE5). Here we check whether there is a continual subcommand routine address in bytes 0x1B and 0x1C of the character's buffer. The answer is always no.
F23C LD L,$1C Byte 0x1C is unused and always holds 0
F23E LD A,(HL)
F23F AND A
F240 JR Z,$F24D This jump is always made
F242 PUSH HL Save the character number
F243 LD BC,$F24C We will return to F24C (below) after calling the subcommand routine
F246 PUSH BC
F247 LD B,A Collect the continual subcommand routine address into BC
F248 DEC L
F249 LD C,(HL)
F24A PUSH BC Push it onto the stack
F24B RET Call the continual subcommand routine and then return to F24C (below)
F24C POP HL Restore the character number to H
This entry point is used by the routine at F280.
F24D LD L,$0F Is there an interruptible subcommand routine address in bytes 0x0E and 0x0F of the character's buffer?
F24F LD A,(HL)
F250 AND A
F251 JR NZ,$F27B Jump if so
Bit 4 of byte 0x03 of the character's buffer is never set, but if it were, it would mean that the character's command list should be restarted. Check bit 4 of byte 0x03 now.
F253 LD L,$03 Bit 4 of byte 0x03 is unused and always reset
F255 BIT 4,(HL)
F257 JR Z,$F267 This jump is always made
F259 RES 4,(HL) Reset bit 4 of byte 0x03
F25B LD L,$1A Copy the command list address from bytes 0x19 and 0x1A of the character's buffer into bytes 0x17 and 0x18
F25D LD D,H
F25E LD E,$18
F260 LDD
F262 LDD
F264 LD (DE),A Set byte 0x16 of the character's buffer (which holds the offset reached in the command list) to 0
F265 JR $F26D
Now we look for a primary command routine address.
F267 LD L,$09 Is there a primary command routine address in bytes 0x08 and 0x09 of the character's buffer?
F269 LD A,(HL)
F26A AND A
F26B JR NZ,$F27B Jump if so
F26D LD A,H A=number of the character being moved (0xD7-0xE5)
F26E CP $DE Does the character belong to one of the character groups 0xD7-0xDD?
F270 JR C,$F276 Jump if so
F272 LD L,$1C Remove any continual subcommand routine address from bytes 0x1B and 0x1C of the character's buffer
F274 LD (HL),$00
F276 LD L,$08 Copy the next primary command routine address from the command list into bytes 0x08 and 0x09 of the character's buffer
F278 CALL $F171
F27B LD B,(HL) Copy the address of the primary command or subcommand routine into BC
F27C DEC L
F27D LD C,(HL)
F27E PUSH BC Make an indirect jump to the routine
F27F RET
Prev: F1E3 Up: Map Next: F280