SUB - Subtract X from the Accumulator Command
Subtracts the argument from the current accumulator value and stores the result to the accumulator.
Syntax
SUB x
Where "x" is the value or memory location you want to subtract from the accumulator. You may use a raw value (hex or decimal), tilde memory, task port, or persistent memory.
Example
{
LDA #0x02 //Put the fixed hex value 0x02 into the Accumulator
SUB #0x02 //Take 0x02 away from the value in the Accumulator which now contains the value 0. This will set the Zero flag
BRZ Label //The task will now branch to the label
LDA ~5 //Copy the value in tilde 5 to the Accumulator
SUB #10 //Subtract 10 from the value in the Accumulator
LDA ~5 //Copy the value in tilde 5 to the Accumulator
SUB #0x13 //Subtract the 0x13 (19) from the value in the Accumulator
LDA ~3 //Load the value from ~3 into the accumulator
SUB #5 //Subtract 5 from the value in the Accumulator
STA ~3 //Store the previous value minus 5 back into ~3
LDA ~3 //Load the value from ~3 into the accumulator
SUB $14 //Subtract the value in persistent memory 14.
STA ~3 //Store the new value back into ~3
LDA $15 //Load the value from persistent memory 15 into the accumulator
SUB ~14 //Subtract the value in tilde memory 14.
STA ~3 //Store the value into ~3
}