Prev: 6DA3 Up: Map Next: 6DD2
6DB5: Determine which floor ERIC's on when he's not standing directly on one
Continues from the routine at 63BE, having determined that ERIC's feet are not on the floor. On entry, the zero flag is set if (a) ERIC is jumping and the zero flag was set (by chance) upon entering the routine at 63BE, or (b) bits 1 and 2 of ERIC's status flags at 7FED are both reset. Returns with D=0x11 if the zero flag is set upon entry (regardless of which floor ERIC is on, which is a bug); otherwise returns with D=0x03, 0x0A, 0x0E or 0x11, indicating which floor ERIC is directly above.
Input
D ERIC's y-coordinate
E ERIC's x-coordinate
6DB5 LD A,D A=ERIC's y-coordinate
6DB6 LD D,$11 0x11=bottom floor
6DB8 RET Z Return with D=0x11 if the zero flag was set upon entry (regardless of which floor ERIC is on, which is a bug)
6DB9 LD D,$03 0x03=top floor
6DBB CP $04 Is ERIC directly above the top floor?
6DBD RET C Return with D=0x03 if so
6DBE LD D,$0A 0x0A=middle floor
6DC0 CP $0B Is ERIC directly above the middle floor?
6DC2 RET C Return with D=0x0A if so
6DC3 LD D,$11 0x11=bottom floor
6DC5 CP $0F Is ERIC below the height of the stage?
6DC7 RET NC Return with D=0x11 if so
6DC8 LD A,E A=ERIC's x-coordinate
6DC9 CP $4C Return with D=0x11 if ERIC is not directly above the assembly hall stage
6DCB RET C
6DCC CP $52
6DCE RET NC
6DCF LD D,$0E 0x0E=assembly hall stage
6DD1 RET
Prev: 6DA3 Up: Map Next: 6DD2