06 8086 Registers
āĻāĻŦāĻžāϰ EU-āĻāϰ Registers â āĻŦāĻā§ā§āϰ āĻĒā§āώā§āĻ āĻž ā§§ā§ĢāĨ¤ Flags āĻĒāϰā§āϰ āϧāĻžāĻĒā§ āĻĒā§āĻŦāĨ¤
Register āĻā§?
Register āĻšāϞ⧠CPU-āĻāϰ āĻā§āϤāϰā§āϰ āĻā§āĻ āĻ āĻĻā§āϰā§āϤ storage, āϝā§āĻāĻžāύ⧠āĻāĻžāĻā§āϰ āϏāĻŽā§ data āĻŦāĻž address āϏāĻžāĻŽā§āĻŋāĻāĻāĻžāĻŦā§ āϰāĻžāĻāĻž āĻšā§āĨ¤ āϝā§āĻŽāύ, āĻĻā§āĻāĻŋ āϏāĻāĻā§āϝāĻž āϝā§āĻ āĻāϰāĻžāϰ āĻāĻā§ āϏā§āĻā§āϞ⧠register-āĻ āϰāĻžāĻāĻž āϝāĻžā§āĨ¤
Exam definition:
âA register is a small, high-speed storage location inside the CPU used to temporarily hold data, addresses, or intermediate results.â
ā§§. General-purpose registers: AX, BX, CX, DX
āĻāĻā§āϞ⧠āĻĒā§āϰāϤāĻŋāĻāĻŋ 16-bitāĨ¤ āĻĒā§āϰāϤāĻŋāĻāĻŋāĻā§ āĻāĻŦāĻžāϰ āĻĻā§āĻāĻāĻŋ 8-bit āĻ āĻāĻļ āĻšāĻŋāϏā§āĻŦā§ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰāĻž āϝāĻžā§:
| 16-bit register | Higher 8 bits | Lower 8 bits |
|---|---|---|
| AX | AH | AL |
| BX | BH | BL |
| CX | CH | CL |
| DX | DH | DL |
H = High, L = LowāĨ¤ āĻāĻā§āϞ⧠āĻāĻāĻ register-āĻāϰ āĻ āĻāĻļ; āĻāϞāĻžāĻĻāĻž āĻ āϤāĻŋāϰāĻŋāĻā§āϤ storage āύā§āĨ¤
āϧāϰā§:
AX = 1234H â AH = 12H, AL = 34H
āĻāĻžāϰāĻŖ āĻāĻāĻāĻŋ hexadecimal digit āĻŦā§āĻāĻžā§ 4 bitsāĨ¤ āϤāĻžāĻ āĻāĻžāϰ digit-āĻāϰ 1234H āĻšāϞ⧠16-bit āĻāĻŦāĻ āĻĻā§āĻ digit-āĻāϰ 12H āĻšāϞ⧠8-bitāĨ¤
āĻāĻŦāĻžāϰ AL āĻŦāĻĻāϞ⧠56H āĻāϰāϞā§:
AX = 1256H â AH āĻāĻā§āϰ āĻŽāϤā§āĻ 12H āĻĨāĻžāĻā§āĨ¤
āĻāĻ register-āĻā§āϞā§āϰ āĻŦāĻŋāĻļā§āώ āĻŦā§āϝāĻŦāĻšāĻžāϰ
āϏāĻŦāĻā§āϞ⧠data āϰāĻžāĻāϞā§āĻ āĻāĻŋāĻā§ instruction-āĻ āĻāĻĻā§āϰ āύāĻŋāϰā§āĻĻāĻŋāώā§āĻ āĻā§āĻŽāĻŋāĻāĻž āĻāĻā§:
| Register | Name | Common special use |
|---|---|---|
| AX | Accumulator | Arithmetic operations and I/O data transfers |
| BX | Base register | Holding a base address for memory access |
| CX | Count register | Loop counting and shift/rotate counts |
| DX | Data register | Multiplication/division and I/O port addressing |
āĻāĻāύ āύāĻžāĻŽ āĻ āĻŽā§āϞ āĻāĻžāĻ āĻŽāύ⧠āϰāĻžāĻā§; instructions āĻĒā§āĻžāϰ āϏāĻŽā§ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻĻā§āĻāĻŦāĨ¤
⧍. Pointer āĻ Index Registers
EU-āϤ⧠āĻāϰāĻ āĻāĻžāϰāĻāĻŋ 16-bit register āĻāĻā§:
| Register | Full name | Main role |
|---|---|---|
| SP | Stack Pointer | Holds the offset of the top of the stack |
| BP | Base Pointer | Helps access data in the stack |
| SI | Source Index | Holds the source offset, especially in string operations |
| DI | Destination Index | Holds the destination offset, especially in string operations |
Stack āĻāĻĒāĻžāϤāϤ āĻāĻŽāύ storage āĻāĻžāĻŦā§ āϝā§āĻāĻžāύ⧠āϏāϰā§āĻŦāĻļā§āώ āϰāĻžāĻāĻž item āĻāĻā§ āĻŦā§āϰ āĻšā§âāϝā§āĻŽāύ āĻĒā§āϞā§āĻā§āϰ āϏā§āϤā§āĻĒāĨ¤ Offset āĻŽāĻžāύ⧠āĻāĻāĻāĻŋ segment-āĻāϰ āĻļā§āϰā§āϰ āϤā§āϞāύāĻžā§ āĻ āĻŦāϏā§āĻĨāĻžāύ; āϏāĻžāĻŽāύ⧠āĻŦāĻŋāϏā§āϤāĻžāϰāĻŋāϤ āĻĒā§āĻŦāĨ¤
āĻā§ā§āĻžāϞ āϰāĻžāĻāĻŦā§: SP, BP, SI, DI-āĻā§ AX-āĻāϰ āĻŽāϤ⧠āĻĻā§āĻāĻāĻŋ āĻāϞāĻžāĻĻāĻž 8-bit āĻ āĻāĻļ āĻšāĻŋāϏā§āĻŦā§ access āĻāϰāĻž āϝāĻžā§ āύāĻžāĨ¤
Exam answer: Registers in the EU
âThe EU contains four 16-bit general-purpose registers: AX, BX, CX, and DX. Each can also be accessed as two 8-bit registers. It also contains two 16-bit pointer registers, SP and BP, and two 16-bit index registers, SI and DI.â
Quick check â āĻļā§āϧ⧠āĻā§āĻ āĻāϤā§āϤāϰ:
- If AX = 7A25H, what are AH and AL?
- If AL changes to 40H, what is the new value of AX?
- Which register is commonly used as a loop counter?
- Can SI be accessed as two separate 8-bit registers in the 8086?