Prev: BA70 Up: Map Next: BB25
BB0F: Get Cell Position
Used by the routine at DrawLevelObjects.
Finds the position of a cell around the player by adding an offset from the table at CellOffsets to the position of the player in 5CE3 and 5CE5, and stores the result in CellPosition.
Input
C The offset in the table, 00-10 in twos
GetCellPosition BB0F LD HL,$BA5E Point HL at CellOffsets.
BB12 LD B,$00 B is 00.
BB14 ADD HL,BC HL takes BC.
BB15 LD A,($5CE3) Read the byte at 5CE3.
BB18 ADD A,(HL) Add the byte at the address in HL.
BB19 LD E,A A moves into E.
BB1A INC HL Advance HL.
BB1B LD A,($5CE5) Read the byte at 5CE5.
BB1E ADD A,(HL) Add the byte at the address in HL.
BB1F LD D,A A moves into D.
BB20 EX DE,HL Exchange DE and HL.
BB21 LD ($5CB9),HL Write HL at CellPosition.
BB24 RET Return.
Prev: BA70 Up: Map Next: BB25