Prev: C352 Up: Map Next: C383
C372: Convert Cell
Used by the routines at DrawTown and FindObjectsInCell.
Converts the column and the row of a cell between the map and the view. They are the same unless the view is rotated by a half turn, when each is replaced by fifteen minus itself, so that cell (x, y) on the map of sixteen by sixteen is (fifteen minus x, fifteen minus y) in the view. It does nothing when the view is not rotated.
Input
L The column
H The row
Output
L The column to use
H The row to use
Return if the view is not rotated.
ConvertCell C372 LD A,($A268) Fetch ViewRotation.
C375 AND %00000001 Keep the bit which says that the view is rotated.
C377 RET Z Return if it is not.
Replace the column with fifteen minus the column.
C378 LD A,L Invert the column.
C379 CPL
C37A AND %00001111 Keep the low four bits, which is fifteen minus the column.
C37C LD L,A Set the column.
Replace the row with fifteen minus the row.
C37D LD A,H Invert the row.
C37E CPL
C37F AND %00001111 Keep the low four bits, which is fifteen minus the row.
C381 LD H,A Set the row.
C382 RET Return.
View the equivalent code in;
Prev: C352 Up: Map Next: C383