Prev: B6CD Up: Map Next: B719
B6F8: Set Position In Cell
Sets where an object stands within its cell, from the position of the sheriff within his cell. The routine uses C as left by GetMapCell, and PlaceNearSheriff must have been called first.
Input
IY The address of the object
Set the horizontal position within the cell.
SetPositionInCell B6F8 LD A,($A27E) Fetch the horizontal position of the sheriff within his cell.
B6FB AND %11000000 Keep the top two bits.
B6FD OR %01000000 Set bit 6.
B6FF BIT 0,C Jump to SetPositionInCell_Horizontal if bit 0 of C is clear.
B701 JR Z,SetPositionInCell_Horizontal
B703 NEG Negate the position.
SetPositionInCell_Horizontal B705 LD (IY+$01),A Set the horizontal position of the object within its cell.
Set the vertical position within the cell.
B708 LD A,($A280) Fetch the vertical position of the sheriff within his cell.
B70B AND %11000000 Keep the top two bits.
B70D OR %01000000 Set bit 6.
B70F BIT 1,C Jump to SetPositionInCell_Vertical if bit 1 of C is clear.
B711 JR Z,SetPositionInCell_Vertical
B713 NEG Negate the position.
SetPositionInCell_Vertical B715 LD (IY+$03),A Set the vertical position of the object within its cell.
B718 RET Return.
Prev: B6CD Up: Map Next: B719