Prev: 9FDE Up: Map Next: 9FF8
9FEA: Get the word for a direction
Returns in DE the word for direction A, from the table at $A13E (NORTH, SOUTH, EAST, WEST, NORTHEAST ... UP, DOWN). The entry at 9FED looks up another table at HL.
Input
A Direction
Output
DE Word
9FEA LD HL,$A13E HL = the table of direction words
This entry point is used by the routine at A09C.
9FED LD E,A E = the direction (1-10)...
9FEE RES 7,E ...with any stray extra bit cleared
9FF0 LD D,$00
9FF2 ADD HL,DE HL = this direction's own entry...
9FF3 ADD HL,DE ...doubled, since each word reference is 2 bytes
9FF4 LD E,(HL) DE = the word, read from the table (low byte)...
9FF5 INC HL
9FF6 LD D,(HL) ...then the high byte
9FF7 RET
Prev: 9FDE Up: Map Next: 9FF8