Prev: CF46 Up: Map Next: CF5B
CF4F: Add Displacement
Used by the routine at MoveEntity.
Adds a signed displacement to a position that is held in three bytes.
Input
HL The displacement
C The top byte of the position
DE The bottom two bytes of the position
Output
C The new top byte
HL The new bottom two bytes
AddDisplacement CF4F BIT 7,H Jump to CF57 if the zero flag is reset.
CF51 JR NZ,AddDisplacement_Skip
CF53 ADD HL,DE HL takes DE.
CF54 RET NC Return if the carry flag is reset.
CF55 INC C Advance C.
CF56 RET Return.
AddDisplacement_Skip CF57 ADD HL,DE HL takes DE.
CF58 RET C Return if the carry flag is set.
CF59 DEC C Step C back.
CF5A RET Return.
Prev: CF46 Up: Map Next: CF5B