Register Addressing
1. Introduction
In microprocessor architecture, register addressing is a fundamental addressing mode that
allows instructions to operate directly on the CPU’s internal registers. Unlike memory
addressing, which requires accessing RAM, register addressing is faster because data is
already within the processor.
Registers are small, high-speed storage locations inside the CPU used to temporarily hold
data, addresses, or status information. The Intel 8086 microprocessor, for example, has
several types of registers: general-purpose, segment, pointer, and index registers.
Understanding how to use registers in addressing is essential for efficient programming in
assembly language, as it reduces memory access time and improves program execution
speed.
2. Concept of Register Addressing
Register addressing mode involves specifying the register name in the instruction rather
than a memory location. The processor reads data from or writes data to the register
directly. Since registers are part of the CPU, this addressing mode is fast, efficient, and
requires fewer instruction bytes than memory-based addressing.
Key Features:
Operands are located in CPU registers.
No memory access is required, reducing execution time.
Instructions using register addressing are typically shorter and faster.
Commonly used in arithmetic, logic, and data transfer operations.
Example:
MOV AX, BX ; Copy contents of BX into AX
ADD AX, CX ; Add contents of CX to AX
Here, AX, BX, and CX are general-purpose registers, and the operations occur entirely
inside the CPU.
3. Types of Registers Used in Register Addressing
1. General-Purpose Registers (GPRs):
o AX, BX, CX, DX in 8086.
o Can store 16-bit data or 8-bit halves (e.g., AH/AL, BH/BL).
o Used for arithmetic, logic, and data manipulation.
2. Pointer Registers:
o SP (Stack Pointer), BP (Base Pointer) for stack operations.
o Can be used to point to memory indirectly, but also serve as general registers
in some instructions.
3. Index Registers:
o SI (Source Index), DI (Destination Index).
o Used for array traversal, string manipulation, and memory transfer.
o Can also serve as operands in register addressing.
4. Segment Registers:
o CS, DS, SS, ES.
o Primarily used for addressing memory segments, but some instructions can
load or move values between segment registers and general-purpose
registers.
4. Advantages of Register Addressing
1. High Speed:
o Operations are faster because the CPU does not need to access RAM.
2. Efficient Instruction Size:
o Instructions using registers typically require fewer bytes, conserving
memory.
3. Simplified Programming:
o Easier to manage temporary data, counters, or intermediate results.
4. Reduced Memory Traffic:
o Less interaction with RAM decreases system bus usage.
5. Ideal for Arithmetic and Logic Operations:
o Most computations occur in registers for speed and efficiency.
5. Register Addressing Instructions
Register addressing can be applied in several types of instructions:
1. Data Transfer Instructions:
MOV AX, BX ; Transfer data between registers
XCHG AX, DX ; Exchange contents of two registers
1. Arithmetic Instructions:
ADD AX, CX ; Add CX to AX
SUB DX, BX ; Subtract BX from DX
INC AX ; Increment AX by 1
DEC BX ; Decrement BX by 1
1. Logical Instructions:
AND AX, BX ; Logical AND of AX and BX
OR DX, CX ; Logical OR of DX and CX
XOR AX, DX ; Exclusive OR of AX and DX
NOT BX ; One’s complement of BX
1. Shift and Rotate Instructions:
SHL AX, 1 ; Shift AX left by 1 bit
SHR BX, 2 ; Shift BX right by 2 bits
ROL CX, 1 ; Rotate AX left through carry
ROR DX, 1 ; Rotate DX right through carry
These examples demonstrate how register addressing simplifies operations by using the
CPU’s internal storage for fast computation.
6. Comparison with Memory Addressing
Feature Register Addressing Memory Addressing
Operand Location CPU registers RAM or memory locations
Execution Speed Faster Slower due to memory access
Instruction Size Smaller Larger
Usage Arithmetic, logic, data transfer Data stored in memory
Register addressing is preferred for temporary data and calculations, while memory
addressing is used for persistent or large datasets.
7. Example Programs Using Register Addressing
Example 1: Add Two Numbers
MOV AX, 2000h ; Load first number into AX
MOV BX, 1000h ; Load second number into BX
ADD AX, BX ; Add BX to AX
Example 2: Swap Register Contents
MOV AX, 1234h
MOV BX, 5678h
XCHG AX, BX ; Swap values between AX and BX
Example 3: Logical Operation
MOV AX, 0F0Fh
MOV BX, 00FFh
AND AX, BX ; AX = 000Fh
These examples illustrate how operations can be performed entirely within registers,
resulting in fast and efficient execution.
8. Limitations of Register Addressing
1. Limited Number of Registers:
o Only a small number of registers are available, so large data sets must be
stored in memory.
2. Temporary Storage Only:
o Data in registers is volatile; it is lost when power is off or the CPU is reset.
3. Cannot Access All Memory Directly:
o To manipulate memory data, registers must often be used in combination
with memory addressing.
Despite these limitations, register addressing remains the fastest and most efficient mode
for computation and data manipulation.
9. Summary
Register addressing is a key feature of the 8086 microprocessor and other similar CPUs.
By operating directly on internal registers, it provides speed, efficiency, and reduced
instruction size. General-purpose, pointer, and index registers can be used as operands,
making this addressing mode essential for arithmetic, logical, and data transfer operations.
Understanding register addressing is fundamental for assembly programming,
performance optimization, and system-level design. It complements other addressing
modes, such as memory or immediate addressing, to achieve complete and efficient
program functionality.
Key Points:
Operates on CPU registers for speed.
Reduces memory traffic and instruction size.
Supports arithmetic, logic, and data transfer efficiently.
Limited by the number of registers available.
Essential for low-level programming and CPU optimization.