Conventions Used in This Manual

This manual uses certain conventions in describing the opcodes and opcode parameters. Atom has one register type: Variant, that can hold either a string or numeric value. Registers are identifies with an R followed by a number from 1 to 64. For example, R1 is register 1.

Optional parameters are enclosed with square brackets [].

Some opcodes will accept either a register or constant. This is indicated with the vertical bar |.

In Atom Assembler, comments starts with a # and go to the end of the line.

Syntax Format

Atom Assembler is composed of opcodes, registers, constants and labels. Here is an example program:

# Some simple code to print some Fibonacci numbers
# Leon Brocard <acme@astray.com>
# Modified for Atom by Richard Clark 
       cls:
       print:   "The first 20 fibonacci numbers are:"
       set:     R1, 0
       set:     R2, 20
       set:     R3, 1
       set:     R4, 1 
REDO@  eq:      R1, R2, DONE, NEXT
NEXT@  set:     R5, R4 
       add:     R4, R3, R4
       set:     R3, R5 
       print:   R3
       inc:     R1
       goto:  REDO 
DONE@  print:"Done!"
       end:

The VM ignores whitespace, but each opcode needs to be on a separate line.

Labels are defined as label@. Labels must be in the left-most position and end in a ampersand @.

Opcodes end in a colon :, and opcode parameters are separated with a comma ,.

Strings should be enclosed with a beginning and ending quote ".

Registers are numbered 1 through 64.

Opcodes that take a label as a parameter, must match a label that has been defined with @. Do not add the @ when using a label as a parameter or an error will occur.