Instructions
Instructions are made to allow for the VASM compiler to turn human-readable instruction addresses into bytecode.
insName: identifier args[...]: any
push R1, 5 ; push 5 into R1
push R1, 6 ; push 6 into R1
Asides
Asides are functions that are ran between code generation and initial compilation. Good for running functionality that has no immediate represntation, however, makes it easier to write and read. For the list of available Asides, see the Asides Documentation
: (asideName: identifier) (args[...]: any)
:set thePrivateLetter 'B'
_start:
push R1, thePrivateLetter
; R1... ['B', ...]
Procedures
Since LR Assembly is procedural, the procedures can be defined with the following syntax:
SubName (Identifier) : Statement*
In VASM, each identifier is looked over to check whether it’s a procedure or not. This design procedure allows for a more dynamic and predictable code structure as opposed to trying to look at procedures on the fly.
Macros
Macros are code that is ran prior to the code generation stage and have no immediate bytecode representations. However, they are different from Asides because they are ran without any source-code awareness. This means that anything placed in macros is solely known to the compiler and can affect how the output binary comes out. For more information, see the Macro Documentation Page. And for the preprocessor runtime, see the Standard Directives Page
[compat nexfuse] ; to compile the program in nexfuse mode
[compile-if nexfuse] ; error out if the program isn't being compiled with the 'nexfuse' platform.
Numbers
The number syntax is similar to other languages. It can handle 0b
numbers, 0x
numbers, and register references. The number for VASM is 64-bit, meaning that its maximum value is 9,223,372,036,854,775,807
, however, general safety measures are in place to prevent number overflow and truncating, and errors will be printed if numbers are added that are larger than the destination format’s number size.
Here is an example.
number 0b101110 ; binary number 46
number 0x01 ; hex number 1
number R1 ; register, compiles to the number 1, however, is its own type.
number 215 ; decimal number 215
number 212999 ; non-standard. depending on the destination format this might not compile
Literals
Simple character literals are supported, including escape sequences.
push R1, 'A'
push R1, 'B'
push R1, '\n'
Character literals are also supported in Aside statements.
:set coolLetter 'B'
Ranges
Ranges are their own values and are used to specify a RANGE between one number and another. Another name for ranges is a Slice, which its name in the LR Assembly standard.
populate R1, {1:5}, 'B'
The range between the first and third parameters means FROM number ONE to FIVE. Ranges are new to v0.8-v0.9
Weird Platform-specific Caveats
-
In NexFUSE, all labels must be one letter, meaning that when calling
jmp
on a labelabc
, the label being called will still just bea
. -
In OpenLUD, headless binaries are allowed, however, do not generate anything.
-
SiAX is a MacOS-Only VM.