Computer Architecture: Practicals
Practical
No. 9
Title: To Study the General Purpose Registers of the 8086
Microprocessor
Aim
To understand the structure, function, and purpose of the General Purpose
Registers within the 8086 microprocessor architecture.
Introduction
The 8086 microprocessor, a foundational component in computing history,
processes data using internal high-speed storage units called registers.
Registers temporarily hold data, instructions, and memory addresses necessary
for CPU operations.
Among these,
the General Purpose Registers (GPRs) are directly accessible to programmers and
are used for arithmetic, logical, and data transfer operations. Each 16-bit
register can be split into two 8-bit registers, providing flexibility for
manipulating both 16-bit and 8-bit data.
While the
8085 microprocessor (an 8-bit processor) had general-purpose registers B, C, D,
E, H, L, the 8086 (16-bit) introduced AX, BX, CX, and DX to match its
architecture. This practical focuses on concepts from Chapter 4.2.2: 8086
Internal Architecture.
Procedure
/ Example
General
Purpose Registers of 8086:
- AX
(Accumulator Register): Used for arithmetic operations (add, subtract, multiply, divide)
and I/O operations. Can be accessed as AH (high 8 bits) and AL (low 8
bits).
- BX
(Base Register): Used for memory addressing. Can hold the starting address of a
data segment. Can also be used for general-purpose calculations.
- CX
(Count Register): Primarily used as a counter for loops. The LOOP instruction
decrements CX automatically. Can also be used for general calculations.
- DX
(Data Register): Used for I/O port addressing and higher-order bits in
multiplication/division operations.
Each 16-bit
register can be accessed as two separate 8-bit registers:
- AX
→ AH (high), AL (low)
- BX
→ BH, BL
- CX
→ CH, CL
- DX
→ DH, DL
Example:
Using General Purpose Registers in 8086 Assembly
; Move the value 25 into AL
MOV AL, 25
; Move the value 10 into BL
MOV BL, 10
; Add BL to AL, result stored in AL
ADD AL, BL ; AL now holds 35
; Move 16-bit value 5000H into AX
MOV AX, 5000H
; Move 16-bit value 2000H into BX
MOV BX, 2000H
; Add BX to AX, result stored in AX
ADD AX, BX ; AX now holds 7000H
; Use CX as a loop counter
MOV CX, 0005H
LOOP_START:
; … instructions inside loop …
DEC CX
JNZ LOOP_START
Exercises
1.
Register Identification: For each register pair, state its full name and
primary purpose.
|
Register |
Full Name |
Primary Purpose |
|
AX |
||
|
BX |
||
|
CX |
||
|
DX |
||
|
AL |
||
|
BH |
||
|
CL |
||
|
DH |
2.
Scenario Application: Decide the most suitable 8086 register for each task and justify.
- Performing
a 16-bit multiplication where one operand is in memory.
- Storing
the starting address of a block of data in memory.
- Controlling
the number of repetitions in a program loop.
- Holding
the higher 16 bits of a 32-bit division dividend.
Result /
Conclusion
This practical provided a comprehensive overview of the General Purpose
Registers of the 8086 microprocessor. Understanding their 16-bit structure,
8-bit accessibility, and specialized/general-purpose roles in arithmetic,
memory addressing, loop control, and I/O operations is essential for effective
assembly programming and grasping the 8086 architecture.