Registers are high-speed storage locations located inside the microprocessor or CPU. They are classified according to their function and include general purpose, segment, index, pointer, and flag registers. General purpose registers include the accumulator, base, counter, and data registers. Segment registers store address information for code, data, stack, and extra segments. Index registers point to source and destination operands. Pointer registers include the instruction pointer, stack pointer, and base pointer. Flag registers hold status information about operations including carry, parity, auxiliary, zero, sign, overflow, trap, direction, and interrupt flags.
2. Registers
• Registers are the high speed storage
locations.
• Registers are located inside the
microprocessor or CPU.
• Designed to accessed at much
higher speed than conventional
memory.
3. Types of Registers
Register are classified according to function they performed.
There are 14 type of registers.
Accumulator
Data
Counter
Base
Code Segment
Data Segment
Stack Segment
Extra Segment
Source Index
Destination Index
Instruction Pointer
Stack Pointer
Base Pointer
Flag Registers
General Purpose
Segment
Index
Pointer
4. General Purpose Registers
1. Accumulator Register:
it is used in input/output and most arithmetic
instructions. For example, in multiplication operation, one
operand is stored in EAX .
2. Base Register:
Hold the address of data stored in RAM.
3. Counter Register:
It counts and used in loop.
4. Data register:
It is used to hold large data. Such as
string e.t.c.
8
bits
16
bits
32
bits
64
bits
a ax eax rax
b bx ebx rbx
c cx ecx rcx
d dx edx rdx
5. Segment Registers:
5. Code Segment:
This Register stores the address of Code Segment
(.code part of Program)
6. Data Segment
Holds address of data segment.
7. Stack Segment
It stores the address of stack segment.
8. Extra Segment
Holds the address of data segment in case of ds registers full.
6. Index Registers
9. Source Index:
Points the source oprand.
e.g. Add eax,var1
10. Destination Index:
Points the destination oprand.
e.g. Add var1,var2
7. Pointer Registers
11. Instruction Pointer (IP)
Holds the next instruction.
e.g. add eax,var1
add var1,var2
12. Stack Pointer (SP)
Points the current top of stack.
13. Base Pointer (BP)
Point base of top of stack.
8. 14. Flag Registers
• Holds the current status of the program.
Status Flags:
• Carry
• Parity
• Auxiliary
• Zero
• Sign
• Overflow
Control Flags:
• Trap
• Direction
• Interrupt
15 14 13 12 11 10 9 8
OF DF IF TF
7 6 5 4 3 2 1 0
SF ZF AF PF CF
9. Carry Flag (CF)
• CF =1 there is a carry out from most significant bit on
addition or there is a borrow on subtraction.
Parity Flag (PF)
• It indicates the total number of 1-bits in the result obtained
from an arithmetic operation.
• P=1 When there is even number of bits.
• P=0 When there is odd number of bits.
Auxiliary Carry Flag (AF)
• The AF is set when a 1-byte arithmetic operation causes a
carry from bit 3 into bit 4.
10. Zero Flag (ZF)
• It indicates the result of an arithmetic or comparison operation.
• Z=1 When result is zero.
• Z=0 When result is non zero.
Sign Flag (SF)
• S=1 When result is negative.
• S=0 When result is Positive.
Trap Flag (TF)
• it is used when debugging is needed
• 1: when debugging is needed.
• 0: when debugging is not needed.
11. Interrupt Flag (IF)
• 1: When interrupt is called.
• 0: When interrupt is not called.
Direction Flag (DF)
• 1: string operation takes right-to-left direction.
• 0: string operation takes left-to-right direction
Overflow Flag (OF)
• 1: When result is too big to fit in destination.
• 0: When result is not too big to fit in destination.