Prev: C372 Up: Map Next: C392
C383: Convert Position
Used by the routine at ProjectObject.
Converts a position along one axis between the map and the view. It is the same unless the view is rotated by a half turn, when the position within the cell is inverted and the cell is replaced by fifteen minus itself. It does nothing when the view is not rotated.
Input
L The position within the cell
H The cell
Output
L The position within the cell to use
H The cell to use
Return if the view is not rotated.
ConvertPosition C383 LD A,($A268) Fetch ViewRotation.
C386 AND %00000001 Keep the bit which says that the view is rotated.
C388 RET Z Return if it is not.
Invert the position within the cell.
C389 LD A,L Invert the low byte.
C38A CPL
C38B LD L,A Set the low byte.
Replace the cell with fifteen minus the cell.
C38C LD A,H Invert the cell.
C38D CPL
C38E AND %00001111 Keep the low four bits, which is fifteen minus the cell.
C390 LD H,A Set the cell.
C391 RET Return.
View the equivalent code in;
Prev: C372 Up: Map Next: C392