Prev: F7AA Up: Map Next: F833
F804: Advance Entity
Used by the routine at JumpTable_AdvanceEntity.
Advances an entity by its stored deltas.
Input
IX Entity data
Output
B Updated row
C Updated column
D Updated fine-Y
E Updated fine-X
Advance_Entity F804 LD C,(IX+$00) C=the column and B=the row.
F807 LD B,(IX+$01)
F80A LD A,(IX+$08) Add *IX+08 to the fine-X.
F80D ADD A,(IX+$02)
F810 CP $08 Jump to Advance_Entity_Branch2 if the fine-X is still in range.
F812 JR C,Advance_Entity_Branch2
F814 CP $80 Jump to Advance_Entity_Branch if the entity moved left.
F816 JR NC,Advance_Entity_Branch
F818 INC C Step the column two right, then...
F819 INC C
Advance_Entity_Branch F81A DEC C ...one left.
F81B AND %00000111 Keep only bits 0-2.
Advance_Entity_Branch2 F81D LD E,A Store the fine-X.
F81E LD A,(IX+$09) Add *IX+09 to the fine-Y.
F821 ADD A,(IX+$03)
F824 CP $08 Jump to Advance_Entity_Branch4 if the fine-Y is still in range.
F826 JR C,Advance_Entity_Branch4
F828 CP $80 Jump to Advance_Entity_Branch3 if the entity moved up.
F82A JR NC,Advance_Entity_Branch3
F82C INC B Step the row two down, then...
F82D INC B
Advance_Entity_Branch3 F82E DEC B ...one up.
F82F AND %00000111 Keep only bits 0-2.
Advance_Entity_Branch4 F831 LD D,A Store the fine-Y.
F832 RET Return.
View the equivalent code in Booty.
Prev: F7AA Up: Map Next: F833