Skip to content

Assembler Source File

A source file contains definitions that will be translated to a library or a binary program.

It consists of a list of elements and directives, separated by newlines. Instructions, labels, and assignments within an object or macro are also separated by newlines.

Directives

.cpu

  .cpu name

This overrides the CPU specified in the target for this file.

.pin

  .pin name address

Sets the address of object name to address and marks it as used.

.section

  .section section-name

The .section directive specifies which section the following objects will be placed in. This determines where in memory they will be placed, and whether they will be included in the binary program (data objects) or not (reservation objects).

.target

  .target "target-name"

The .target directive specifies which target definition file will be used in translating the file.

.use

  .use name

Marks the object name as used.

.visibility

.visibility {public|private}

The .visibility directive specifies the visibility of the following elements.

private elements are only visible within the same module (library, main program, or target).

public elements are also visible to modules using a library. Elements from the program used by the target must also be public.

Elements

Element Modifiers

Elements can be preceded by one or more modifiers:

.default

This definition is only used if no regular definition with the same name is found. It can be used by a target to define a default implementation.

.private

Makes the element private.

.public

Makes the element public.

Objects

Object Modifiers

.align
.align alignment

The object's address will be a multiple of alignment.

.address
  .address address

Specifies the address to place the object at.

.used

Marks the object as used.

.uses
  .uses name

If the object is used, object name is also used.

Data Objects

These contain code or other data and are saved in the resulting program binary:

  [element modifiers] name [object modifiers] {
    body
}

Reservation Object

These only reserve a certain amount of memory, which will not be initialized and is usually not saved in the resulting program binary:

  [element modifiers] name [object modifiers] .reserve length

Constants

Constants define values that can be used in other parts of the program. They can refer to other constants or objects (which results in their address).

  [element modifiers] name = value

Macros

  [element modifiers] .macro name [argument[=default-value], ...] {
    body
}

Functions

  [element modifiers] name ([argument[=default-value], ...]) = value