| Routines

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

Used by the routines at 28994, 29148, 29160, 29284, 32048, 62208, 63056, 63146 and 64016. Returns with A holding the blackboard identifier (the LSB of 32748, 32750 or 32752) and DE holding the coordinates:
A | (D,E) | Description
--- | --- | ---
236 | (155,42) | Reading Room blackboard
238 | (161,26) | White Room blackboard
240 | (161,41) | Exam Room blackboard
Input
H | Character number (163-167)
28968 | LD L,97 | Byte 97 of the character's buffer holds his y-coordinate
28970 | LD A,(HL) | Pick this up in A
28971 | LD DE,39722 | D=155 (y-coordinate), E=42 (x-coordinate)
28974 | CP 160 | Set the carry flag if the character's on the top floor
28976 | LD A,236 | 236=Reading Room blackboard
28978 | RET C | Return if the character's on the top floor
28979 | INC L | L=98
28980 | LD DE,41242 | D=161 (y-coordinate), E=26 (x-coordinate)
28983 | LD A,(HL) | A=character's x-coordinate
28984 | CP 37 | This is the x-coordinate of the wall between the White and Exam Rooms
28986 | LD A,238 | 238=White Room blackboard
28988 | RET C | Return if the character's to the left of the wall between the White and Exam Rooms
28989 | LD E,41 | D=161 (y-coordinate), E=41 (x-coordinate)
28991 | LD A,240 | 240=Exam Room blackboard
28993 | RET |