You are on page 1of 5

Register organization (Programming model) of 8086

8086 has 4 General purpose registers, 4 Segment resisters, 3 Pointer registers, 2 Index registers and 1 Flags register. So, the 8086 has a set of 14 registers and are shown below. 16-bits 8-bits AX BX CX DX CS DS SS ES SI DI SP BP IP FLAGS X X X X O D I T S Z X A X P X C AH BH CH DH 8-bits AL BL CL DL Accumulator Base Counter Data Code segment Data segment Stack segment Extra segment Source index Destination index Stack pointer Base pointer Instruction pointer Flags

General purpose registers.
They are AX , BX ,CX and DX registers each of which have some special function. Each register is of 16 bit size and is partitioned into 2 registers of size 8 bit each.

‘H’ represents that it is the higher byte content and ’L’ represents the lower byte content. AX register: AX register is called ‘ACCUMULATOR’ or most generally a ‘16 bit accumulator’. The result after a logical or an arithmetical operation is stored in AX register. While working with 8 bit data; first AL register will be filled i.e. least significant byte is filled first and hence AL is called 8-bit Accumulator. BX register: BX register is also called ‘BASE REGISTER’. BX register holds offset address in case of based addressing mode. CX register:

1|P ag e

Next comes the SEGMENT REGISTERS which are 4 in number Code segment register stores code data stores data stores return addresses stores destination address in case of strings INDEX REGISTERS and POINTER REGISTERS: Index registers constitute Source index and Destination index. *For code segment offset is provided by Instruction pointer. DX register: DX register is also called ‘DATA REGISTER/DESTINATION REGISTER’. While working with a 16x16 multiplication. CX registers is used in iterative operations. Destination index or BX register (for data) Source index (for string) Stack segment Stack pointer or Base pointer 2|P ag e .CX register is also called ‘COUNTER REGISTER’.Base pointer and Instruction pointer. Similarly. Pointer registers constitute Stack pointer . the lower bit data will be stored in AX register and higher bit data will be stored in DX register. Segment Code segment Data segment Offset provider Instruction pointer Source index.

In stack segment. It is a 16 bit register. stack pointer points the most recently stored data.Extra segment Destination index Index and Pointer registers : Source index Index registers Destination index Stack pointer Pointer registers Base pointer Instruction pointer For Data segment . X B15 X B14 X B13 X B12 OF B11 DF B10 IF B9 TF B8 SF B7 ZF B6 X B5 AF B4 X B3 PF B2 X B1 CF B0 8085 COMPATIBLE CF--Carry flag 3|P ag e . Though it is a 16 bit register only 9 flags are defined in 8086 micro processor. if source index and destination index are used as offset providers the addressing mode is known as Index addressing mode. FLAG REGISTER: F lags register holds all the flags.’ When a group of characters are to be shifted to some other location we require Destination Index. It is also called ‘System stack pointer. Similarly if base register id used it is known as Base addressing mode.

bit three. Parity flag: Parity flag is set to ‘1’ if the lower byte of the result contains even number of 1’s. the string is processed from the highest address towards the lowest address. during addition or borrow for the lowest nibble i. If this flag is ‘0’. Zero flag: This flag is set if the result of the computation or comparison performed by the previous instruction or instruction is zero. the maskable interrupts are recognized by the CPU. the string is processed beginning from the lowest address to the higher address. Direction flag: This flag I used by string manipulation instruction. Trap flag: If this flag is set. For signed computations. Auxiliary carry flag: This is set if there is a carry in the lowest nibble i. Otherwise. the processor enters the single step execution mode. during subtraction. the sign flag equals the MSB of the result. bit three. Overflow carry: 4|P ag e .when the result of any computation is negative. Interrupt flag: If this flag is set. Sign flag: This flag is set .e.e.PF--Parity flag AF--Auxiliary carry flag ZF--Zero flag SF--Sign flag TF--Trap flag IF--Interrupt flag DF--Direction flag OF--Overflow carry Carry Flag: This flag is set when there is a carry out of MSB in case of addition or borrow in case of subtraction.

Example: In case of the addition of two signed numbers.This flag is set when an overflow occurs.e. if the result overflows into the signed bit. the result is of more than 7 bits in size in case of 8. 5|P ag e . that is. if the result of a signed operation is large enough to be accommodated in destination register. i. then the overflow flag will be set.bit signed operations and more than 15-bits in case of 16-bit signed operations.