![]() |
Routines |
| Prev: 6E33 | Up: Map | Next: 6E8F |
|
||||||||
| 6E3C | CALL $6E90 | Get the floor (0x9B, 0xA2, 0xA9) nearest to the character in D | ||||||
|
This entry point is used by the routine at 77AC.
|
||||||||
| 6E3F | CALL $6EA7 | Get the teacher's visibility range in [C,B] | ||||||
| 6E42 | EXX | |||||||
| 6E43 | LD B,$04 | There are 4 teachers | ||||||
| 6E45 | LD H,$A3 | And the first is 0xA3=MR WACKER | ||||||
| 6E47 | LD L,$62 | Collect the teacher's x-coordinate from byte 0x62 of his buffer | ||||||
| 6E49 | LD A,(HL) | |||||||
| 6E4A | EXX | |||||||
| 6E4B | CP B | Is the teacher at or to the left of the upper bound of the visibility range? | ||||||
| 6E4C | JR Z,$6E57 | Jump if so | ||||||
| 6E4E | JR C,$6E57 | |||||||
| 6E50 | EXX | |||||||
| 6E51 | INC H | Next teacher | ||||||
| 6E52 | DJNZ $6E47 | Jump back until all four teachers are done | ||||||
| 6E54 | AND A | Clear the carry flag to indicate that the boy wasn't seen by a teacher | ||||||
| 6E55 | EXX | |||||||
| 6E56 | RET | |||||||
| 6E57 | CP C | Is the teacher to the left of the lower bound of the visibility range? | ||||||
| 6E58 | JR C,$6E50 | Jump back to consider the next teacher if so | ||||||
|
The teacher's x-coordinate is within the visibility range [C,B]. Now check his y-coordinate.
|
||||||||
| 6E5A | EXX | |||||||
| 6E5B | LD L,$70 | Is there an uninterruptible subcommand routine address in bytes 0x6F and 0x70 of the teacher's buffer? | ||||||
| 6E5D | LD A,(HL) | |||||||
| 6E5E | AND A | |||||||
| 6E5F | JR NZ,$6E51 | Jump back to consider the next teacher if so (this one is occupied) | ||||||
| 6E61 | LD L,$61 | Collect the teacher's y-coordinate from byte 0x61 of his buffer | ||||||
| 6E63 | LD A,(HL) | |||||||
| 6E64 | INC L | L=0x62 | ||||||
| 6E65 | EXX | |||||||
| 6E66 | CP $9E | Is the teacher near or on the top floor? | ||||||
| 6E68 | JR NC,$6E6E | Jump if not | ||||||
| 6E6A | LD A,$9B | This is the y-coordinate of the top floor | ||||||
| 6E6C | JR $6E76 | |||||||
| 6E6E | CP $A5 | |||||||
| 6E70 | LD A,$A2 | This is the y-coordinate of the middle floor | ||||||
| 6E72 | JR C,$6E76 | Jump if the teacher is near or on the middle floor | ||||||
| 6E74 | LD A,$A9 | This is the y-coordinate of the bottom floor | ||||||
| 6E76 | CP D | Is the teacher within the y-coordinate visibility range? | ||||||
| 6E77 | JR NZ,$6E50 | Jump back to consider the next teacher if not | ||||||
|
The teacher is close enough to the boy to see him. But is the teacher facing the right way?
|
||||||||
| 6E79 | EXX | |||||||
| 6E7A | LD A,(HL) | A=teacher's x-coordinate | ||||||
| 6E7B | EXX | |||||||
| 6E7C | CP E | Is the teacher standing right where the boy is? | ||||||
| 6E7D | SCF | Return with the carry flag set if so | ||||||
| 6E7E | RET Z | |||||||
| 6E7F | CP E | A=0x80 if the boy is to the right of the teacher, 0x00 if the boy is to the left | ||||||
| 6E80 | LD A,$00 | |||||||
| 6E82 | RRA | |||||||
| 6E83 | EXX | |||||||
| 6E84 | LD L,$60 | Byte 0x60 of the teacher's buffer holds his animatory state | ||||||
| 6E86 | XOR (HL) | Reset bit 7 of A if the teacher is facing the boy | ||||||
| 6E87 | LD L,$62 | |||||||
| 6E89 | EXX | |||||||
| 6E8A | RLCA | Push bit 7 of A into the carry flag | ||||||
| 6E8B | CCF | Return with the carry flag set if the teacher is facing the boy | ||||||
| 6E8C | RET C | |||||||
| 6E8D | JR $6E50 | Otherwise consider the next teacher | ||||||
| Prev: 6E33 | Up: Map | Next: 6E8F |