Sie sind auf Seite 1von 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

CX register is also called COUNTER REGISTER. CX registers is used in iterative operations. DX register: DX register is also called DATA REGISTER/DESTINATION REGISTER. While working with a 16x16 multiplication; the lower bit data will be stored in AX register and higher bit data will be stored in DX register. 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. Pointer registers constitute Stack pointer ,Base pointer and Instruction pointer. *For code segment offset is provided by Instruction pointer. Similarly,

Segment Code segment Data segment

Offset provider Instruction pointer Source index, Destination index or BX register (for data) Source index (for string)

Stack segment

Stack pointer or Base pointer

2|P ag e

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 ; if source index and destination index are used as offset providers the addressing mode is known as Index addressing mode. Similarly if base register id used it is known as Base addressing mode. In stack segment; stack pointer points the most recently stored data. It is also called System stack pointer. When a group of characters are to be shifted to some other location we require Destination Index. FLAG REGISTER: F lags register holds all the flags. It is a 16 bit register. Though it is a 16 bit register only 9 flags are defined in 8086 micro processor.

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

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. Parity flag: Parity flag is set to 1 if the lower byte of the result contains even number of 1s. Auxiliary carry flag: This is set if there is a carry in the lowest nibble i.e. bit three, during addition or borrow for the lowest nibble i.e. bit three, during subtraction. Zero flag: This flag is set if the result of the computation or comparison performed by the previous instruction or instruction is zero. Sign flag: This flag is set ;when the result of any computation is negative. For signed computations, the sign flag equals the MSB of the result.

Trap flag: If this flag is set, the processor enters the single step execution mode. Interrupt flag: If this flag is set, the maskable interrupts are recognized by the CPU. Direction flag: This flag I used by string manipulation instruction. If this flag is 0, the string is processed beginning from the lowest address to the higher address. Otherwise, the string is processed from the highest address towards the lowest address. Overflow carry:

4|P ag e

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

5|P ag e

Das könnte Ihnen auch gefallen