0% found this document useful (0 votes)
22 views2 pages

R 1

The document explains the function and purpose of various index and special registers in the 8086 microprocessor architecture, including SI, DI, BP, IP, and SP. It details how these registers are used for addressing modes and operand types such as register, immediate, direct, and indirect operands. Additionally, it describes the Flags register and its bit positions that indicate the status of the CPU and arithmetic operations.

Uploaded by

ddk35622
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

R 1

The document explains the function and purpose of various index and special registers in the 8086 microprocessor architecture, including SI, DI, BP, IP, and SP. It details how these registers are used for addressing modes and operand types such as register, immediate, direct, and indirect operands. Additionally, it describes the Flags register and its bit positions that indicate the status of the CPU and arithmetic operations.

Uploaded by

ddk35622
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

The Index Registers Index registers contain the offsets of variables.

The term offset refers to


the distance of a variable, label, or instruction from its base segment. Index registers speed up
the processing of strings, arrays, and other data structures containing multiple elements. SI
(source index) Takes its name from the string movement instructions in which the source string
is pointed to by the SI register. It usually contains an offset value from the DS register, but it can
address any variable. DI (destination index) This acts as the destination for string movement
instructions. It usually contains an offset value form the ES register, but it can address any
variable. BP (base pointer) Contains an asumed offset from the SS register as does the stack
pointer. BP is often used by a subroutine to locate variables that were passed on the stack by a
calling program. Special Registers The IP and SP registers are grouped together here, since they
do not fit into any of the previous categories. IP (instruction pointer) IP always contains the
offset of the next instruction to be executed. CS and IP combine to form the complete address
of the next instruction to be executed. SP (stack pointer) SP contains the offset, or distance
from the beginning of the stack segment to the top of stack. SS and SP combine to form the
complete top-of-stack address. Flags Registers The Flags register is a special 16-bit register
with individual bit positions assigned to show the status of the CPU or the results of arithmetic
operations. Each relevant bit position is given a name; other positions are undefined: Bit
position 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 x x x x O D I T S Z x A x P x C 0=
Overflow S = Sign D = Direction Z = Zero I = Interrupt A = Auxiliary Carry T = Trap
P = Parity x = Undefined C = Carry The 8086 supports a number of addressing modes,
shown by the following addressing mode examples. In the table, a displacement is either a
number or the offset of a variable. The EA of an operand refers to the offset (distance) of the
data from the beginning of a segment. BX and BP are base registers, and SI and DI are index
registers. In many instructions the operand can only be specified by certain addressing modes.
As discussed earlier the use of a register operand, implies the register AM. In 8086, the Register
Operand A register operand may be any 8-bit or 16-bit register. In general, this AM is the most
efficient because registers are part of the CPU and no memory access is required. Some
examples using the MOV instruction are: mov ax,bx mov cl,al mov si,ax Immediate
Operand An immediate operand is a constant expression, such as a number, a character, or an
arithmetic expression. The assembler must be able to determine the value of an immediate
operand at assembly time. Its value is inserted directly into the machine instruction. Direct
Operand A direct operand refers to the contents of memory at the offset of a variable. The
assembler keeps track of every label, making it possible to calculate the effective address of
any direct operand. In the following example, the contents of memory location count are moved
into AL: count db 20 . . mov al,count OFFSET Operator When it is necessary to
move the offset of a label into a register or variable, the OFFSET operator does the trick. Since
the assembler knows the offset of every label as the program is being assembled, it simply
substitutes the offset value into the instruction. Assuming that the offset of the variable aWord
in the following example is 0200h; the MOV instruction would move 200h directly into BX:
aWord dw 1234 . . mov bx,offset aWord ; the above assembles as: mov BX,0200
Indirect Operand When the offset of a variable is placed in a base or index register, the register
becomes a pointer to the label. For variable containing a single element this is of little benefit
but for a list of elements a pointer may be incremented – within a loop, say – to point to each
element. nExample If we create a string in memory at location 0200h and set BX to the base
offset of the string, we can access any element in the string by adding its index to BX. The letter
‘F’ is at index 5 in the following example: ;indices are: 0123456 aString db
“ABCDEFG”

You might also like