Prev: DB89 Up: Map Next: DC60
DC43: Turn a stick's directions round with the town
Used by the routine at TURN_KNIGHT.
With the town turned round the stick's directions are swapped end for end -- left for right, up for down -- so that pushing it still means the same way on the screen. Fire is kept; the town-turning bit is dropped, having been used.
Input
E The controls
Output
E The same, turned round
SWAP_STICK DC43 LD A,E Keep fire
DC44 AND $08
DC46 BIT 0,E Left becomes right
DC48 JR Z,SWAP_STICK_0
DC4A SET 1,A
SWAP_STICK_0 DC4C BIT 1,E Right becomes left
DC4E JR Z,SWAP_STICK_1
DC50 SET 0,A
SWAP_STICK_1 DC52 BIT 2,E Up becomes down
DC54 JR Z,SWAP_STICK_2
DC56 SET 4,A
SWAP_STICK_2 DC58 BIT 4,E Down becomes up
DC5A JR Z,SWAP_STICK_3
DC5C SET 2,A
SWAP_STICK_3 DC5E LD E,A The new controls
DC5F RET
Prev: DB89 Up: Map Next: DC60