Prev: $1B2E Up: Map Next: $1C59
$1BFA: Check whether a chair is occupied and unseat any occupant
This corresponds to $6B97 in the ZX Spectrum version.
Used by the routine at $1C59.
Input
($57) Potential occupant's character number
$1BFA LDA #$60 Store the base address of little boy no. 1's character buffer ($7860) at $4E.
$1BFC STA $4E
$1BFE LDA #$78
$1C00 STA $4F
$1C02 LDX $57 Modify the address stored at $4E until it matches that of the target boy's character buffer.
$1C04 BEQ $1C0B
$1C06 INC $4F
$1C08 DEX
$1C09 BNE $1C06
$1C0B LDY #$00 Pick up the target boy's animatory state and store it at $0A.
$1C0D LDA ($4E),Y
$1C0F STA $0A
$1C11 INY Pick up the target boy's y-coordinate and store it at $0B.
$1C12 LDA ($4E),Y
$1C14 STA $0B
$1C16 INY Pick up the target boy's x-coordinate and store it at $0C.
$1C17 LDA ($4E),Y
$1C19 STA $0C
$1C1B LDY #$0F Pick up the address of the target boy's uninterruptible subcommand routine and store it at $0D.
$1C1D LDA ($4E),Y
$1C1F STA $0D
$1C21 INY
$1C22 LDA ($4E),Y
$1C24 STA $0E
$1C26 LDA $FC Pick up the current character's y-coordinate.
$1C28 CMP $0B Does it match that of the target boy?
$1C2A BNE $1C58 Branch if not.
$1C2C LDA $FB Pick up the current character's x-coordinate.
$1C2E CMP $0C Does it match that of the target boy?
$1C30 BNE $1C58 Branch if not.
$1C32 LDA $0A Pick up the target boy's animatory state.
$1C34 AND #$07 Keep only bits 0-2.
$1C36 CMP #$05 Is the target boy sitting on a chair?
$1C38 BNE $1C58 Branch if not.
$1C3A LDA $57 Pick up the character number of the target boy.
$1C3C CMP #$14 Is it $14 (ERIC)?
$1C3E BNE $1C49 Branch if not.
$1C40 LDA $2B Set bit 4 of ERIC's status flags at $2B: ERIC has just been unseated.
$1C42 ORA #$10
$1C44 STA $2B
$1C46 JMP $1C58 Return.
$1C49 LDA $0E $0E holds the MSB of the target character's uninterruptible subcommand routine.
$1C4B BNE $1C58 Return if the target boy is currently controlled by an uninterruptible subcommand.
$1C4D LDY #$0F Place the address of the uninterruptible subcommand routine at $1CB4 into the seated boy's character buffer.
$1C4F LDA #$B4
$1C51 STA ($4E),Y
$1C53 INY
$1C54 LDA #$1C
$1C56 STA ($4E),Y
$1C58 RTS
Prev: $1B2E Up: Map Next: $1C59