#### 9.50.2 Syntax

In XGATE RISC syntax, the instruction name comes first and it may be followed by up to three operands. Operands are separated by commas (‘`,`’). `as` will complain if too many operands are specified for a given instruction. The same will happen if you specified too few operands.

         nop
         ldl  #23
         CMP  R1, R2

The presence of a ‘`;`’ character or a ‘`!`’ character anywhere on a line indicates the start of a comment that extends to the end of that line.

A ‘`*`’ or a ‘`#`’ character at the start of a line also introduces a line comment, but these characters do not work elsewhere on the line. If the first character of the line is a ‘`#`’ then as well as starting a comment, the line could also be logical line number directive (see Comments) or a preprocessor control command (see Preprocessing).

The XGATE assembler does not currently support a line separator character.

The following addressing modes are understood for XGATE:

Inherent
  ‘``’
Immediate 3 Bit Wide
  ‘`#number`’
Immediate 4 Bit Wide
  ‘`#number`’
Immediate 8 Bit Wide
  ‘`#number`’
Monadic Addressing
  ‘`reg`’
Dyadic Addressing
  ‘`reg, reg`’
Triadic Addressing
  ‘`reg, reg, reg`’
Relative Addressing 9 Bit Wide
  ‘`*symbol`’
Relative Addressing 10 Bit Wide
  ‘`*symbol`’
Index Register plus Immediate Offset
  ‘`reg, (reg, #number)`’
Index Register plus Register Offset
  ‘`reg, reg, reg`’
Index Register plus Register Offset with Post-increment
  ‘`reg, reg, reg+`’
Index Register plus Register Offset with Pre-decrement
  ‘`reg, reg, -reg`’

  The register can be either ‘`R0`’, ‘`R1`’, ‘`R2`’, ‘`R3`’, ‘`R4`’, ‘`R5`’, ‘`R6`’ or ‘`R7`’.

Convience macro opcodes to deal with 16-bit values have been added.

Immediate 16 Bit Wide
  ‘`#number`’, or ‘`*symbol`’

  For example:

                ldw R1, #1024
                ldw R3, timer
                ldw R1, (R1, #0)
                COM R1
                stw R2, (R1, #0)