written 5.4 years ago by |
General Purpose registers are used for temporary storage of data and memory access. Since the processor accesses register more quickly than memory. 8086 has four 16-bit general-purpose registers AX, BX, CX and DX. These are available to the programmer, for storing values during programs. Each of these can be divided into two 8-bit registers such as AH, AL; BH, BL; CL, CH and DL, DH. Beside their general use, these registers also have some specific functions.
- AX Register (16-Bits): It holds operands and results during multiplication and division operations. All IO data transfers using IN and OUT instructions use A register (AL/AH or AX). It functions as accumulator during string operations.
Example:
MUL BL ; AX = (AL × BL)
MUL BX ; DX-AX = (AX × BX)
MUL BYTE PTR [BX] ; AX = (AL x DS:[BX])
- BX Register (16-Bits): It holds the memory address (offset address), in Indirect Addressing modes.
Example:
MOV CL, [BX] ; Moves a byte from the address pointed by BX in Data Segment into CL. Physical Address calculated as DS * 10H + BX
MOV CH, [BX+6] ; Moves a byte from the address pointed by BX+6 in Data Segment to CH; Physical Address: DS * 10H + BX + 6H
MOV CL, [BX+SI] ; Moves a byte from the address pointed by BX+SI in Data Segment to CL. Physical Address: DS * 10H + BX + SI
- CX Register (16-Bits): It holds count for instructions like: Loop, Rotate, Shift and String Operations.
Example:
MOV CX, 40H
BACK: MOV AL, BL
ADD AL, BL
. . MOV BL, AL
LOOP BACK
MOV CX, 40H BACK: MOV AL, BL ADD AL, BL . . MOV BL, AL LOOPZ BACK
- DX Register (16-Bits): It is used with AX to hold 32 bit values during Multiplication and Division. It is used to hold the address of the IO Port in indirect IO addressing mode.
Example:
MUL BX ; DX-AX = (AX × BX)
MOV DX, 2000H
IN AL, DX