Prev: DDCF Up: Map Next: DDF3
DDD5: Move Entity Back
Used by the routines at HandleOverlap, HandleOverlapFirst and HandleOverlapSecond.
Moves an entity back along one of its coordinates by an amount.
Input
HL The amount, with the direction in bit 7 of H
IX The entity, with the coordinate in fields 02 and 03
MoveEntityBack DDD5 LD D,(IX+$02) Fetch the high byte of the x coordinate into D.
DDD8 LD E,(IX+$03) Fetch the low byte of the x coordinate into E.
DDDB RL H Rotate H left through the carry flag.
DDDD LD H,$00 H is 00.
DDDF JR NC,MoveEntityBack_Skip Jump to DDE4 if the carry flag is reset.
DDE1 ADD HL,DE HL takes DE.
DDE2 JR MoveEntityBack_Skip2 Jump to DDEC.
MoveEntityBack_Skip DDE4 DEC L Step L back.
DDE5 LD (IX+$04),$FF Set field 04 of the entity to FF.
DDE9 EX DE,HL Exchange DE and HL.
DDEA SBC HL,DE Subtract DE from HL. (with the carry)
MoveEntityBack_Skip2 DDEC LD (IX+$02),H Set the high byte of the x coordinate.
DDEF LD (IX+$03),L Set the low byte of the x coordinate.
DDF2 RET Return.
Prev: DDCF Up: Map Next: DDF3