Prev: 6E8F Up: Map Next: 6EA7
6E90: Determine which floor is nearest to a character
Used by the routines at 6E3C and 78AA. Returns with D holding 0x9B (top), 0xA2 (middle), or 0xA9 (bottom), corresponding to the floor nearest to the character.
Input
H 0xA7 (BOY WANDER), 0xA8 (ANGELFACE), 0xA9 (EINSTEIN) or 0xAC (ERIC)
6E90 LD L,$62 Byte 0x62 of a character's buffer holds his x-coordinate
6E92 LD E,(HL) Pick this up in E
6E93 DEC L L=0x61
6E94 LD D,(HL) D=character's y-coordinate
6E95 DEC L L=0x60
This entry point is used by the routines at 77AC and 78AA.
6E96 CALL $6648 Is the character on a staircase?
6E99 RET Z Return if not
The character is on a staircase. Which floor is he nearest?
6E9A LD D,$9B This is the y-coordinate of the top floor
6E9C CP $9E Is the character nearest the top floor?
6E9E RET C Return if so
6E9F LD D,$A2 This is the y-coordinate of the middle floor
6EA1 CP $A5 Is the character nearest the middle floor?
6EA3 RET C Return if so
6EA4 LD D,$A9 This is the y-coordinate of the bottom floor
6EA6 RET
Prev: 6E8F Up: Map Next: 6EA7