Prev: 45163 Up: Map Next: 45277
45229: 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) = (0, 0), (1, 1), (1, 0) and (0, 1).
Input
IX The address of the object
The mouse is facing west or north.
TurnMouseOneWay 45229 BIT 0,(IX+0) Jump to TurnMouseOneWay_BitSet if bit 0 of the sprite number is set.
45233 JR NZ,TurnMouseOneWay_BitSet
45235 BIT 6,(IX+7) Jump to TurnMouseOneWay_FlippedBitClear if the sprite is flipped.
45239 JR NZ,TurnMouseOneWay_FlippedBitClear
45241 SET 0,(IX+0) Set bit 0 of the sprite number.
TurnMouseOneWay_Flip 45245 SET 6,(IX+7) Set bit 6 of the flags.
45249 RET Return.
The mouse is facing south or east.
TurnMouseOneWay_BitSet 45250 BIT 6,(IX+7) Jump to TurnMouseOneWay_FlippedBitSet if the sprite is flipped.
45254 JR NZ,TurnMouseOneWay_FlippedBitSet
45256 RES 0,(IX+0) Reset bit 0 of the sprite number.
45260 JR TurnMouseOneWay_Flip Jump to TurnMouseOneWay_Flip.
The mouse is facing north.
TurnMouseOneWay_FlippedBitClear 45262 RES 0,(IX+0) Reset bit 0 of the sprite number.
TurnMouseOneWay_Unflip 45266 RES 6,(IX+7) Reset bit 6 of the flags.
45270 RET Return.
The mouse is facing south.
TurnMouseOneWay_FlippedBitSet 45271 SET 0,(IX+0) Set bit 0 of the sprite number.
45275 JR TurnMouseOneWay_Unflip Jump to TurnMouseOneWay_Unflip.
Prev: 45163 Up: Map Next: 45277