Operators

Operator board:

Priority Unary Priority Binary operators
1.
% $
3.
* / %
2.
{ } ~ ! - > <
4.
<< >>
    5.
+ -
    6.
& | ^
    7.
> < >= <= == !=
    8.
&&
    9.
||

Description:

Unary.

%<constant> or %<constant>$ - Reference operator to macro definition parameter. Parameters are numbered from 1. Call %0 is the number of parameters passed to the macro definition. Placing the '$' character after the parameter reference means that a text type parameter is expected. Calling %0$ returns the name of the macro definition.

{ } Braces are used to change the order of calculations resulting from operator priorities.

~ Bit negation - replace all expression bits with the opposite.

! Logical negation - replace a non-zero expression with 0 and zero expression to 1.

- Change the number character.

> Upper (older) byte of the word.

< Lower (younger) byte of the word.

Binary operators.

* / % Multiplication, integer division, and modulo operation.

<< >> Swipe left and right expressions by a given number of bits.

+ - Addition and subtraction.

& | ^ Bit conjunction (and), sum (or), and difference (xor) operations.

> < >= <= == != Expression comparison operations. They return 1 as truth and 0 as false.

&&Logical conjunction (and). Returns 1 as truth and 0 as false.

|| Logical sum (or). Returns 1 as truth and 0 as false.

Examples:

    LDA #%.n    ; loading macro number '.n' parameter
    .DB %2$    ; reference to text contained in the second macro parameter
    .REPEAT {n+1}*2    ; braces changing the order of calculations
    LDA #~mask;    inversion of constant bits 'mask'
    .IF !. DEF(test)    ; if 'test' is NOT defined
    .BYTE -1;    equivalent to $FF
    LDX #>$ABCD    ; loading an upper address byte (here: $AB)
    LDY #<$ABCD    ;instilling a lower byte address (here: $CD)
    .WORD 1<<8    ; 8-bit swipe 1 gives $100
    .BYTE n>>1    ; move 'n' to the right by 1 bit
    .BYTE adr&$FF    ; reducing 'adr' by masking bits
    LDA #mask|$80    ; bit setting #7
    .DB hassk^$0F;    reverse the lower 4 bits to the opposite
    .IF alpha==beta    ; if the labels have the same values
    .IF alpha!=beta    ; if the labels have different values
    . IF . REF(Get) || . REF(Put) ; if there was a reference to 'Get' or 'Put'