Prev: 56783 Up: Map Next: 56819
56789: 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 2 and 3
MoveEntityBack 56789 LD D,(IX+2) Fetch the high byte of the x coordinate into D.
56792 LD E,(IX+3) Fetch the low byte of the x coordinate into E.
56795 RL H Rotate H left through the carry flag.
56797 LD H,0 H is 0.
56799 JR NC,MoveEntityBack_Skip Jump to 56804 if the carry flag is reset.
56801 ADD HL,DE HL takes DE.
56802 JR MoveEntityBack_Skip2 Jump to 56812.
MoveEntityBack_Skip 56804 DEC L Step L back.
56805 LD (IX+4),255 Set field 4 of the entity to 255.
56809 EX DE,HL Exchange DE and HL.
56810 SBC HL,DE Subtract DE from HL. (with the carry)
MoveEntityBack_Skip2 56812 LD (IX+2),H Set the high byte of the x coordinate.
56815 LD (IX+3),L Set the low byte of the x coordinate.
56818 RET Return.
Prev: 56783 Up: Map Next: 56819