| Routines

7128: Get the identifier and coordinates of the blackboard closest to a character

Used by the routines at 7142, 71DC, 71E8, 7264, 7D30, F300, F650, F6AA and FA10. Returns with A holding the blackboard identifier (the LSB of 7FEC, 7FEE or 7FF0) and DE holding the coordinates:
A | (D,E) | Description
--- | --- | ---
0xEC | (155,42) | Reading Room blackboard
0xEE | (161,26) | White Room blackboard
0xF0 | (161,41) | Exam Room blackboard
Input
H | Character number (0xA3-0xA7)
7128 | LD L,$61 | Byte 0x61 of the character's buffer holds his y-coordinate
712A | LD A,(HL) | Pick this up in A
712B | LD DE,$9B2A | D=155 (y-coordinate), E=42 (x-coordinate)
712E | CP $A0 | Set the carry flag if the character's on the top floor
7130 | LD A,$EC | 0xEC=Reading Room blackboard
7132 | RET C | Return if the character's on the top floor
7133 | INC L | L=0x62
7134 | LD DE,$A11A | D=161 (y-coordinate), E=26 (x-coordinate)
7137 | LD A,(HL) | A=character's x-coordinate
7138 | CP $25 | This is the x-coordinate of the wall between the White and Exam Rooms
713A | LD A,$EE | 0xEE=White Room blackboard
713C | RET C | Return if the character's to the left of the wall between the White and Exam Rooms
713D | LD E,$29 | D=161 (y-coordinate), E=41 (x-coordinate)
713F | LD A,$F0 | 0xF0=Exam Room blackboard
7141 | RET |