Assembly
assemblyThe axy virtual machine can be combined using the axy assembly language, a minimalist assembly-like concatenative language inspired by MOS 6502 assembly and Uxntal (and of course xyw).
Only the following token types are defined:
comments
numbers
instructions
directives
symbols
=== Comments
Comments are line-oriented only, and prefixed with a semicolon:
; This is a comment
=== Numbers
Only one-byte integers are supported (0-255) and must be written in base 16 (hexadecimal) prefixed with a dollar:
$00 ; A byte set to 0
$1F ; a byte set to 31
Note that only single bytes (two hexadecimal digits) can be represented in binary format.
=== Instructions
axy has 32 instructions that are written as uppercase three-letter mnemonics and may be followed by one or two lowercase mode flags (x and y):
ADDxy DUP MUL
=== Directives
axy provides two directives that are used to instruct the assembler to create a label or reserve bytes. They are single words prefixed with a dot followed by their argument(s), but they cannot span more than one line.
== .label directive
The label directive defines a label, which is an alias to a memory address corresponding to the exact location where the label is defined:
.label print.loop
In this case, the .label directive defines a label called print.loop, which can be used throughout the program to access the corresponding memory address.
Labels are essential for organizing code in subroutines and for implementing jumps without having to use raw memory addresses.
Note that all labels are globals, so typically you can use your own conventions to define "sub labels", such as using dots, but as a matter of fact all labels can be accessed from anywhere in the program.
Also, labels are processed in the same symbol table as macros (see the dedicated section further on), so they cannot have the same name as an existing macro, or reuse an instruction mnemonic.
Labels must start with a letter or underscore, and they can contain letters, numbers, underscores, dashes, or dots.
== .byte directive
The byte directive can be used to store arbitrary bytes in memory at the current address. It can take any number of arguments, each corresponding to a byte or a word to be stored:
.byte $00 $01 $02
=== Symbols
Symbols are user-created identifiers that are defined via the .label directive:
loop ; This symbol was created with .label