Prev: F6C6 Up: Map Next: F7AA
F6E1: Move Entity
Used by the routine at JumpTable_MoveEntity.
Moves an entity and erases the vacated cells.
Move_Entity F6E1 XOR A Write 00 to *643D.
F6E2 LD ($643D),A
F6E5 LD A,C Jump to Move_Entity_Skip if the column matches *IX+0A.
F6E6 SUB (IX+$0A)
F6E9 JR Z,Move_Entity_Skip
F6EB CP $80 Call Move_Entity_Target when the column moved left.
F6ED PUSH AF
F6EE CALL NC,Move_Entity_Target
F6F1 POP AF
F6F2 CALL C,Move_Entity_Target2 Call Move_Entity_Target2 when the column moved right and jump to Move_Entity_Skip2.
F6F5 JR Move_Entity_Skip2
Move_Entity_Skip F6F7 LD A,E Jump to Move_Entity_Skip2 if the fine-X matches *IX+0C.
F6F8 CP (IX+$0C)
F6FB JR Z,Move_Entity_Skip2
F6FD CP $07 Call Move_Entity_Target2 when the fine-X wrapped to 07.
F6FF CALL Z,Move_Entity_Target2
Move_Entity_Skip2 F702 LD A,B Jump to Move_Entity_Skip3 if the row matches *IX+0B.
F703 SUB (IX+$0B)
F706 JR Z,Move_Entity_Skip3
F708 CP $80 Call Move_Entity_Target3 when the row moved up.
F70A PUSH AF
F70B CALL NC,Move_Entity_Target3
F70E POP AF
F70F JR C,Move_Entity_Branch Jump to Move_Entity_Branch if the row moved down, else return.
F711 RET
Move_Entity_Skip3 F712 LD A,D Return if the fine-Y matches *IX+0D.
F713 CP (IX+$0D)
F716 RET Z
F717 CP $07 Jump to Move_Entity_Branch when the fine-Y wrapped to 07 else return.
F719 JR Z,Move_Entity_Branch
F71B RET
Erase the left-hand column that has just been vacated.
Move_Entity_Target F71C PUSH BC Stash the new position and size.
F71D PUSH DE
F71E LD A,$FF Write FF to *643D.
F720 LD ($643D),A
F723 LD C,(IX+$0A) Fill a one-column strip at the old column and row.
F726 LD B,(IX+$0B)
F729 LD D,(IX+$05)
F72C LD E,$01
F72E LD A,(IX+$0D) Increase the height when the old fine-Y is not 07.
F731 CP $07
F733 JR Z,Move_Entity_Skip4
F735 INC D
Move_Entity_Skip4 F736 CALL Fill_Tiles Call Fill_Tiles.
F739 POP DE Restore the registers from the stack.
F73A POP BC
F73B RET Return.
Erase the right-hand column that has just been vacated.
Move_Entity_Target2 F73C LD A,$01 Write 01 to *643D.
F73E LD ($643D),A
F741 PUSH BC Stash the new position and size.
F742 PUSH DE
F743 LD A,(IX+$0A) Fill a one-column strip at the old right-hand edge.
F746 LD C,(IX+$04)
F749 SUB C
F74A LD C,A
F74B LD B,(IX+$0B)
F74E LD D,(IX+$05)
F751 LD E,$01
F753 LD A,(IX+$0D) Increase the height when the old fine-Y is not 07.
F756 CP $07
F758 JR Z,Move_Entity_Skip5
F75A INC D
Move_Entity_Skip5 F75B CALL Fill_Tiles Call Fill_Tiles.
F75E POP DE Restore the registers from the stack.
F75F POP BC
F760 RET Return.
Erase the bottom row that has just been vacated.
Move_Entity_Branch F761 PUSH BC Stash the new position and size.
F762 PUSH DE
F763 LD A,(IX+$0B) Fill a one-row strip at the old bottom edge.
F766 LD D,(IX+$05)
F769 SUB D
F76A LD B,A
F76B LD E,(IX+$04)
F76E LD C,(IX+$0A)
F771 LD D,$01
F773 LD A,(IX+$02) Increase the width when the fine-X is not 07.
F776 CP $07
F778 JR Z,Move_Entity_Skip6
F77A INC E
Move_Entity_Skip6 F77B LD A,($643D) Increase the width again when *643D is set.
F77E OR A
F77F JR Z,Move_Entity_Skip7
F781 INC E
Move_Entity_Skip7 F782 CALL Fill_Tiles Call Fill_Tiles.
F785 POP DE Restore the registers from the stack.
F786 POP BC
F787 RET Return.
Erase the top row that has just been vacated.
Move_Entity_Target3 F788 PUSH BC Stash the new position and size.
F789 PUSH DE
F78A LD C,(IX+$0A) Fill a one-row strip at the old column and row.
F78D LD B,(IX+$0B)
F790 LD D,$01
F792 LD E,(IX+$04)
F795 LD A,(IX+$0C) Increase the width when the old fine-X is not 07.
F798 CP $07
F79A JR Z,Move_Entity_Skip8
F79C INC E
Move_Entity_Skip8 F79D LD A,($643D) Increase the width again when *643D is set.
F7A0 OR A
F7A1 JR Z,Move_Entity_Skip9
F7A3 INC E
Move_Entity_Skip9 F7A4 CALL Fill_Tiles Call Fill_Tiles.
F7A7 POP DE Restore the registers from the stack.
F7A8 POP BC
F7A9 RET Return.
Prev: F6C6 Up: Map Next: F7AA