Figure 3-3 Operand formats for the addressing modes.

Addressing ModeFormatExamples
Data-related
ImmediateConstant Expression10110B
529
0A9H
'AB'
YY-XX+5
DirectVariable +- Constant ExpressionWGT
CNT-5
ARRY+5
RegisterRegisterAX
DH
Register indirect[Register][BX]
Register relativeVariable[Register +- Constant Exp]
or
[Register +- Constant Exp]
VAR X[BX]
MESG[SI+10H]
[BX-1]
Based indexed[Base register][Index register][BP][DI]
Relative based indexedVar.[Base reg. +- Const. Exp][Index reg. +- Const. Exp]
or
[Base reg. +- Const. Exp][Index reg. +- Const. Exp]
E[BX+5][SI-2]
DATA[BX][SI]
[BP+2][DI-2]
Branch-related
Intrasegment directLabel +- Constant ExpressionOVFL_ERROR+7
Intrasegment indirectSame as data-related formats except cannot be immediate
Intersegment directLabel +- Constant ExpressionBRANCH_EXIT
Intersegment indirectSame as data-related formats except must not be immediate or register

Figure 3-4 Typical assembler language instructions.

assume that

ADD AX,(BX)
is a word addition and
ADD AL,(BX)
a byte addition. Also, if appropriate directives are used to define COST to be a word variable and COUNT to be a byte variable, then
INC COST
will be a word operation, and
INC COUNT
will be a byte operation. For some situtations, however, it is impossible for the assembler to deduce the operand type. The instruction
INC [BX]
increments the quantity whose address is in BX, but should it increment a byte or a word? One of the purposes of the PTR operator is to specify the length of a quantity in this and other ambiguous situations. It is applied by writing the desired type followed by PTR. For the above INC instruction the PTR operator would be used to modify the operand as follows:
INC BYTE PTR [BX]
if a byte is to be incremented, or
INC WORD PTR [BX]
if a word is to be incremented.
Table of Contents | Next page | Previous page

This is page 23.