Prev: B06B Up: Map Next: B0DD
B0AD: Turn a creature a quarter
Used by the routines at WANDERER and TURN_QUARTER_BACK.
The four directions are the four combinations of bit 0 of the graphic and bit 6 of the flags (the mirror bit): taking them as a pair, this steps (0,0) to (1,1) to (1,0) to (0,1) and back to (0,0), which by STEP_FROM_FACING's table is minus U, minus V, plus U, plus V -- always the same way round. TURN_QUARTER_BACK toggles bit 0 first, which makes the same step the other way round.
Input
IX the creature
TURN_QUARTER B0AD BIT 0,(IX+$00) which of the four is it?
B0B1 JR NZ,TURN_QUARTER_1
B0B3 BIT 6,(IX+$07)
B0B7 JR NZ,TURN_QUARTER_2
B0B9 SET 0,(IX+$00) (0,0): to (1,1)
TURN_QUARTER_0 B0BD SET 6,(IX+$07)
B0C1 RET
TURN_QUARTER_1 B0C2 BIT 6,(IX+$07) (1,0): to (0,1)
B0C6 JR NZ,TURN_QUARTER_4
B0C8 RES 0,(IX+$00)
B0CC JR TURN_QUARTER_0
TURN_QUARTER_2 B0CE RES 0,(IX+$00) (0,1): to (0,0)
TURN_QUARTER_3 B0D2 RES 6,(IX+$07)
B0D6 RET
TURN_QUARTER_4 B0D7 SET 0,(IX+$00) (1,1): to (1,0)
B0DB JR TURN_QUARTER_3
Prev: B06B Up: Map Next: B0DD