Registers are small amounts of fast memory within the CPU that temporarily store data and instructions during program execution. There are different types of registers that serve specific purposes, including general purpose registers like the accumulator (AX) and base address (BX) registers, pointer registers like the base pointer (BP) and stack pointer (SP), index registers like the source (SI) and destination (DI) registers, segment registers that define memory areas for code, data and stacks, and flag registers that store status information. Registers provide fast access and storage of commonly used values to speed up CPU operations.
2. Computer Registers
A register is a very small amount of very fast memory that is built into
the CPU (central processing unit) in order to speed up its operations by
providing quick access to commonly used values.
Small, permanent storage locations within the CPU used for a
particular purpose
Manipulated directly by the Control Unit
Wired for specific function
Size in bits or bytes (not MB like memory)
Can hold data, an address or an instruction
3. Use of Registers
Scratchpad for currently executing program
Holds data needed quickly or frequently
Stores information about status of CPU and currently executing
program
Address of next program instruction
Signals from external devices
Registers are normally measured by the number of bits they can hold.
Registers are used to store data temporarily during the execution of a
program.
Some of the registers are accessible to the user through instructions.
Data and instructions must be put into the system. So we need registers
for this.
4. Register basic Operations
Fetch: The Fetch Operation is used for taking the instructions those
are given by the user and the Instructions those are stored into the
Main Memory will be fetch by using Registers.
Decode: The Decode Operation is used for interpreting the
Instructions means the Instructions are decoded means the CPU will
find out which Operation is to be performed on the Instructions.
Execute: The Execute Operation is performed by the CPU. And
Results those are produced by the CPU are then Stored into the
Memory and after that they are displayed on the user Screen.
5. Registers are divided in 5 major
categories:
General Purpose Registers
Pointer Registers
Index Registers
Segment Registers
Flag Registers
6. General Purpose Registers:
There are four General Purpose Registers named as follows:
1. AX (Accumulator Register): commonly used for arithmetic & logic data
transfer.
2. BX (Base Address Register): used to save the address of memory
location.
3. CX (Count Register): keeps record of iterations while a LOOP instruction
is running.
4. DX (Data Register): holds data of the instruction currently being
executed.
7. Pointer Registers:
There are three pointer registers that are used to point toward some
memory address.
BP (Base Pointer): points to the base element of the stack.
SP (Stack Pointer): always points to the top element of the stack.
IP (Instruction Pointer): stores the address of the next instruction to be
executed.
8. Index Registers:
Index registers are used for indexed addressing and sometimes also
used in addition and subtraction. There are two sets of index registers:
SI (Source Index): used as source index for string operations.
DI (Destination Index): used as destination index for string operations.
9. Segment Registers:
Segments are specific areas defined in a program for containing data,
code and stack. There are three main segments:
Code Segment: it contains all the instructions to be executed.
Data Segment: it contains data, constants and work areas.
Stack Segment: it contains data and return addresses of procedures
or subroutines. It is implemented as a 'stack' data structure.
10. Flag Registers:
These registers are programmable. It can be used to store and transfer the data
from the registers by using instruction.
The common flag bits are:
Overflow Flag (OF)
Direction Flag (DF)
Interrupt Flag (IF)
Trap Flag (TF)
Sign Flag (SF)
Auxiliary Carry Flag (AF)
Parity Flag (PF)
Carry Flag (CF)