E N D
Register In computer architecture, a processor register is a small amount of storage available on the CPU whose contents can be accessed more quickly than storage available elsewhere. Processor registers are at the top of the memory hierarchy, and provide the fastest way for a CPU to access data. Register is the inbuilt memory associated with the computer; it is used to store the data mostly.
GENERAL PURPOSE REGISTERS • 8086/88 CPU has 8 general purpose registers, each register has its own name: • AX- the accumulator register (divided into AH / AL): • Generates shortest machine code • Arithmetic, logic and data transfer • One number must be in AL or AX • Multiplication & Division • Input & Output BX - the base address register (divided into BH / BL). • CX - the count register (divided into CH / CL): • Iterative code segments using the LOOP instruction • Repetitive operations on strings with the REP command • Count (in CL) of bits to shift and rotate • DX - the data register (divided into DH / DL): • DX:AX concatenated into 32-bit register for some MUL and DIV operations • Specifying ports in some IN and OUT operations
SI -source index register: • Can be used for pointer addressing of data • Used as source in some string processing instructions • Offset address relative to DS • DI - destination index register: • Can be used for pointer addressing of data • Used as destination in some string processing instructions • Offset address relative to ES • BP - base pointer: • Primarily used to access parameters passed via the stack • Offset address relative to SS • SP - stack pointer: • Always points to top item on the stack • Offset address relative to SS • Always points to word (byte at even address) • An empty stack will had SP = FFFEh
SEGMENT REGISTERS CS - points at the segment containing the current program. DS - generally points at segment where variables are defined. ES - extra segment register, it's up to a coder to define its usage. SS - points at the segment containing the stack. Although it is possible to store any data in the segment registers, this is never a good idea. The segment registers have a very special purpose - pointing at accessible blocks of memory. There are four segment registers in the 8086/8088 processor, CS, DS, ES, and SS, also known as Code Segment, Data Segment, Extra Segment, and Stack Segment This is known as a segmented architecture. By default, the CS register is used when fetching instructions, the DS register is used when accessing data, the SS register is used when accessing the stack, and the ES register is used during certain string type instructions. If desired, an instruction prefix can be used to override, such as forcing use of CS instead of DS when using a table contained within opcode space. Segment registers hold the base address of where a particular segment begins in memory. There is the code segment (CS), data segment (DS), stack segment (SS), and extra segment(ES).
SPECIAL PURPOSE REGISTERS • IP - the instruction pointer: • Always points to next instruction to be executed • Offset address relative to CS • IP register always works together with CS segment register and it points to currently executing instruction. FLAGS REGISTER Flags Register - determines the current state of the processor. They are modified automatically by CPU after mathematical operations, this allows to determine the type of the result, and to determine conditions to transfer control to other parts of the program. Generally you cannot access these registers directly.
General Purpose Register AX BX CX DX
Index / Pointer Register SI DI BP SP
Segment Register CS DS SS ES
Special Purpose Register IP FLAG