There are a few compile-time directives:
With this directive, you include kernel modules you're going to use in your project.
using "ios" ; <-- includes input-output-string module, for printing and inputting textYou can define constants with this one:
def myConstant, "hello!\n"
.start
mov tlr, myConstantUsing this one, you can link multiple files within one application, which is a core of moduled programming.
link "path/to/file.asm"Warning
You have to provide a full path to the file, relative to the index file you're providing to the virtual machine.
Note
This was added in build 25.
Used to configure compiler behaviour. Currently has no functional settings!
Note
This was added in build 26.
Used to undefine symbols declared using def.
undef symbolNameNote
This was added in build 31.
The NewASM compiler allows following compile-time instructions for implementing very simple logic:
ifdef: checks if a symbol/flag is defined;ifndef: checks if a symbol/flag is not defined;fi: used for ending anifblock.
If you want to combine if-statements, just nest them, you don't need to use fi more than once.
ifdef SMTH
ifndef SMTH_ELSE
; do something
fiThere are no else variants, you have to end each if-block with fi.