Routines |
Prev: $1A51 | Up: Map | Next: $1BFA |
This corresponds to $7ADC in the ZX Spectrum version.
Called from the main loop at $0800, and also used by the routine at $0C3F. Returns with one of the following values in A depending on the relative locations of the follower and his target:
|
||||||||||||||||||||
$1B2E | LDA #$60 | Prepare to address the target character's buffer. | ||||||||||||||||||
$1B30 | STA $4E | |||||||||||||||||||
$1B32 | LDA #$78 | |||||||||||||||||||
$1B34 | CLC | |||||||||||||||||||
$1B35 | ADC $4D | |||||||||||||||||||
$1B37 | STA $4F | |||||||||||||||||||
$1B39 | LDY #$00 | Pick up the target character's x-coordinate and copy it to $08. | ||||||||||||||||||
$1B3B | INY | |||||||||||||||||||
$1B3C | LDA ($4E),Y | |||||||||||||||||||
$1B3E | STA $08 | |||||||||||||||||||
$1B40 | INY | Pick up the target character's y-coordinate and copy it to $09. | ||||||||||||||||||
$1B41 | LDA ($4E),Y | |||||||||||||||||||
$1B43 | STA $09 | |||||||||||||||||||
$1B45 | JSR $1C8E | Is the follower on a staircase? | ||||||||||||||||||
$1B48 | BCC $1B6E | Branch if not. | ||||||||||||||||||
The follower is on a staircase.
|
||||||||||||||||||||
$1B4A | LDA $FC | Pick up the follower's x-coordinate. | ||||||||||||||||||
$1B4C | CMP #$30 | Is the follower on a staircase on the right side of the skool? | ||||||||||||||||||
$1B4E | BCS $1B5F | Branch if so. | ||||||||||||||||||
$1B50 | LDA $26 | Pick up the follower's animatory state. | ||||||||||||||||||
$1B52 | ASL A | Is the follower facing right? | ||||||||||||||||||
$1B53 | BCS $1B5A | Branch if so. | ||||||||||||||||||
$1B55 | LDA #$01 | Return with A=1: the follower should continue going upstairs. | ||||||||||||||||||
$1B57 | JMP $1BF9 | |||||||||||||||||||
$1B5A | LDA #$02 | Return with A=2: the follower should continue going downstairs. | ||||||||||||||||||
$1B5C | JMP $1BF9 | |||||||||||||||||||
$1B5F | LDA $26 | Pick up the follower's animatory state. | ||||||||||||||||||
$1B61 | ASL A | Is the follower facing right? | ||||||||||||||||||
$1B62 | BCS $1B69 | Branch if so. | ||||||||||||||||||
$1B64 | LDA #$02 | Return with A=2: the follower should continue going downstairs. | ||||||||||||||||||
$1B66 | JMP $1BF9 | |||||||||||||||||||
$1B69 | LDA #$01 | Return with A=1: the follower should continue going upstairs. | ||||||||||||||||||
$1B6B | JMP $1BF9 | |||||||||||||||||||
The follower is not on a staircase.
|
||||||||||||||||||||
$1B6E | LDA $FB | Pick up the follower's y-coordinate from $FB. | ||||||||||||||||||
$1B70 | CMP $09 | Does it match the target's y-coordinate? | ||||||||||||||||||
$1B72 | BNE $1B7F | Branch if not. | ||||||||||||||||||
$1B74 | LDA $FC | Pick up the follower's x-coordinate from $FB. | ||||||||||||||||||
$1B76 | CMP $08 | Does it match the target's x-coordinate? | ||||||||||||||||||
$1B78 | BNE $1B7F | Branch if not. | ||||||||||||||||||
$1B7A | LDA #$00 | Return with A=0: the follower is at the same coordinates as the target. | ||||||||||||||||||
$1B7C | JMP $1BF9 | |||||||||||||||||||
$1B7F | LDA $FB | Pick up the follower's y-coordinate from $FB. | ||||||||||||||||||
$1B81 | PHA | Save it temporarily. | ||||||||||||||||||
$1B82 | LDA $09 | Change the follower's y-coordinate to match that of the target. | ||||||||||||||||||
$1B84 | STA $FB | |||||||||||||||||||
$1B86 | JSR $1C8E | Check whether the target is on a staircase. | ||||||||||||||||||
$1B89 | PLA | Restore the follower's y-coordinate at $FB. | ||||||||||||||||||
$1B8A | STA $FB | |||||||||||||||||||
$1B8C | BCC $1B9D | Branch unless the target is on a staircase. | ||||||||||||||||||
$1B8E | CMP $09 | Is the target's y-coordinate less than the follower's? | ||||||||||||||||||
$1B90 | BCS $1B99 | Branch if so. | ||||||||||||||||||
$1B92 | LDA #$11 | Set the target y-coordinate at $09 to 17 (bottom floor). | ||||||||||||||||||
$1B94 | STA $09 | |||||||||||||||||||
$1B96 | JMP $1B9D | Jump forward. | ||||||||||||||||||
$1B99 | LDA #$03 | Set the target y-coordinate at $09 to 3 (top floor). | ||||||||||||||||||
$1B9B | STA $09 | |||||||||||||||||||
$1B9D | LDY $FB | Pick up the follower's x- and y-coordinates from $FB and $FC. | ||||||||||||||||||
$1B9F | LDX $FC | |||||||||||||||||||
$1BA1 | JSR $126D | Get the play area region identifier for the follower's location and store it at $57. | ||||||||||||||||||
$1BA4 | STA $57 | |||||||||||||||||||
$1BA6 | LDY $09 | Get the play area region identifier for the target location and store it at $56. | ||||||||||||||||||
$1BA8 | LDX $08 | |||||||||||||||||||
$1BAA | JSR $126D | |||||||||||||||||||
$1BAD | STA $56 | |||||||||||||||||||
$1BAF | CMP $57 | Is the follower in the same region as the target? | ||||||||||||||||||
$1BB1 | BNE $1BC3 | Branch if not. | ||||||||||||||||||
$1BB3 | LDA $FC | Pick up the follower's x-coordinate from $FC. | ||||||||||||||||||
$1BB5 | CMP $08 | Is it less than the target x-coordinate? | ||||||||||||||||||
$1BB7 | BCC $1BBE | Branch if so. | ||||||||||||||||||
$1BB9 | LDA #$03 | Return with A=3: the follower should go left. | ||||||||||||||||||
$1BBB | JMP $1BF9 | |||||||||||||||||||
$1BBE | LDA #$04 | Return with A=4: the follower should go right. | ||||||||||||||||||
$1BC0 | JMP $1BF9 | |||||||||||||||||||
$1BC3 | BCC $1BD5 | Branch if the follower's region ID is greater than the target's. | ||||||||||||||||||
$1BC5 | LDA $57 | Pick up the follower's region ID from $57. | ||||||||||||||||||
$1BC7 | CMP #$02 | Is it 2 or more? | ||||||||||||||||||
$1BC9 | BCS $1BD0 | Branch if so. | ||||||||||||||||||
$1BCB | LDA #$0C | This is the x-coordinate of the tops of the staircases on the left side of the skool. | ||||||||||||||||||
$1BCD | JMP $1BE2 | Jump forward. | ||||||||||||||||||
$1BD0 | LDA #$46 | This is the x-coordinate of the bottoms of the staircases on the right side of the skool. | ||||||||||||||||||
$1BD2 | JMP $1BE2 | Jump forward. | ||||||||||||||||||
$1BD5 | LDA $57 | Pick up the follower's region ID from $57. | ||||||||||||||||||
$1BD7 | CMP #$03 | Is it 3 or more? | ||||||||||||||||||
$1BD9 | BCS $1BE0 | Branch if so. | ||||||||||||||||||
$1BDB | LDA #$13 | This is the x-coordinate of the bottoms of the staircases on the left side of the skool. | ||||||||||||||||||
$1BDD | JMP $1BE2 | Jump forward. | ||||||||||||||||||
$1BE0 | LDA #$4D | This is the x-coordinate of the tops of the staircases on the right side of the skool. | ||||||||||||||||||
$1BE2 | STA $08 | Store the staircase endpoint x-coordinate at $08. | ||||||||||||||||||
$1BE4 | CMP $FC | Is the follower at the staircase endpoint? | ||||||||||||||||||
$1BE6 | BNE $1BB3 | Branch if not. | ||||||||||||||||||
$1BE8 | LDA $FC | Pick up the follower's x-coordinate from $FC. | ||||||||||||||||||
$1BEA | CMP #$13 | Is the follower at the bottom of a staircase on the left side of the skool? | ||||||||||||||||||
$1BEC | BEQ $1BF7 | Branch if so. | ||||||||||||||||||
$1BEE | CMP #$46 | Is the follower at the bottom of a staircase on the right side of the skool? | ||||||||||||||||||
$1BF0 | BEQ $1BF7 | Branch if so. | ||||||||||||||||||
$1BF2 | LDA #$02 | Return with A=2: the follower should go downstairs. | ||||||||||||||||||
$1BF4 | JMP $1BF9 | |||||||||||||||||||
$1BF7 | LDA #$01 | Return with A=1: the follower should go upstairs. | ||||||||||||||||||
$1BF9 | RTS |
Prev: $1A51 | Up: Map | Next: $1BFA |