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 [.used]
Sets the address of object name to address. If .used is specified, the object will be marked as used and included in the binary program.
.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 visibility
The .visibility directive specifies the visibility of the following elements.
local elements are only visible within the same source file.
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 on the same line 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.
.local
Makes the element local to the current source file. It will not be visible to other source files in the same module.
.private
Makes the element private.
.public
Makes the element public.
Objects
Object Modifiers
Objects can be modified by one or more of the following modifiers, specified after their name on the same line:
.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. It will be included in the binary program even if it is not referenced by any other object.
.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