3-10 DIRECTIVES AND OPERATORS

Assembler instructions are translated into machine language instructions and correspond to executable statements in high-level language programs. Just as high-level language programs must have nonexecutable statements to preassign values, reserve storage, assign names to constants, form data structures, and terminate a compilation, assembler language programs must contain directives to perform similar tasks.

3-10-1 Data Definition and Storage Allocation

Statements that preassign data and reserve storage have the form:

Variable    Mnemonic    Operand, . . . , Operand     ;Comments
where the variable is optional, but if it is present it is assigned the offset of the first byte that is reserved by the directive. Note that unlike the label field, a variable must be terminated by a blank, not a colon. The mnemonic determines the length of each operand and is one of the following:

To preassign data the operand must be a constant, an expression that evaluates to a constant, or a string constant. For example,

DATA_BYTE   DB    10,4,10H
DATA_WORD   DW    100,100H,-5
DATA_DW     DD    3*20,0FFFDH
will cause a sequence of bytes to be preassigned as shown in Fig. 3-55.

Figure 3-55 Typical preassignment of data using the DB, DW, and DD directives.


Table of Contents | Next page | Previous page

This is page 41.