Prev: $0E58 Up: Map Next: $0EB4
$0E59: Check whether a boy can be seen by a teacher
This corresponds to $6E3C in the ZX Spectrum version.
Used by the routines at $149F, $191B, $270D and $2CA5.
Output
P Carry flag set if the boy can be seen by a teacher
A Teacher's character number ($0B-$0E)
$0E59 LDA #$FF A=$FF, corresponding to no particular teacher.
This entry point is used by the routine at $149F with A holding a teacher's character number.
$0E5B STA $78 Store $FF or the teacher's character number at $78.
$0E5D JSR $0BAC Compute the coordinate ranges within which the boy can be seen.
$0E60 LDA #$0B Character number $0B is MR WACKER.
$0E62 STA $07 Store the teacher's character number at $07.
$0E64 CMP $78 Does this teacher's character number match the one at $78?
$0E66 BEQ $0EA3 Branch if so to skip this teacher.
$0E68 JSR $0D67 Can the teacher see the boy?
$0E6B BCC $0EA3 Branch if not.
$0E6D LDA #$78 Store the base address of the teacher's character buffer at $4E.
$0E6F CLC
$0E70 ADC $07
$0E72 STA $4F
$0E74 LDA #$60
$0E76 STA $4E
$0E78 LDY #$00 Pick up the teacher's animatory state and store it at $0A.
$0E7A LDA ($4E),Y
$0E7C STA $0A
$0E7E INY Pick up the teacher's x-coordinate and store it at $0B.
$0E7F LDA ($4E),Y
$0E81 STA $0B
$0E83 LDY #$10 Is the teacher currently controlled by an uninterruptible subcommand routine?
$0E85 LDA ($4E),Y
$0E87 BNE $0EA3 Consider the next teacher if so (this one is busy).
$0E89 LDA $FC Pick up the boy's x-coordinate from $FC.
$0E8B INC $0B Is the boy's x-coordinate greater than the teacher's?
$0E8D CMP $0B
$0E8F BCS $0E9A Branch if so.
$0E91 LDA $0A Pick up the teacher's animatory state.
$0E93 ASL A Is the teacher facing the boy?
$0E94 BCS $0EA3 Branch if not.
$0E96 SEC Set the carry flag: the boy can be seen.
$0E97 JMP $0EB1 Jump forward.
$0E9A LDA $0A Pick up the teacher's animatory state.
$0E9C ASL A Is the teacher facing the boy?
$0E9D BCC $0EA3 Branch if not.
$0E9F SEC Set the carry flag: the boy can be seen.
$0EA0 JMP $0EB1 Jump forward.
$0EA3 LDA $07 Pick up the teacher's character number.
$0EA5 CMP #$0E Have we checked all four teachers yet?
$0EA7 BEQ $0EB0 Branch if so.
$0EA9 INC $07 Next teacher.
$0EAB LDA $07 Pick up the next teacher's character number.
$0EAD JMP $0E64 Jump back to consider him.
$0EB0 CLC Clear the carry flag: the boy cannot be seen.
$0EB1 LDA $07 Pick up the teacher's character number.
$0EB3 RTS
Prev: $0E58 Up: Map Next: $0EB4