Keil Logo

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

Statement Description
ALIGN1 Forces the location counter to the next 2^n alignment.
EVEN1 Forces the location counter to the next even address.
ORG Sets the location counter to a specifies offset or address.
USING Specifies which register bank to use.

Conditional Assembly

Statement Description
IF Begins an IF-ELSE-ENDIF block.
ELSEIF Begins an alternate IF block.
ELSE Begins an ELSE block.
ENDIF Terminates an IF block.

Memory Initialization

Statement Description
DB Allocates memory for one or more defined byte values.
DD1 Allocates memory for one or more defined double word values.
DW Allocates memory for one or more defined word values.

Memory Reservation

Statement Description
DBIT Reserves space for one or more bits.
DS Reserves space for one or more bytes.
DSB1 Reserves space for one or more bytes.
DSD1 Reserves space for one or more double words.
DSW1 Reserves space for one or more words.

Procedure Declaration

Statement Description
ENDP1 Defines the end of a function.
LABEL1 Assigns an address to a symbolic name.
PROC1 Defines the beginning of a function.

Program Linkage

Statement Description
EXTERN1 Defines external symbols.
EXTRN Defines external symbols.
NAME Specifies the name of the current module.
PUBLIC Defines symbols which may be used in other modules.

Segment Control

Statement Description
BSEG Defines an absolute bit segment.
CSEG Defines an absolute code segment.
DSEG Defines an absolute data segment.
ISEG Defines an absolute idata segment.
RSEG Selects a relocatable segment.
SEGMENT Defines a relocatable segment.
XSEG Defines an absolute xdata segment.

Symbol Definition

Statement Description
BIT Defines an address in bit space.
CODE Defines an address in code space.
DATA Defines an address in data space.
EQU Sets a permanent symbol value.
IDATA Defines an address in idata space.
LIT1 Assigns a text string to a symbol name.
SBIT Defines a bit SFR.
SET Sets or resets a symbol value.
SFR Defines a byte SFR.
SFR16 Defines a word SFR.
XDATA Defines an address in xdata space.


Statement Description
__ERROR__ Generates an error message.
__WARNING__ Generates a warning message.
END Signals the end of the assembly module.


  1. This directive is available in the AX51 Assembler only.
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.