14.1.2 Directives
CEF directives typically start with a period (“.”). Exceptions are described in the following text. The standard CEF directives are:
.ADDRESS directive
Format: .ADDRESS n
Defines data the size of the virtual address space. For instance, if the CPU maximum virtual address is FFFF (hex), this will define two bytes containing value "n".
.ALIGN directive
Format; .ALIGN {n}
Synonym: ALIGN
Align to next n bytes. n can be either a number or one of the following values:
BYTE
WORD
LONG
QUAD
OCTA
PARAGRAPH
PAGE
If a numeric value is specified, the byte alignment is equal to 2^n bytes. For instance, "ALIGN 2" would align to a 4 byte boundary. PARAGRAPH and OCTA are equivalent. PAGE depends on the CPU page size. If "n" is omitted, the directive is equivalent to "ALIGN PAGE".
.ASCIC directive
Format: .ASCIC s
ASCII data with length prefix byte. "s" is a string literal. See the .ASCII directive for details on its format.
.ASCII directive
Format: .ASCII s
ASCII data. "s" is a string literal. This literal must be delimited by a non-space character. The delimiter is whichever non-space character immediately follows the directive. The delimiter must occur at the end of the string as well. Multiple strings can follow so long as each is delimited. Non-printable characters can be included by placing the value of the character within angle brackets (<>) outside of the quote characters. Any expression can be placed within the angle brackets, which will be evaluated and the character corresponding to that ASCII value will be substituted. Note that any space or tab occuring outside of quote characters will terminate the text specification. Examples:
.ASCII "This is text"
.ASCII /Some more text/
.ASCII /New line: /<13.><10.> ; CRLF
.ASCII 'This ''is ''also ''text'
.ASCIZ directive
Format: .ASCIZ s
ASCII data with terminating null byte. "s" is a string literal. See the .ASCII directive for details on its format.
.BCD directive
Format: .BCD n
Defines a Binary-coded Decimal formatted value of value n. Example:
.BCD 8228
.BLKA directive
Format: .BLKA n
Reserves n * x bytes of uninitialized data where "x" is the size of the virtual address space. For instance, assume that the CPU has a maximum virtual address of FFFF (hex). Thus, ".BLKA 3" would reserve 6 bytes.
.BLKB directive
Format: .BLKB n
Synonyms: DS n
.BLOCK n
.DS n
DEFS n
.DEFS n
Reserves n bytes of uninitialized data.
.BLKD directive
Format: .BLKD n
Reserves n * 8 bytes of uninitialized (double-precision floating-point) data.
.BLKF directive
Format: .BLKF n
Reserves n * 4 bytes of uninitialized (floating-point) data.
.BLKL directive
Format: .BLKL n
Reserves n * 4 bytes of uninitialized (long) data.
.BLKO directive
Format: .BLKO n
Reserves n * 16 bytes of uninitialized (octa) data.
.BLKQ directive
Format: .BLKQ n
Reserves n * 8 bytes of uninitialized (quad) data.
.BLKW directive
Format: .BLKW n
Reserved n * 2 bytes of uninitialized data.
.CODES directive
Format: .CODES
See also: .NOCODES
Earliest Version: 2.1
Turns on the display of generated data in the listing output. This is the default.
.DB directive
Format: .DB n{,n...}
Synonyms: DB n
DEFB n
.DEFB n
.BYTE n
.SIGNED_BYTE n
Format: .DB "n"
Synonyms: DB "n"
Reserves byte(s) of data. DB and .DB can be followed by a quoted text or an expression. The expression can include quoted characters. See the section on expressions for more details. A comma-delimited list of values may follow. Examples:
.DB '#'
.DB '0' - 32
.BYTE 4,'Text',TTY/2
.DEFINE directive
Format: .DEFINE s
Defines a conditional symbol. "s" is the symbol name. Example:
.DEFINE Test_Mode
#DEFINE directive
Format: #DEFINE name{arguments} definition
Defines a single-line macro. See the section on macros for more information.
.DEFM directive
Format: .DEFM "s"
Synonyms: DEFM "s"
(see also .TEXT)
Stores ASCII data. The ASCII data must be delimited by double quotes (") or single quotes ('). Multiple delimited strings may appear after the directive. Examples:
.DEFM 'This is ASCII text'
.DEFM 'He said, "It'"'s too bad"'"'
The second example stores the following:
He said, "It's too bad"
.DOUBLE directive
Format: .DOUBLE n
Synonyms: .D_FLOATING n
Defines Double-precision floating point data (8 bytes). "n" is a floating-point numeric value. Examples:
.DOUBLE 3.14159
.DWORD directive
Format: .DWORD n
Synonyms: DD n
.DD n
DEFD n
.DEFD n
Stores "n" as a 4 byte value. Example:
.DWORD 32767.
.EJECT directive
Format: .EJECT
Earliest spec: 2.1
This moves the assembly listing to the top of the next page.
.ELSE directive
Format: .ELSE
This is used in conditional assembly. It is only valid within IF block. See the section on conditional assembly for details.
.END directive
Format: .END {a}
Synonyms: END {a}
End of assembly source. The assembler does not process any text past this directive. The optional address defines where code execution will begin.
.ENDC directive
Format: .ENDC
End conditional. Terminates an IF block. See the section on conditional assembly for details..
#ENDIF
Format; #ENDIF
Ends a #IF block.
.ENDM directive
Format: .ENDM
Ends a macro. See the section on macros for details.
.ENDR directive
Format: .ENDR
Ends a repeat block started by .REPEAT, .IRP, or .IRPC.
.EOT directive
Format: .EOT
Null directive. Has no effect.
EQU directive
Format: s EQU v
Synonym: s = v
Equate symbol s to value v. Example:
Space EQU 32
Exclamation = 33
.ERROR directive
Format: .ERROR {s;}m
Generates an assembly-time error with text "m". An optional expression "s" is evaluated and shown as well.
.EVEN directive
Format: .EVEN
Synonyms: .ALIGN 1
Adjusts to an even address. If on an odd address, a byte of 0 is inserted.
.IIF directive
Format: .IIF condition {,}arguments, statement
Immediate conditional assembly. The condition and argument(s) must be separated by a space, tab, or comma. The arguments depend upon the condition. See the section on conditional assembly for details on conditions. If the condition is true, the statement will be assembled.
Example:
.IIF DEFINED Test_Mode, .DEFM "Testing"
.IF directive
Format: .IF condition arguments
See also: #IF
Begins conditional assembly. See the section on conditional assembly for details.
.IF_ directives
.IF_TRUE conditional assembly. .IFT
.IF_FALSE conditional assembly. .IFF
.IF_TRUE_FALSE conditional assembly. .IFTF
Used to switch within an IF block. See the section on conditional assembly for details.
#IF directive
Format: #IF(condition)
See also: .IF
Begins conditional assembly. This differs from the .IF directive. The IF block is terminated with #ENDIF. The condition has the format: expression1 operator expression2
where “expression 1” and “expression 2” are simple expressions and “operator” is one of the following conditional operators:
Operator |
Meaning |
== |
Equal |
!= |
Not equal |
< |
Less than |
> |
Greater than |
<= |
Less than or equal |
>= |
Greater than or equal |
Examples:
#if(P1 < P2)
.DB 1
#endif
#if((P1-1) != (P2 * 2))
.DB FFH
#endif
.INCLUDE directive
Format: .INCLUDE x
Synonyms: INCLUDE x
Includes another file at the current position. "x" is the name of the file to include. The entire remainder of the line after the directive is considered to be the file name.
.IRP directive
Format: .IRP symbol, arguments
Indefinite repeat. "symbol" is a symbol that is replaced with successive arguments within the repeat block, which is ended by the .ENDR directive. "arguments" is one or more areguments separeted by commas. The argument list is delimited by angle brackets (<>) or matched delimiters. Matched delimiters are indicated by using a circumflex (^) followed by the delimiter. Examples:
.IRP ARG,<32,33>
.BYTE ARG
.ENDR
.IRP ARG,^X0,64,127,129X
.BYTE ARG
.ENDR
.IRPC directive
Format: .IRPC symbol,string
Indefinite repeats characters in "string". "symbol" is a symbol that is replaced with successive chraracters within the repeat block, which is ended by the .ENDR directive. The string may be delimited as defined in the .IRP directive description. However, it is not required that the string be delimited. Examples:
.IRPC ARG,SYMBOL
.DB 'ARG'
.ENDR
.IRPC ARG,<TopsyTurvey>
.DB 'ARG'
.EDNR
.LSFIRST directive
Format: .LSFIRST
See also: .MSFIRST
Earliest version: 2.1
Sets data to little-endian (least significant data in lower addresses).
.MACRO directive
Format: .MACRO name
Begins a macro definition. See the section on macros for details.
.MDELETE directive
Format: .MDELETE x
Deletes the macro named "x". This can be used within the named macro to allow it to execute only once.
.MEXIT directive
Format: .MEXIT
Exit a macro expansion before the .ENDM.
.MSFIRST directive
Format: .MSFIRST
See also: .LSFIRST
Earliest version: 2.1
Sets data to big-endian (most significant data in lower addresses).
.NARG directive
Format: .NARG s
Determine number of macro arguments. The number of arguments passed
to the current macro is assigned to symbol "s". This is only valid
within a macro block. See the section on macros for more details.
.NCHR directive
Format: .NCHR symbol, string
Counts the number of characters in "string" and assigns that value to symbol "symbol". The primary purpose is for determining the length of macro arguments. "string" does not have to be delimited unless it starts with "<" or "^". It can be delimited between "<" and ">", or with any other character if that character is preceded with a circumflex (^). Examples:
.NCHR COUNT, ARG
.NCHR COUNT, <How many?>
.NCHR C, ^XHow many?X
.NOCODES directive
Format: .NOCODES
See also: .CODES
Earliest Version: 2.1
Turns off the display of generated data in the listing output. This is the default.
.NOPAGE directive
Format: .NOPAGE
See also: .PAGE
Earliest version: 2.1
Turns paging off in assembler listing output.
.ODD directive
Format: .ODD
Align to odd byte address.
.ORG directive
Format: .ORG a
Synonym: ORG a
Position the current instruction position to address "a". Also sets the destination address of subsequent assembled code.
.PACKED directive
Format: .PACKED n
Store a packed BCD value for n. Example:
.PACKED 123.45
.PAGE directive
Format: .PAGE
See also: .NOPAGE
Earliest version: 2.1
Turns paging on in assembler listing output. When on, the listing provides a three-line header and a three-line footer on each page of 66 lines. A form feed (ASCII 12) is used to move to the top of the next page when .EJECT is encountered or the page fills.
.RADIX directive
Format: .RADIX n
Use base n for numeric literals. n must be in the range 2<=n<=36
.RADIX50 directive
Format: .RADIX50 s
Store radix-50 data for the string "s". Multiple strings, delimited by commas, may be specified. Example:
.RADIX50
.REF directives
Format: .REF1 n
Synonym: .BYTE n
Store 1 byte of data of value n. n must be an integer value.
Format: .REF2 n
Synonym: .WORD n
Store 2 bytes of data of value n. n must be an integer value.
Format: .REF4 n
Synonym: .LONG n
Store 4 bytes of data of value n. n must be an integer value.
Format: .REF8 n
Synonym: .QUAD n
Store 8 bytes of data of value n. n must be an integer value.
Format: .REF16 n
Synonym: .OCTA n
Store 16 bytes of data of value n. n must be an integer value.
.REMARK directive
Format: .REM{ARK}
Synonym: COMMENT
Source comment line. The entire line after the directive is ignored as a comment.
.REPEAT directive
Format: .REPEAT n
Synonym: .REPT n
Repeat a block n times, where n is an integer. The block is terminated with .ENDR.
.SET_TARGET_CPU
Format: .SET_TARGET_CPU name
Set the target CPU for assembly to the CPU with the specified name. This name is the name of the component loaded via the LOAD command in an emulator command file.
.SINGLE directive
Format: .SINGLE n
Synonyms: .FLOAT n
.S_FLOATING n
Stores a single-precision (4 byte) floating-point value. Example:
.FLOAT 2.46E+10
.TEXT directive
Format: .TEXT "s"
Earliest spec: 2.1
See also .DEFM
Stores ASCII data. The data must be delimited by double quotes (") or single quotes ('). Multiple delimited strings may appear after the directive. Escape codes are allowed in the text. An escape code begins with a backslash (\). Valid escape codes:
Code |
Meaning |
\b |
Backspace (ASCII 8) |
\f |
Form feed (ASCII 12) |
\t |
Horizontal tab (ASCII 9) |
\r |
Return (ASCII 13) |
\n |
New line (ASCII 10) |
\\ |
Backslash |
\nnn |
ASCII code nnn, where nnn is an octal number. For instance, \101 would translate to “A”. |
Examples:
.TEXT 'This is ASCII text'”More text'
.TEXT '>\t Press Enter to continue\r\n\000'
.TITLE directive
Format: .TITLE x
Earliest spec: 2.1
Sets the Assembly listing page title to “x”.
.UNDEFINE directive
Format: .UNDEFINE s
Undefines symbol "s". The symbol is removed from the symbol table.
.WARN directive
Format: .WARN {s,}m
Synonym: .WARNING {s,}m
Generates an assembly-time warning with text "m". An optional expression "s" is evaluated and shown as well.
.WORD directive
Format: .WORD n
Synonyms: DW n
.DW n
DEFW n
.DEFW n
.SIGNED_WORD n
Stores 2 bytes of data of value n, where n is an integer.