![]() |
Routines |
| Prev: F1E3 | Up: Map | Next: F280 |
|
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:
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:
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:
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:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 |