Presentation on theme: "Types of Registers (8086 Microprocessor Based)"— Presentation transcript:
1 Types of Registers (8086 Microprocessor Based) Slides Developed By: Mr. Faiq MasoodLecturer, BCA DepartmentIP College 2nd Campus , Bulandshahr
2 Types of Registers (Micro Processor 8086 Based) “The addressable storage elements known as registers”. Generally the registers are 16 bit wide. Registers are grouped on the basis of the meaning assigned to them. Fourteen 16 bit H/W registers are divided into five groups: All are 16 bitGeneral Purpose Registers (AX, BX, CX and DX)Pointer and Index Registers (SP, BP, SI and DI)Segment Registers (CS, DS, ES and SS)Instruction Pointer Register (IP)Flag Register (FR)
4 General Purpose Registers (GPRs ) AX (Accumulator) RegisterSome of the operations, such as MUL and DIV, require that oneof the operands be in the accumulator. It’s divided into twoparts AH and AL. It’s most efficient in data movement, Arith. andLogical operations.2. BX (Base) RegisterIt is the only general-purpose register which may be used for indirect addressing. For example, the instruction MOV [BX], AX causes the contents of AX to be stored in the memory location whose address is given in BX.It’s suitable for accessing the elements of an array from the memory. Its divided in 2 parts BH and BL.3.CX (Count)RegisterCX is the "count'' register. The looping instructions (LOOP, LOOPE, and LOOPNE), the shift and rotate instructions
5 and the string instructions all use the count register to determine how many times they will repeat. And divided into two parts CH & CL.4. DX (Data) RegisterDX is the "data'' register; it is used together with AX for the word-size MUL and DIV operations, and it can also hold the port number for the IN and OUT instructions, but it is mostly available as a convenient place to store data, as are all of the other general-purpose registers. It’s also divided in two parts DH and DL.
6 Pointer and Index Registers The pointer registers are generally used for storing the offset address of data elements stored in the stack.The index registers are used for storing index or offset of the array elements.Stack Pointer (SP) :It indicating the current position of the top of the stack. The process of storing data onto the stack is known as PUSH operation and process for retrieving the data from the stack is known as POP operation.Base Pointer (BP): BP is the base pointer, which can be used for indirect addressing similar to BX.Source Index(SI): SI is the source index, used as a pointer to the current character being read in a string instruction. Its suitable for accessing array means element of an array from the memory.Destination index(DI): It used as a pointer to the current character being written or compared in a string instruction.
7 Instruction Pointer(IP): The IP register always holds the memory address of the next instruction to be executed. Segment Registers Since all of these registers are 16 bits wide, they can only contain addresses for memory within a range of 64K (=2^16) bytes. To support machines with more than 64K of physical memory, Intel implemented the concept of segmented memory. At any given time, a 16-bit address will be interpreted as an offset within a 64K segment determined by one of the four segment registers (CS, DS, ES, and SS).
8 Code Segment (CS): this is where the executable code of a program is located. The CS register points to the start of the memory block which contains the next instruction to be executed.Data Segment (DS): It is the default segment for most memory accesses. It points to the start of the data segment where most of the operands are store.Extra Segment(ES): It can be used instead of DS when data from two segments need to be accessed at once. The ES is generally make to use additional block of memory for data storage.Stack segment (SS): the stack pointer SP gives the offset of the current top-of-stack within the stack segment. It points to the start of the memory block (64 KB) known as the stack memory.
9 Flag Register: FLAGS, is a collection of 1-bit values which reflect the current state of the processor and the results of recent operations. Nine of the sixteen bits are used in the 8086:Carry Flag (CF): is set (CF=1) if an addition produces a carry or if a sub. Needs a borrow.Parity Flag (PF): is set(PF=1) if the low-order byte of the last data operation contained an even number of 1 bits; otherwise it is cleared.Auxiliary Flag (AF): is set(AF=1) if there is a carry out of the third bit during an addition process or a borrow by the 3rd bit during a sub.Zero Flag (ZF): is set(ZF=1) if an addition or a subtraction produces a 0 result.Sign Flag (SF): it is equal to the MSB of the result. It’s set(SF=1) if MSB is one; otherwise SF is reset.
10 Trap Flag (TF): if TF is set(TF=1), a trap is executed after each instruction. This feature is useful in implementing the program debugging utilities.Interrupt Flag (IF): If the IF is set a maskable interrupt type can be recognized by the CPU; otherwise these interrupts are ignored.Direction Flag (DF): It’s used for the manipulation of the data array in string instructions. If DF is set , the string is processed from the higher address towards the lower address.Overflow Flag (OF): It’s set (OF=1) if an addition produces a carry out of the MSB. In Sub. Operation, its set when the MSB needs a borrow and there is no borrow available from the MSB.
11 Example of Flag Register Status of the flags CF=0, PF=0, AF=0, ZF=0, SF=0 Another Example Status of the Flags CF=1, PF=1, AF=0, ZF=0, SF=1