Since the XAVR assembler is written for DOS, the length of the name of the source file is restricted to 8 characters plus the .ASM extension.
ORG - Set the assembler's memory address to a new origin.
The ORG directive sets the assembler's current memory address to the value specified in the operand field. If no ORG directive is specified, the memory address is initialized to $0000. Examples:
ORG | $0010 | |||
ORG | main |
END - End of assembly
The END directive indicates to the assembler the end of the program. Any statements following the END directive are treated as comments and are not assembled.
EQU - Equate symbol to a value
The EQU directive assigns the value of the expression in the operand field to the label. The EQU directive assigns a value other than the current memory address to the label. The label cannot be redefined anywhere else in the program. The expression must not contain any forward references or undefined symbols. Examples:
SRAM | EQU | $0060 | ||
ten | EQU | 10 |
FCB - Form Constant Byte (also DB - Define Byte)
The FCB directive stores a byte into the current memory location. Examples:
CR | FCB | $0D | ||
ONE | FCB | 1 |
FCC - Form Constant Character
The FCC directive stores a single byte representing the ASCII code the specified character. Examples:
charA | FCC | A | ||
quote | FCC | " | ||
ZERO | FCC | 0 |
Note the differences with the following statements:
ZERO | EQU | 0 | ;nothing is stored in memory |
ZERO | FCB | 0 | ;$00 is stored at current PC |
ZERO | FCC | 0 | ;$30 is stored at current PC |
FCS - Form Constant String
The FCS directive places a sequence of bytes representing the ASCII codes of the characters in the specified string. The first non-space character following FCS is the string delimiter and is not part of the string. The string consists of all characters following the delimiter up to, and not including, the next delimiter. The sequence of bytes stored is terminated with a zero byte. Examples:
mess | FCS | 'This is a string' |
title | FCS | $This is another string |
text | FCS | "The second delimiter is not needed |
FDB - Form Double Byte constant (also DW - Define Word)
The FDB directive places a double byte (16-bits) the the current memory location. The low order byte is placed in the lower of the the memory addresses. Examples:
num | FDB | 1234 | ||
vect | FDB | $FFFE | ||
rstrt | FDB | start |
RMB - Reserve Memory Bytes (also DS - Define Storage)
The DS or RMB directive reserves the specified number of bytes at the current memory address. The memory address counter is then advanced by the specified number of bytes. Examples:
num | DS | 1 | ;reserve 1 byte |
result | DS | 4 | ;create a 32-bit result |
buffer | DS | 16 | ;create a buffer of 16 bytes |
DATA - append to Data segment
The DATA directive precedes any RMB or DS directive to specify that data storage is to be reserved in the SRAM Data space.
EEPROM - append to EEPROM segment
The EEPROM directive precedes any RMB, DS, FCB, FCW, FDB, FCC, FCS, DB, DW directives to specify that data is to be stored in the EEPROM data space.
CODE - append to CODE segment
The CODE directive specifies that all code and data following this directive are to be stored in the flash (program) memory space.
LO - assign LO-Order byte of byte-address to a label
HI - assign HI-Order byte of byte-address to a label
The LO and HI directives are used together to assign the LO and HI bytes of the 16-bit byte-address of a table created in CODE space. These are used in the program by loading a 16-bit index register with the LO-HI pair. For example:
myadr.L | LO | table | |
myadr.H | HI | table |