Keil Logo

LABEL Assembler Statement

Arguments
symbol 〚:〛 LABELtype
Description

The LABEL statement defines a symbol name for a location in a section. The defined label inherits the attributes of the parent section. It may not be defined outside a section. Label definitions may optionally include a type which specifies the type of access required by the assembler. If no type is specified, the label type is set based on the section (NEAR for Code Sections, BYTE for Data Sections, and BIT for Bit Sections).

type Description
NEAR The label receives the NEAR type which implies that it must be defined in a Code Section.
FAR The label receives the FAR type which implies that it must be defined in a Code Section.
BYTE The label receives the BYTE type which implies that it must be defined in a Code or Data Section.
WORD The label receives the BYTE type which implies that it must be defined in a Code or Data Section and must start at an even (word) address.
BIT The label receives the BYT type which implies that it must be defined in a Bit Section.

The assembler checks access types for mismatches and generates an error if a problem occurs.

See Also

SECTION

Example
                        1     D100    SECTION DATA
                        2      XWORD  LABEL   WORD
0000 34                 3      VB1    DB 34H
0001 12                 4      VB2    DB 12H
                        5     D100    ENDS
                        6
                        7     B100    SECTION BIT
                        8      BLAB   LABEL   BIT
0000                    9      BIT1   DBIT
                       10     B100    ENDS
                       11
                       12     D200    SECTION DATA BITADDRESSABLE
                       13      DLAB   LABEL   BYTE
0000                   14      WORD1  DSW     1
                       15     D200    ENDS
                       16
                       17     C100    SECTION CODE
                       18     P100    PROC    NEAR
0000 F2F00000 R        19             MOV     R0,XWORD
0004 F3FF0000 R        20             MOV     RH7,DLAB
                       21             MOV     R5,DLAB  ; Type mismatch
*** _____________________________________________^
*** ERROR #74, LINE #21, ILLEGAL OPERAND TYPE
                       22     FLAB    LABEL FAR
                       23     YLAB:   LABEL FAR
                       24
000C CB00              25             RET
                       26     P100    ENDP
                       27     C100    ENDS
                       28
                       29     END
  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.