Prev: D60E Up: Map Next: D647
D616: Handler: Sea Creature Movement
Used by the routines at D4CC and Handler_SeaCreatures.
Input
IX Creature data
Handler_SeaCreatureMovement D616 LD C,(IX+$00) C=*IX+00.
D619 LD B,(IX+$01) B=*IX+01.
D61C LD E,(IX+$02) E=*IX+02.
D61F LD D,(IX+$03) D=*IX+03.
D622 LD A,(IX+$04) A=*IX+04.
D625 ADD A,E A+=E.
D626 CP $80 Jump to Handler_SeaCreatureMovement_0 if A is higher than 80.
D628 JR NC,Handler_SeaCreatureMovement_0
D62A CP $04 Jump to Handler_SeaCreatureMovement_1 if A is lower than 04.
D62C JR C,Handler_SeaCreatureMovement_1
D62E INC C Increment C by two.
D62F INC C
Handler_SeaCreatureMovement_0 D630 DEC C Decrease C by one.
D631 AND %00000011 Keep only bits 0-1.
Handler_SeaCreatureMovement_1 D633 LD E,A E=A.
D634 LD A,(IX+$05) A=*IX+05.
D637 ADD A,D A+=D.
D638 CP $80 Jump to Handler_SeaCreatureMovement_2 if A is higher than 80.
D63A JR NC,Handler_SeaCreatureMovement_2
D63C CP $04 Jump to Handler_SeaCreatureMovement_3 if A is lower than 04.
D63E JR C,Handler_SeaCreatureMovement_3
D640 INC B Increment B by two.
D641 INC B
Handler_SeaCreatureMovement_2 D642 DEC B Decrease B by one.
D643 AND %00000011 Keep only bits 0-1.
Handler_SeaCreatureMovement_3 D645 LD D,A D=A.
D646 RET Return.
Prev: D60E Up: Map Next: D647