Free Web Hosting by Netfirms
Web Hosting by Netfirms | Free Domain Names by Netfirms

 
4.2 OPERATORS AND PRECEDENCE

There is two type of operators - unary and binary:

Unary:
   - sign change
   + sign change (not evaluated)
   ~ complement
   ! negation

Binary:
   -  subtraction
   +  addition
   *  multiplication
   /  division
   %  modulo
   &  and
   |  or
   ^  xor
   << shift left
   >> shift right
   <  less
   <= less-or-equ
   >  greater
   >= greater-or-equ
   == equ
   != not-equ

In addition, there is some functions that act like operators:

  .isdef
  .isndef
  .ror
  .rol
  .hi8
  .lo8
  .hi16
  .lo16

Operators .ror and .rol are binary operators, others are unary. .ror and .rol rotate number right/left:

  Data1 = 3

  Data2 = Data1 .ror 4 ; rotate 4 bits right
Most assemblers have operators that manipulate with high or low bytes. Mas expand this for manipulating low/high bytes or words:

  .lo8 - lower 8 bits 
  .hi8 - high 8 bits
  .lo16 - lower 16 bits
  .hi16 - high 16 bits:

Operators .isdef and .isndef return 1 or 0 if name is declared/not-declared:

  Data1 = 123

  Data2 = .isdef Data1 ; Data2 = 1

  Data3 = .isndef Data4 ; Data3 = 1
(abbreviation form 'is-defined' and 'is-not-defined').
 
 
 
operator
form
precedense
()
grouping
0
-
unary
1
+
unary
1
~
unary
1
!
unary
1
.lo8
unary
1
.hi8
unary
1
.lo16
unary
1
.hi16
unary
1
.isdef
unary
1
.isndef
unary
1
*
binary
2
/
binary
2
%
binary
2
+
binary
3
-
binary
3
&
binary
4
|
binary
4
<<
binary
4
>>
binary
4
.ror
binary
4
.rol
binary
4
<
binary
5
<=
binary
5
>
binary
5
>=
binary
5
!=
binary
5
[PREV][INDEX][NEXT]