5200BAS Expression Reference
Syntax
{decimal | $hex | @binary}
Remarks
Decimal numbers need no prefix and should be in the range 0-65535. Hexadecimal numbers need the "$" prefix and can range from $0 to $FFFF. Binary numbers require the "@" prefix and can go from @0 to @1111111111111111.
Examples
255 $FF @11111111 $B000
Syntax
variablename
Remarks
<var> does not include the registers A, X, or Y. These will be mentioned separately if they are valid.
Syntax
A={X | Y | <var> | <num>
X={A | <var> | <num>}
Y={A | <var> | <num>}
<var>={A | X | Y | <num> | <var>}
Remarks
Only the above combinations of assigns are legal. If <var>=<var> is used, the A register is modified by an intermediate step.
Example
A=L:A=A*2:N=A:A=A*4:A=A+N:A=A+20:N=A 'N=L*10+20
Syntax
A=A+{<num> | <var>}
X=X+1 | v1.01a |
<var>=<var>+1
Syntax
A=A+{<num> | <var>}
Purpose
To add with carry, if any.
Syntax
A=A-{<num> | <var>}
X=X-1 | v1.01a |
<var>=<var>-1
Syntax
A=A-{<num> | <var>}
Purpose
To subtract with carry, if any.
Syntax
A=A*<num>
Remarks
<num> should be a power of 2. If it is not, it will be rounded into one.
See also
MULADD Statement
Example
A=A*32
Syntax
A=A/<num>
Remarks
<num> should be a power of 2. If it is not, it will be rounded into one.
Example
A=A/128
Syntax
A=A AND {<num> | <var>}
Syntax
A=A OR {<num> | <var>}
Purpose
To return a value between 0 and 255.
Example
See the DO...LOOP statements in the command reference.
Syntax
A=A XOR {<num> | <var>}