Prev: 54132 Up: Map Next: 54162
54148: Point HL at terrain interaction data, or attribute file address for character coordinates x=C, y=B
The operand of the instruction at 54157 is usually 88 (corresponding to an attribute file lookup). It is only changed to 94 (corresponding to a terrain interaction data lookup) by the routine at 54162, and is returned to a value of 88 before that routine concludes.
Used by the routines at 26670, 28432, 28938, 32694, 34627, 35525, 35940, 36104, 36321, 54162 and 54647.
Input
B y-coordinate (chars)
C x-coordinate (chars)
Output
DE points to entry in data table with coordinates (C, 0)
HL points to entry in data table with coordinates (C, B)
54148 LD A,B Load y-coordinate into A
54149 ADD A,A Multiply this by 8...
54150 ADD A,A ...
54151 ADD A,A ...
54152 LD L,A Copy 8 times y-coordinate into HL...
54153 LD H,0 ...
54155 ADD HL,HL Multiply by 4...
54156 ADD HL,HL ...to give 32 times original y-coordinate in HL
The operand of the instruction at 54157 determines whether we are dealing with the attribute file (88), or the current terrain interaction data (94). It is modified by the instructions at 54164 and 54172.
54157 LD D,88 Point DE at start of data, plus x-coordinate offset in C...
54159 LD E,C ...
54160 ADD HL,DE Add 32 times y-coordinate as offset in HL
54161 RET Return
Prev: 54132 Up: Map Next: 54162