Hardware Reference
In-Depth Information
sum of the BX and DI registers. This value is then pushed onto the stack. The last
two types of addresses can be combined to get register with index and displace-
ment addressing, as in
NOT 20(BX)(DI)
which complements the memory word at BX+DI+20 and BX+DI+21.
All the indirect addressing modes in the data segment also exist for the stack
segment, in which case the base pointer BP is used instead of the base register BX .
In this way ( BP ) is the only register indirect stack addressing mode, but more
involved modes also exist, up to base pointer indirect with index and displacement
1(BP)(SI) . These modes are valuable for addressing local variables and function
parameters, which are stored in stack addresses in subroutines. This arrangement
is described further in Sec. C.4.5.
All the addresses which comply with the addressing modes discussed up to
now can be used as sources and as destinations for operations. Together they are
defined to be effective addresses . The addressing mode in the remaining two
blocks cannot be used as destinations and are not referred to as effective addresses.
They can only be used as sources.
The addressing mode in which the operand is a constant byte or word value in
the instruction itself is called immediate addressing . Thus, for example,
CMP AX,50
compares AX to the constant 50 and sets bits in the flag register, depending on the
results.
Finally, some of the instructions use implied addressing . For these instruc-
tions, the operand or operands are implicit in the instruction itself. For example,
the instruction
PUSH AX
pushes the contents of AX onto the stack by decrementing SP and then copying AX
to the location now pointed to by SP . SP is not named in the instruction itself,
however; the mere fact that it is a PUSH instruction implies that SP is used. Simi-
larly, the flag manipulation instructions implicitly use the status flags register with-
out naming it. Several other instructions also have implicit operands.
The 8088 has special instructions for moving ( MOVS ), comparing ( CMPS ), and
scanning ( SCAS ) strings. With these string instructions, the index registers SI and
DI are automatically changed after the operation. This behavior is called auto
increment or auto decrement mode. Whether SI and DI are incremented or decre-
mented depends on the direction flag in the status flags register. A direction flag
value of 0 increments, whereas a value of 1 decrements. The change is 1 for byte
instructions and 2 for word instructions. In a way, the stack pointer is also auto
increment and auto decrement: it is decremented by 2 at the start of a PUSH and
incremented by 2 at the end of a POP .
 
Search WWH ::




Custom Search