Prev: DCDC Up: Map Next: DD01
DCE0: Set a record's step from its speed and facing
The step (+A, +B) is the speed along the one axis the record faces: U if bit 6 of the facing is set, V if not, negative if bit 7 is set. Only four directions; the random wanderers set their steps themselves (WANDER_STEP).
Input
A The speed
IX The record
SET_STEP DCE0 LD H,$00 H (V) or L (U) the speed, the other 0
DCE2 LD L,A
DCE3 BIT 6,(IX+$06)
DCE7 JR NZ,SET_STEP_0
DCE9 LD H,A
DCEA LD L,$00
SET_STEP_0 DCEC BIT 7,(IX+$06) Facing -V or -U: negate both
DCF0 JR Z,SET_STEP_1
DCF2 LD A,L
DCF3 NEG
DCF5 LD L,A
DCF6 LD A,H
DCF7 NEG
DCF9 LD H,A
SET_STEP_1 DCFA LD (IX+$0A),L The step
DCFD LD (IX+$0B),H
DD00 RET
Prev: DCDC Up: Map Next: DD01