Keil™, An ARM® Company

Ax51 User's Guide

Control Statements

The Ax51 Assembler provides a number of control statements that permit you to define symbol values, reserve and initialize storage, and control the placement of your code.

These statements should not be confused with processor instructions or with assembler directives. They do not produce executable code and, with the exception of the DB, DD, and DW statements, they have no direct effect on the contents of code memory. These controls change the state of the assembler, define user symbols, and add information to the object file.

Control statements may be divided into the following categories:

Address Control

StatementDescription
EVEN1Forces the location counter to the next even address.
ORGSets the location counter to a specifies offset or address.
USINGSpecifies which register bank to use.

Conditional Assembly

StatementDescription
IFBegins an IF-ELSE-ENDIF block.
ELSEIFBegins an alternate IF block.
ELSEBegins an ELSE block.
ENDIFTerminates an IF block.

Memory Initialization

StatementDescription
DBAllocates memory for one or more defined byte values.
DD1Allocates memory for one or more defined double word values.
DWAllocates memory for one or more defined word values.

Memory Reservation

StatementDescription
DBITReserves space for one or more bits.
DSReserves space for one or more bytes.
DSB1Reserves space for one or more bytes.
DSD1Reserves space for one or more double words.
DSW1Reserves space for one or more words.

Procedure Declaration

StatementDescription
ENDP1Defines the end of a function.
LABEL1Assigns an address to a symbolic name.
PROC1Defines the beginning of a function.

Program Linkage

StatementDescription
EXTERN1Defines external symbols.
EXTRNDefines external symbols.
NAMESpecifies the name of the current module.
PUBLICDefines symbols which may be used in other modules.

Segment Control

StatementDescription
BSEGDefines an absolute bit segment.
CSEGDefines an absolute code segment.
DSEGDefines an absolute data segment.
ISEGDefines an absolute idata segment.
RSEGSelects a relocatable segment.
SEGMENTDefines a relocatable segment.
XSEGDefines an absolute xdata segment.

Symbol Definition

StatementDescription
BITDefines an address in bit space.
CODEDefines an address in code space.
DATADefines an address in data space.
EQUSets a permanent symbol value.
IDATADefines an address in idata space.
LIT1Assigns a text string to a symbol name.
SBITDefines a bit SFR.
SETSets or resets a symbol value.
SFRDefines a byte SFR.
SFR16Defines a word SFR.
XDATADefines an address in xdata space.

Miscellaneous

StatementDescription
__ERROR__Generates an error message.
ENDSignals the end of the assembly module.

Note

  1. This directive is available in the AX51 Assembler only.