MICROPROCESSORS

The microprocessor contains all, or most of, the central processing unit (CPU) functions and is the "engine" that goes into motion when you turn your computer on. A microprocessor is designed to perform arithmetic and logic operations that make use of small number-holding areas called registers.

Thursday 19 May 2016

Register Organization of 8086 Microprocessor

The 8086 has a powerful set of registers. It includes general purpose registers, segment registers, pointers and index registers and flag register.  All the registers of 8086 are 16-bit registers.
General Data Registers
The registers AX, BX, CX and DX are the general purpose 16-bit registers.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 an 8-bit accumulator for 8-bit operations. This is the most important general purpose register having multiple functions.The register BX is used as offset storage for forming physical addresses in case of certain addressing modes.The register CX is also used as a default counter in case of string and loop instructions.DX register is a general purpose register which may be used as an implicit operand or destination in case of a few instructions.
Segment Registers
 Unlike 8085, the 8086 addresses a segmented memory. The complete 1 megabyte memory is divided into 16 logical segments. Each segment thus contains 64 Kbytes of memory.There are four segment registers such as Code Segment Register (CS), Data Segment Register (DS), Extra Segment Register (ES) and Stack Segment Register (SS).Generally segment register is used to store the upper 16-bits of the starting address of a particular segment. The contents of the segment register are called segment base address.The code segment register is used for addressing a memory location in the code segment of the memory, where the executable program is stored.Similarly, the data segment register points to the data segment of the memory, where the data is stored.The extra segment also refers to a segment which essentially is another data segment of the memory. Thus the extra segment also contains data.
 The stack segment register is used for addressing stack segment of memory. The stack segment is that segment of memory which is used to store stack data. The CPU uses the stack for temporarily storing important data, e.g. the contents of the CPU registers which will be required at a later stage
 While addressing any location in the memory bank, the physical address 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. Any of the pointers and index registers or BX may contain the offset of the location to be addressed.Thus the CS, DS, SS and ES segment registers respectively contain the segment addresses for the code, data, stack and extra segments of memory.
 Pointers and Index Registers
The pointers contain offset within the particular segments. The pointers IP, BP and SP usually contain offsets within the code, data and stack segments respectively.The index registers are used as general purpose registers as well as for offset storage in case of indexed, based indexed and relative based indexed addressing modes.The register SI is generally used to store the offset of source data in data segment while the register DI is used to store the offset of destination in data or extra segment. The index registers are particularly useful for string manipulations.
 Flag Register
 8086 has a 16-bit flag register which is divided into two parts such as (a) conditional code or status flags and (b) machine control flags. The flag register of 8086 the condition code flag register is the lower byte of the 16-bit flag register along with the overflow flag. These flag registers of 8086 reflects the results of the operations performed by ALU.The control flag register is the higher byte of the flag register of 8086. It contains three flags such as direction flag (D), interrupt flag (I) and trap flag (T).
The description of each flag bit is as follows:
S-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.
Z-Zero Flag: This flag is set, if the result of the computation or comparison performed by the previous instruction/instructions is zero.
P-Parity Flag: This flag is set to 1, if the lower byte of the result contains even number of 1s.
C-Carry Flag: This flag is set, when there is a carry out of MSB in case of addition or borrow in case of subtraction.
T-Trap Flag: If this flag is set, the processor enters the single step execution mode. In other words, a trap interrupt is generated after execution of each instruction. The processor executes the current instruction and the control is transferred to the Trap interrupt service routine.
I-interrupt Flag: If this flag is set, the maskable interrupts are recognized by the CPU, otherwise, they are ignored.
D-Direction Flag: This is used by string manipulation instructions. If this flag bit is. '0', the string is processed beginning from the lowest address to the highest address, i.e. auto incrementing mode. Otherwise, the string is processed from the highest address towards the lowest address, i.e. auto decrementing mode.
AC-Auxiliary Carry Flag: This is set, if there is a carry from the lowest nibble, i.e. bit three, during addition or borrow for the lowest nibble, i.e. bit three, during subtraction.
O-Overflow Flag: This flag is set, if an overflow occurs, i.e. if the result of a signed operation is large enough to be accommodated in a destination register. For example, in case of the addition of two signed numbers, if the result overflows into the sign bit, i.e. the result is of more than 7-bits in size in case of 8-bit signed operations and more than15-bits in size in case of 16-bit signed operations, and then the overflow flag will be set.

_____We are all here on earth to help others; 
                       what on earth the others are here for I don't know.______ 
@W. H. Auden

No comments:

Post a Comment