TXA - Transfer the X Register to ACC Command

TXA - Transfers the X register value to the accumulator destroying the contents of the accumulator.
This is good to use when you temporarily stored a value in the X register and now need to recall it.
The SWAP command often works just as well.
This is the opposite of the TAX command.

Syntax

TXA
Notice that there is no argument attached to this command. It simply copies the X register value to the accumulator.

Example

This example moves a value into the X register and then moves it back later.

{
Start(0x1c,10,x,x,x,x,0x01)  //Trigger on all 1c messages for area 10
Copy @0,~0,7    //When we see a message we copy the first 7 pieces of data into the memory
LDA ~3          //Load the opcode (Preset)
TAX             //Move the preset into the X Reg so we can use the accumulator for something else but retain this for later.
LDA $2          //Load if the panel is locked which you stored into persistent memory 2.
CMP #1          //Is it "Unlocked"?
BRZ UpdateScene //Branch to the label "UpdateScene".
Null            //If not unlocked end.
UpdateScene:
TXA             //Move the preset back into the accumulator.
CMP #0x03       //Is it preset 4 "off"?
BRZ LightsOn    //If so toggle the lights on.
Preset(A=10,P=4,J=0x02)      //If not toggle them off.
Null
LightsOn:
Preset(A=10,P=1,J=0x02)      //If not toggle them on.
Null
}