Register Organiztion Of 8086

The 8086 microprocessor has a powerful set of registers, all the registers are 16-bit registers and
classified as

  • General purpose registers
  • Special purpose registers 
General Purpose Registers

The general purpose register, can be used as either 8-bit registers or 16-bit registers. There are four 16-bit general purpose registers : AX,BX,CX,DX. Each of these 16-bit registers are further divided into two 8-bit registers. The registers AH,BH,CH and DH are known as 8-bit high order registers. The registers AL,BL,CL and DL are known as 8-bit lower order registers.
The general purpose registers are either used for holding data,variables and intermediate results temporarily or also used as special purpose registers like counter, storing offset address for some particular addressing modes.

AX :  The register AX is used as 16 bit accumulator, with the lower 8 bits of AX designated as AL and higher 8 bits as AH. AL can be used as 8 bit accumulator for 8 bit operations.
BX :  The register BX is also used as offset storage for forming physical address in case of certain addressing modes.
CX : The register CX is also used as  default constructor in case of string and loop instructions.
DX : The DX register is a general purpose register which may be used as an implicit operand or destination in case of few instructions.It can holds the overflow from  certain arithmetic instructions.


Special Purpose Registers

  • Segment Registers
  • Pointer and Index Registers
  • Flag Registers

Segment Registers

The 8086 microprocessor addresses a segment memory unlike the 8085.The 8086 is able to address 1 megabyte (1 MB)memory, which is divided into 16 logical segments. Each segment thus contain 64 kbytes memory. Only four of these 64 kbytes segments are active at a time,these are

  • Code Segment
  • Data Segment
  • Stack Segment
  • Extra Segment
Segment of memory that are active ,are identified by the value of the addresses held in the 8086's four internal segment registers, these are
  • Code Segment Register (CS)
  • Data Segment Register (DS)
  • Stack Segment Register (SS)
  • Extra Segment Register (ES)
The code segment of the memory holds instruction codes of a program. The data,variable and constants given in the program are held in data segment of the memory.The stack segment holds addresses and data subroutines ;it also holds the contents of registers or memory locations gives in PUSH instruction. The extra segment holds the destination addressesof some data string instructions, etc.
A segment register points to the starting address of a memory segment currently being used.The 8086 instructions specify 16-bit memmory address. The actual address known as physical address are of 20 bits is calculated from two parts : the first is segment address and the second is offset. The segment registers contain 16-bit segment base addresses, related to different segments.

Pointer and Index Registers

The following five registers are in the group of pointers and index registers :

  • Stack Pointer (SP)
  • Base Pointer (BP)
  • Source Index (SI)
  • Destination Index (DI)
  • Instruction Pointer (IP)

SP : It contains offset within the stack segment (SS).

BP :It is used in memory addressing computation and contains offset within the data segment(DS).

IP :It act as a program counter. It points to the address of the next instruction to be executed. It contain offset within the code segment(CS). the contents of IP and the contents of CS register are used to compute the memory address of the instruction code to be fetched. This is done during instruction fetch routine.

SI :It is used to store the offset of  source data in data segment.

DI :It is used to store the offset the destination in data or extra segment.

Flag Register

The 8086 has 16-bit flag register.It is also called Program status word(PSW) which is divided into two parts:


  • Condition code or Status flags
  • Machine code flags
                       

The condition code flag register is identical to 8085 flag register ,with an additional overflow flag, which is not present in 8085.The six condition code flags are :carry, auxiliary carry, zero, sign,parity and overflow flags. These flags are set/reset by the microprocessor after the execution of an arithmetic and logical instructions.
On the other hand control flag register contains three flags :Directional flag(D),interrupt flag(I), and trap or trace flag(T).

S(Sign Flag) :It is set to 1, if an arithmetic operation causes the MSB to equal 1 (negative), otherwise it is cleared.
Z(Zero Flag):flag=1,if the result of an arithmetic or logical operation is zero, otherwise it is cleared.
AC(Auxiliary carry flag) : flag=1 when there is carry out of the 3-bit position in an arithmetic operation; otherwise it is cleared.
P(Parity Flag) :flag=1, if result contains even numbers of 1.
CY (Carry Falg) :flag=1, carry out of MSB in case of addition or a borrow in a case of subtraction.
T(Trap Flag) :if flag=1, the microprocessor enters into the single step execution.
I(Interrupt Flag) : if flag=1, the maskable interrupts are recognized by the MPU, otherwise , they are ignored.
D(Direction Flag) :if flag=1, the contents of the index register (SI and DI) will be decremented after each operation, once for byte operation and twice for word operation and vice versa.
O(Overflow Flag) :flag=1, if the result is out of range.



No comments: