Skip to content
jbw3 edited this page Feb 25, 2017 · 12 revisions

The syntax is case insensitive. Comments start with an octothorpe (#) and continue to the end of the line.

# This is a comment

There may be no more than one instruction per line. Each instruction starts with its mnemonic and is followed by zero or more arguments. Arguments are separated by commas.

NOP
ADD R0
MOV R0, 7
SUB R0, R1, R2

Arguments may be either register names or immediate values. Immediate values may only be integers greater than or equal to zero and may be in binary, octal, decimal, or hexadecimal format.

MOV R5, 0b101  # binary
MOV R10, 0o777 # octal
ADDI R0, 42    # decimal
MOV R2, 0xD2   # hexadecimal

A label may be placed at the beginning of a line followed by :. No more than one label may be placed on a line.

label1: MOV R1, R2
label2:
    ADD R1, R3

A constant may be defined with the assignment operator (=). It may be assigned to a numeric value or a previously defined constant or label. No more than one constant may be defined on a line.

x = 2
y = 0xABC

label:
    ADDI R1, x

z = label

Clone this wiki locally