Slide 5.4: Data definition statements
Slide 5.6: Defining BYTE and SBYTE data
Home

Data Definition Statements (Cont.)

           MSG    BYTE     'H', 'e', 'l', 'l', 'o', 0
           X      SWORD    20h + 20q
           Y      BYTE     10101010b
                  SBYTE    ?
Each data definition has the same syntax:
  [ name ]  directive  initializer  [, initializer ] ...
Directive
It is any type from the table of intrinsic data types. The legacy data definition directives, as shown in the following table, can also be used.

Directive Usage   Directive Usage   Directive Usage
DB 8-bit integer DD 32-bit integer or real DT 80-bit tenbyte
DW 16-bit integer DQ 64-bit integer or real    

Initializer
If the initializer is the ? expression, it does not assign a specific value to the data. All initializers are converted to binary data by the assembler. For integer data types, initializer is an integer constant or expression that matches the size implied by the type.

Integer expression is a mathematical expression involving integer values and arithmetic operators. Some examples are: 1+2*3, 4/(3-1), or 5 MOD 2 .

Operators Name Precedence Level Example
( ) parentheses 1 (highest) (1 + 2) * 3
+, – unary plus, minus 2 -10 + +20
*, / multiply, divide 3 3 * 4 / 5
MOD modulus 3 10 MOD 3
+, – add, subtract 4 (lowest) 10h + 10b - 10d

Use parentheses in expressions to clarify the order of operations, so you don't have to remember precedence rules.