![]() |
Routines |
Prev: 28002 | Up: Map | Next: 28067 |
H | Character number of teacher (200-204) |
28029 | CALL 27886 | Get the lower and upper limits of the teacher's range of vision in C and B |
28032 | LD L,0 | Default assumption: no kids nearby |
28034 | EXX | |
28035 | LD H,206 | 206=BOY WANDER |
28037 | LD BC,1535 | B'=5 (main kids including ERIC), C'=255 |
28040 | EXX | |
28041 | CALL 27954 | Find the first main kid within range (if any) |
28044 | AND A | Set the zero flag if we've checked all the main kids |
28045 | LD A,L | A=character number of nearest kid, or 0 if none |
28046 | RET Z | Return if we've finished checking all the main kids |
28047 | LD A,E | A=teacher's x-coordinate |
28048 | EXX | |
28049 | SUB E | Subtract the x-coordinate of the kid |
28050 | JR NC,28054 | Jump if the kid's to the left of teacher |
28052 | NEG | |
28054 | CP C | Is this kid closer to the teacher than the last? |
28055 | JR NC,28062 | Jump if not |
28057 | LD C,A | C'=distance from teacher of nearest kid found so far |
28058 | LD A,H | A=character number of this kid |
28059 | EXX | |
28060 | LD L,A | Store the character number of the nearest kid in L |
28061 | EXX | |
28062 | CALL 27981 | Find the next main kid within range (if any) |
28065 | JR 28044 | Jump back to compare distances |
Prev: 28002 | Up: Map | Next: 28067 |