![]() |
Routines |
Prev: 27953 | Up: Map | Next: 28002 |
B | Upper x-coordinate of target range |
C | Lower x-coordinate of target range |
D | y-coordinate of target character |
E | x-coordinate of target character |
B' | Number of spotters to test |
H' | Character number of first spotter to check eyesight of |
27954 | EXX | |
27955 | LD L,2 | Pick up the spotter's coordinates in DE; we are going to check whether this character can see the target |
27957 | LD D,(HL) | |
27958 | DEC L | |
27959 | LD E,(HL) | |
27960 | LD A,D | Transfer the spotter's y-coordinate to A |
27961 | EXX | |
27962 | SUB D | Subtract the target's y-coordinate |
27963 | JR NC,27967 | Jump if the spotter is below or level with the target |
27965 | NEG | |
27967 | CP 4 | Is the spotter within 4 vertical character spaces of the target? |
27969 | JR NC,27980 | Jump if not |
27971 | EXX | |
27972 | LD A,E | A=x-coordinate of spotter |
27973 | EXX | |
27974 | CP C | Compare this with the lower and upper limits of the range within which the target can be seen, and jump to 27987 if the spotter is within seeing range |
27975 | JR C,27980 | |
27977 | CP B | |
27978 | JR C,27987 | |
This entry point is used by the routine at 28002:
|
||
27980 | EXX | |
This entry point is used by the routine at 28029:
|
||
27981 | INC H | The last spotter was not within seeing range of the target; try the next spotter |
27982 | DJNZ 27955 | |
27984 | EXX | |
27985 | XOR A | Signal: none of the spotters was within range |
27986 | RET | |
We've found a spotter within seeing range of the target. But is he facing the right way?
|
||
27987 | CP E | Does the spotter's x-coordinate match the target's? |
27988 | JR Z,27999 | Jump if so |
27990 | LD A,0 | The carry flag is now set if the spotter is to the left of the target |
27992 | RRA | A=128 if spotter is to the left of the target, 0 if to the right |
27993 | EXX | |
27994 | LD L,0 | HL points to the spotter's animatory state |
27996 | XOR (HL) | Compare this orientation with the direction in which the spotter is facing |
27997 | EXX | |
27998 | RLCA | |
27999 | CCF | Set the carry flag if the spotter's facing the right way to see the target |
28000 | LD A,B | Set A to something non-zero to indicate that the spotter was within range |
28001 | RET |
Prev: 27953 | Up: Map | Next: 28002 |