3. Assembler Directives

Table 36. Directives

Directive Example Description
* *=$1000 Sets the memory position to a given value.
.align .align $100 Aligns the memory position with the given value. Ex. '.align $100' at memory position $1234 will set the position to $1300.
.assert .assert "Test 1",2+2,4 Asserts that two expressions or codeblocks are equal.
.asserterror .asserterror "Test 2", List().get(27) Asserts that a given expression or codeblock generates an error.
.by .by $01,$02,$03 An alias for '.byte'.
.byte .byte $01,$02,$03 Outputs bytes.
.const .const DELAY=7 Defines a constant.
.define .define width, height {...} Executes a block of directives in 'functionmode' (faster) to define values.
.disk .disk [..disk pararamters..] {..fileparameters..} Creates a d64 image file.
.dw .dw $12341234 An alias for '.dword'.
.dword .dword $12341234 Outputs doublewords (4 byte values).
.encoding .encoding "screencode_upper" Sets the character encoding.
.enum .enum {on, off} Defines a series of constants.
.error .error "not good!" Creates an user raised error.
.errorif .errorif x>10 "not good!" Creates an user raised error if condition is evaluated to true.
.eval .eval x=x+y/2 Evaluates a script expression.
.file .file [name="myfile.prg" segments="Code, Data"] Creates a prg or bin file from the given segments.
.filemodify .filemodify Encrypt(33) Modify the output of the current source file with the given modifier.
.filenamespace .filenamespace myspace Creates a namespace for all the following directives in the current source file.
.fill .fill 10, i*2 Fills a number of bytes with the value of a given expression.
.for .for(var i;i<10;i++) {...} Creates a for loop.
.function .function area(h,w) {..} Defines a function.
.if .if(x>10) {...} Executes code if the given condition is true.
.import binary .import binary "Music.bin" Imports a binary file.
.import c64 .import c64 "Music.c64" Imports a c64 files. Same as '.import binary', but ignores the two address bytes at the start of the file.
.import source .import source "MyLib.asm" Imports another source file. (Depricated, use #import instead)
.import text .import text "scroll.txt" Imports a text file.
.importonce .importonce Make the assembler skip the current file if it has already been imported. (Depricated, use #importonce instead)
.label .label color=$d020 Assigns a given expression to a label.
.macro .macro BasicUpstart() {...} Defines a macro.
.memblock .memblock "New block" Defines a new memoryblock at the current memoryposition.
.modify .modify Encrypt(27) {...} Modifies the output of a codeblock using the given modifier.
.namespace .namespace myspace {..} Creates a local namespace.
.pc .pc=$1000 Same as '*='
.plugin .plugin "plugins.macros.MyMacro" Tells the assembler to look for a plugin at the given java-package path.
.print .print "Hello" Prints a message to the console in the last pass.
.printnow .printnow "Hello now" Prints a message to the console immediately.
.pseudocommand .pseudocommand mov src:tar {...} Defines a pseudocommand.
.pseudopc .pseudopc $2000 {...} Sets the program counter to something else than the actual memory position.
.return .return 27 Used inside functions to return a value.
.segment .segment Data "My Data" Switches to another segment.
.segmentdef .segmentdef Data [start=$1000] Defines a segment.
.struct .struct Point {x,y} Creates a user defined structure.
.te .te "hello" An alias for '.text'.
.text .text "hello" Dumps text bytes to memory.
.var .var x=27 Defines a variable.
.while .while(i<10) {...} Creates a while loop.
.wo .wo $1000,$1012 An alias for '.word'.
.word .word $1000,$1012 Outputs words (two bytes values),
.zp .zp { label: .byte 0 ... } Marks unresolved labels as being in the zeropage.