Prev: B06B Up: Map Next: B0DD
B0AD: Turn Mouse One Way
Used by the routines at HandleCircuitMouse and TurnMouseOtherWay.
Turns a robot mouse a quarter turn. The way it faces is held in bit 0 of its sprite number and bit 6 of its flags. They go west, south, east, north: (bit 0, bit 6) = (00, 00), (01, 01), (01, 00) and (00, 01).
Input
IX The address of the object
The mouse is facing west or north.
TurnMouseOneWay B0AD BIT 0,(IX+$00) Jump to TurnMouseOneWay_BitSet if bit 0 of the sprite number is set.
B0B1 JR NZ,TurnMouseOneWay_BitSet
B0B3 BIT 6,(IX+$07) Jump to TurnMouseOneWay_FlippedBitClear if the sprite is flipped.
B0B7 JR NZ,TurnMouseOneWay_FlippedBitClear
B0B9 SET 0,(IX+$00) Set bit 0 of the sprite number.
TurnMouseOneWay_Flip B0BD SET 6,(IX+$07) Set bit 6 of the flags.
B0C1 RET Return.
The mouse is facing south or east.
TurnMouseOneWay_BitSet B0C2 BIT 6,(IX+$07) Jump to TurnMouseOneWay_FlippedBitSet if the sprite is flipped.
B0C6 JR NZ,TurnMouseOneWay_FlippedBitSet
B0C8 RES 0,(IX+$00) Reset bit 0 of the sprite number.
B0CC JR TurnMouseOneWay_Flip Jump to TurnMouseOneWay_Flip.
The mouse is facing north.
TurnMouseOneWay_FlippedBitClear B0CE RES 0,(IX+$00) Reset bit 0 of the sprite number.
TurnMouseOneWay_Unflip B0D2 RES 6,(IX+$07) Reset bit 6 of the flags.
B0D6 RET Return.
The mouse is facing south.
TurnMouseOneWay_FlippedBitSet B0D7 SET 0,(IX+$00) Set bit 0 of the sprite number.
B0DB JR TurnMouseOneWay_Unflip Jump to TurnMouseOneWay_Unflip.
Prev: B06B Up: Map Next: B0DD