Prev: 56340 Up: Map Next: 56416
56387: Swap Controls
Used by the routine at ChooseDirection.
Swaps the controls for left and right, and up and down, which turns the controls around when the view is rotated. The control for fire is not changed.
Input
E Controls
Output
E Controls swapped
Swap left with right.
SwapControls 56387 LD A,E Keep the control for fire.
56388 AND 8
56390 BIT 0,E Make the control for right the control for left.
56392 JR Z,SwapControls_Left
56394 SET 1,A Set the control for left.
SwapControls_Left 56396 BIT 1,E Make the control for left the control for right.
56398 JR Z,SwapControls_Down
56400 SET 0,A Set the control for right.
Swap up with down.
SwapControls_Down 56402 BIT 2,E Make the control for down the control for up.
56404 JR Z,SwapControls_Up
56406 SET 4,A Set the control for up.
SwapControls_Up 56408 BIT 4,E Make the control for up the control for down.
56410 JR Z,SwapControls_Return
56412 SET 2,A Set the control for down.
SwapControls_Return 56414 LD E,A Keep the controls and return.
56415 RET
View the equivalent code in;
Prev: 56340 Up: Map Next: 56416