Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Imports

Module System

MnemonicSyntaxDescription
INCLUDEalias[:] "path"Include module symbols

Import Precedence

Notes:

  • The order of imports may affect the order in which dependencies are placed into the output binary.
  • Circular dependencies are allowed and fully supported.
  • The module name is caller-defined and can be used to create aliases for libraries within the scope of the calling file. This makes namespacing easy.

Examples:

include print "./lib/print.dsa"
include maths "./lib/maths.dsa"

External Symbol Access Convention

External symbols are accessed using the :: operator.

Examples:

include print "./lib/print.dsa"

init:
    // ensure we have a stack setup so we can call functions properly

db string: "Hello world!"

start:
    // load the address of the string into rg1.
    lwi string, rg1
    // push the string address argument
    push rg1
    // call the print function
    call print::print
    // clean up the stack
    pop zero
    hlt