You specify the DC instruction to define the data constants you need for program execution. The DC instruction causes the assembler to generate the binary representation of the data constant you specify into a particular location in the assembled source module; this is done at assembly time.
Note that the DC instruction's name -- Define Constant -- is somewhat misleading: DC simply creates initial data in an area of the program. The contents of that area may be modified during program execution, so the original data isn't truly "constant". If you want to declare values that are more likely to behave like constants, use literals (Literals); the assembler attempts to detect and diagnose instructions that might change the contents of a field defined by a literal. If a control section has not been established previously, DC will initiate an unnamed (private) control section.
The DC instruction can generate the following types of constants:
| Type of Constant | Function | Example |
|---|---|---|
| Address | Defines address mainly for the use of fixed-point and other instructions |
L 5,ADCON ADCON DC A(SOMWHERE) |
| Binary | Defines bit patterns |
FLAG DC B'00010000' |
| Character | Defines character strings or messages |
CHAR DC C'string of characters' |
| Decimal | Used by decimal instructions |
ZAP AREA,PCON PCON DC P'100' AREA DS PL3 |
| Fixed-point | Used by the fixed-point and other instructions |
L 3,FCON FCON DC F'100' |
| Floating-point | Used by floating-point instructions |
LE 2,ECON ECON DC E'100.50' |
| Graphic | Defines character strings or messages that contain pure double-byte data |
DBCS DC G'<.D.B.C.S. .S.T.R.I.N.G>' |
| Hexadecimal | Defines large bit patterns |
PATTERN DC X'FF00FF00' |
| Zoned | Defines numeric characters |
ZONEVVAL DC Z'-123' |
|
If symbol denotes an ordinary symbol, the ordinary symbol represents the address of the first byte of the assembled constant. If several operands are specified, the first constant defined is addressable by the ordinary symbol. The other constants can be reached by relative addressing.
A DC operand has this format:
For example, in:
10EBP(7)L2'12'
the six subfields are:
If all subfields are specified, the order given above is required. The first, third, fourth and fifth subfields can be omitted, but the second and sixth must be specified in that order.
[ Top of Page | Previous Page | Next Page | Contents | Index ]