Prev: 50034 Up: Map Next: 50066
50051: 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 50051 LD A,(41576) Fetch ViewRotation.
50054 AND %00000001 Keep the bit which says that the view is rotated.
50056 RET Z Return if it is not.
Invert the position within the cell.
50057 LD A,L Invert the low byte.
50058 CPL
50059 LD L,A Set the low byte.
Replace the cell with fifteen minus the cell.
50060 LD A,H Invert the cell.
50061 CPL
50062 AND %00001111 Keep the low four bits, which is fifteen minus the cell.
50064 LD H,A Set the cell.
50065 RET Return.
View the equivalent code in;
Prev: 50034 Up: Map Next: 50066