Routines |
Prev: F731 | Up: Map | Next: F79A |
|
||||||||
F748 | LD L,$0B | Copy the door identifier (0xA8, 0xAC, 0xAD or 0xB3) and walkabout duration indicator (0x00 or 0xFF) from the command list into bytes 0x0B and 0x0C of the character's buffer | ||||||
F74A | CALL $F171 | |||||||
This entry point is used by the routine at F820.
|
||||||||
F74D | CALL $F17F | Get a random number between 32 and 63 in A | ||||||
F750 | AND $1F | |||||||
F752 | ADD A,$20 | |||||||
F754 | LD L,$0D | Store this number in byte 0x0D of the character's buffer; it is the number of mini-walkabouts the character will perform (if the walkabout duration indicator in byte 0x0C is 0xFF) | ||||||
F756 | LD (HL),A | |||||||
F757 | LD L,$01 | Point HL at byte 0x01 of the character's buffer | ||||||
F759 | LD A,(HL) | A=character's x-coordinate | ||||||
F75A | LD L,$0A | Copy this into byte 0x0A of the character's buffer (it will be the walkabout origin) | ||||||
F75C | LD (HL),A | |||||||
F75D | CALL $F7B1 | Change the character's primary command routine address to F760 (below) | ||||||
F760 | LD BC,$F6E9 | Point BC at the interruptible subcommand routine address at F6E9 | ||||||
F763 | LD L,$0B | Collect the door identifier (0xA8, 0xAC, 0xAD, 0xAF or 0xB3) from byte 0x0B of the character's buffer | ||||||
F765 | LD E,(HL) | |||||||
F766 | LD D,$7F | Point HL at 7FA8 (always 0) or the door knock status flags for the door in question (see 7FAA) | ||||||
F768 | EX DE,HL | |||||||
F769 | BIT 7,(HL) | Has somebody knocked at the door? | ||||||
F76B | JR Z,$F775 | Jump if not | ||||||
F76D | LD A,$C0 | Reset bit 7 and set bit 6 of the door knock status flags to indicate that someone is going to answer the door | ||||||
F76F | XOR (HL) | |||||||
F770 | LD (HL),A | |||||||
F771 | EX DE,HL | Restore the character number to H | ||||||
F772 | JP $F280 | Move to the next command in the command list (which will send the character to the door) | ||||||
Either nobody has knocked on the door, or the character is not on door duty.
|
||||||||
F775 | EX DE,HL | Restore the character number to H | ||||||
F776 | LD L,$0C | Collect the walkabout duration indicator (0x00 or 0xFF) from byte 0x0C of the character's buffer | ||||||
F778 | LD A,(HL) | |||||||
F779 | INC L | L=0x0D | ||||||
F77A | ADD A,(HL) | Decrement the walkabout counter in byte 0x0D of the character's buffer, or leave it unchanged | ||||||
F77B | LD (HL),A | |||||||
F77C | LD L,$0A | Point HL at byte 0x0A of the character's buffer | ||||||
F77E | JR NZ,$F78D | Jump unless the walkabout counter is now 0 | ||||||
The character has finished walking up and down. If the character is not on door duty, we move to the next command in the command list; if the character is on door duty, we move six bytes ahead in the command list (past the door-opening commands).
|
||||||||
F780 | INC L | Collect the door identifier (0xA8, 0xAC, 0xAD, 0xAF or 0xB3) from byte 0x0B of the character's buffer | ||||||
F781 | LD A,(HL) | |||||||
F782 | ADD A,$57 | Set the carry flag if it's > 0xA8 (meaning the character was on door duty) | ||||||
F784 | SBC A,A | A=6 if the character was on door duty, 0 otherwise | ||||||
F785 | AND $06 | |||||||
F787 | LD L,$16 | Add 0 or 6 to the character's command list offset (in byte 0x16 of his buffer) | ||||||
F789 | ADD A,(HL) | |||||||
F78A | LD (HL),A | |||||||
F78B | JR $F772 | Terminate this primary command | ||||||
It's time to set another walkabout destination for this character.
|
||||||||
F78D | CALL $F17F | Get a random number in A | ||||||
F790 | OR $F9 | A=-6, -4, -2 or 0 | ||||||
F792 | INC A | |||||||
F793 | ADD A,(HL) | Add the walkabout origin x-coordinate | ||||||
F794 | LD L,$10 | Store this x-coordinate in byte 0x10 of the character's buffer | ||||||
F796 | LD (HL),A | |||||||
F797 | JP $F7AB | Copy the interruptible subcommand routine address (7A57 or F6E9) from BC into bytes 0x0E and 0x0F of the character's buffer, and then jump to it |
Prev: F731 | Up: Map | Next: F79A |