Prev: $0B3B Up: Map Next: $0C31
$0BAC: Compute the coordinate ranges within which a character can see or be seen
Used by the routines at $0E59 and $0ECF.
Output
($73) Minimum y-coordinate
($74) Maximum y-coordinate
($75) Minimum x-coordinate
($76) Maximum x-coordinate
$0BAC LDA $FB Pick up the character's y-coordinate from $FB.
$0BAE SEC Subtract 3 to get the minimum y-coordinate.
$0BAF SBC #$03
$0BB1 BPL $0BB5 Branch unless the result is negative.
$0BB3 LDA #$00 The minimum y-coordinate will be 0.
$0BB5 STA $73 Store the minimum y-coordinate at $73.
$0BB7 LDA $FB Pick up the character's y-coordinate from $FB.
$0BB9 CLC Add 3 to get the maximum y-coordinate and store the result at $74.
$0BBA ADC #$03
$0BBC STA $74
$0BBE LDA $FB Pick up the character's y-coordinate from $FB.
$0BC0 CMP #$04 Is the character on the top floor?
$0BC2 BCC $0C05 Branch if so.
$0BC4 CMP #$0B Is the character between the middle and top floors?
$0BC6 BCC $0BE2 Branch if so.
The character is between the bottom and middle floors.
$0BC8 LDA $FC Pick up the character's x-coordinate from $FC.
$0BCA CLC Add 10 to get the maximum x-coordinate and store the result at $76.
$0BCB ADC #$0A
$0BCD STA $76
$0BCF LDA $FC Pick up the character's x-coordinate from $FC.
$0BD1 SEC Subtract 10 from A to get the minimum x-coordinate and store the result at $75.
$0BD2 SBC #$0A
$0BD4 STA $75
$0BD6 BMI $0BDB Branch if the result was negative.
$0BD8 JMP $0C30 Return.
$0BDB LDA #$00 Store 0 (the minimum x-coordinate) at $75.
$0BDD STA $75
$0BDF JMP $0C30 Return.
The character is between the middle and top floors.
$0BE2 LDA $FC Pick up the character's x-coordinate from $FC.
$0BE4 CMP #$26 Is he to the left of the Exam Room wall?
$0BE6 BCC $0BFA Branch if so.
$0BE8 CLC Add 10 to the character's x-coordinate and store it at $76. This is the maximum x-coordinate.
$0BE9 ADC #$0A
$0BEB STA $76
$0BED LDA $FC Pick up the character's x-coordinate from $FC.
$0BEF CMP #$30 Is the character's x-coordinate greater than 47?
$0BF1 BCS $0BD1 Branch if so.
$0BF3 LDA #$26 Store the x-coordinate of the Exam Room wall (38) at $75: teachers can't see through it into the White Room.
$0BF5 STA $75
$0BF7 JMP $0C30 Return.
$0BFA CMP #$1C Is the character's x-coordinate less than 28?
$0BFC BCC $0C28 Branch if so.
$0BFE LDA #$25 Store the x-coordinate of the White Room wall (37) at $76: teachers can't see through it into the Exam Room.
$0C00 STA $76
$0C02 JMP $0BD1 Jump back. (This is a bug. The jump should be to $0BCF instead.)
The character is on the top floor.
$0C05 LDA $FC Pick up the character's x-coordinate from $FC.
$0C07 CMP #$39 Is the character to the left of the Map Room wall?
$0C09 BCC $0C1D Branch if so.
$0C0B CLC Add 10 to the character's x-coordinate and store it at $76. This is the maximum x-coordinate.
$0C0C ADC #$0A
$0C0E STA $76
$0C10 LDA $FC Pick up the character's x-coordinate from $FC.
$0C12 CMP #$43 Is the character's x-coordinate 67 or more?
$0C14 BCS $0BD1 Branch if so.
$0C16 LDA #$39 Store the x-coordinate of the Map Room wall (57) at $75: teachers can't see through it into the Reading Room.
$0C18 STA $75
$0C1A JMP $0C30 Return.
$0C1D CMP #$2F Is the character's x-coordinate less than 47?
$0C1F BCC $0C28 Branch if so.
$0C21 LDA #$38 Store the x-coordinate of the Reading Room wall (56) at $76: teachers can't see through it into the Map Room.
$0C23 STA $76
$0C25 JMP $0BD1 Jump back. (This is a bug. The jump should be to $0BCF instead.)
$0C28 CLC Add 10 to the character's x-coordinate and store it at $76. This is the maximum x-coordinate.
$0C29 ADC #$0A
$0C2B STA $76
$0C2D JMP $0BD1 Jump back. (This is a bug. The jump should be to $0BCF instead.)
$0C30 RTS
Prev: $0B3B Up: Map Next: $0C31