Prev: 47728 Up: Map Next: 47909
47887: 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 23779 and 23781, and stores the result in CellPosition.
Input
C The offset in the table, 0-16 in twos
GetCellPosition 47887 LD HL,47710 Point HL at CellOffsets.
47890 LD B,0 B is 0.
47892 ADD HL,BC HL takes BC.
47893 LD A,(23779) Read the byte at 23779.
47896 ADD A,(HL) Add the byte at the address in HL.
47897 LD E,A A moves into E.
47898 INC HL Advance HL.
47899 LD A,(23781) Read the byte at 23781.
47902 ADD A,(HL) Add the byte at the address in HL.
47903 LD D,A A moves into D.
47904 EX DE,HL Exchange DE and HL.
47905 LD (23737),HL Write HL at CellPosition.
47908 RET Return.
Prev: 47728 Up: Map Next: 47909