Prev: 917C Up: Map Next: 91BB
919E: Locate Terrain Cell
Map a world position onto TerrainData_Active and draw that column.
Input
HL World position
Map the world position onto TerrainData_Active and draw that column.
LocateTerrainCell 919E LD DE,$FF88 DE=FF88.
91A1 ADD HL,DE HL+=DE.
91A2 LD A,H A=H.
91A3 AND %00011111 Keep only bits 0-4.
91A5 LD H,A H=A.
Convert the position into a terrain cell pointer.
91A6 LD DE,$7000 DE=TerrainData_Active.
91A9 SRA H Divide the world position by 08.
91AB RR L
91AD SRA H
91AF RR L
91B1 SRA H
91B3 RR L
91B5 ADD HL,DE HL+=DE.
Aim at the leftmost screen column and draw it.
91B6 LD DE,$50C0 DE=50C0.
91B9 JR DrawTerrainColumn Jump to DrawTerrainColumn.
Prev: 917C Up: Map Next: 91BB