|
|
|
|
DATAx Assembler Operator
| Arguments |
DATAx operand
|
| Description |
The DATAx operators specify the type for constants
(used in instructions and external values). The range of values for
each DATAx operator is shown in the following
table:
The DATAx operators (where x may be one of
3,4,8,16,32, or 64) specify the type for constants (used in
instructions and external values). The range of values for each
DATAx operator is shown in the following table:
| Operator |
Value Range |
| DATA3 |
0-7 |
| DATA4 |
0-15 |
| DATA8 |
0-255 |
| DATA16 |
0-65,535 |
| DATA32 |
0-4,294,967,295 |
| DATA64 |
0-18,446,744,073,709,551,615 |
When the assembler encounters a constant immediate expression, it
must make an assumption about the type based on the constant value.
The Keil A166 Assembler makes three passes through the source code
and automatically determines the type size and smallest instruction
coding. Other assemblers require use of the DATAx
operator to resolve types that are forward references. The three-pass
nature of the Keil A166 Assembler makes this unnecessary.
Note
-
The DATAx operator may be used to enlarge a
constant type. However, it is not possible to use
DATAx to shrink a constant type (for example,
DATA3 12). When the assembler detects an attempt to shrink a
constant type, the value is truncated and a warning is
emitted.
|
| Example |
1 C100 SECTION CODE
2 P100 PROC NEAR
0000 E070 3 MOV R0, #CONS
0002 E6F10700 4 MOV R1, #DATA16 CONS
0006 E002 E 5 MOV R2, #CON3
6 P100 ENDP
7 C100 ENDS
8
9 EXTRN CON3 : DATA3
10 CONS EQU 7 ; DATA3 type derived
11 ; from value 7
12 END
The assembler generates short MOV instructions for the CONS and
CON3 forward references on lines 3 and 5 even though the
DATAx operator was not used.
|
|
|
|