Hardware Reference
In-Depth Information
accumulator can be rotated by the value placed in the CL register:
rote4: MOV
CL,4
; Number of bits to shift
ROR
AX,CL
; Rotate to the right
RET
DX (DH and DL) register
The DX register is a general-purpose 16-bit register which can also be used as
an extension of the AX register in 16-bit multiplication and division.
Stack Pointer (SP)
The SP register acts as a conventional Stack Pointer and points to the memory
offset (relative to the paragraph address held in the Stack Segment register) of
the current top of the stack. Adjustment of the SP register is automatic and pro-
grammers should avoid modifying the contents of this register if at all possible!
Base Pointer (BP), Destination Index (DI), Source Index (SI)
These registers are used in some of the more sophisticated of the 8086 addressing
modes which permit the programmer to implement advanced data structures
(such as two-dimensional arrays). All three registers are used to form addresses
as shown in the following simple examples:
Copies the word present in the AX register to an
address offset by 20 bytes from the Base Pointer (BP).
MOV
[BP+20],AX
Places 20H (previously defined by an equate of the
form space EQU 20H) at the address pointed to by
the Destination Index (DI).
MOV
[DI],space
Move the start address of message into the Source
Index (SI). Thereafter, SI can be used with an offset
to point to a particular character within the string,
message.
MOV
SI,message
Instruction Pointer (IP)
The Instruction Pointer is a 16-bit register which points to the address of the
next instruction to be executed. The Instruction Pointer is automatically updated
by the CPU and the physical address of the instruction is found by adding the
16-bit value taken from the Instruction Pointer with the 16-bit value taken from
the Code Segment Register shifted 4 bits to the left (see Chapter 1).
Flag Register (F)
The 8086 has a 16-bit Flag Register which contains nine status bits which may
be set (0) or reset (1) depending upon the internal state of the CPU. Flags keep
their status (either set or reset) until an instruction is executed which has an
effect on them. The 8086 flags are shown in Figure 5.2.
Search WWH ::




Custom Search