Hardware Reference
In-Depth Information
an offset taken from one (or more) of the other registers or from a memory
reference within the program. The four Segment Registers (CS, DS, SS, and
ES) effectively allow the programmer to set up individual 64KB workspace
segments within the total 1MB address range.
We shall now briefly consider each of the 8086 registers in turn:
Accumulator, AX (AH and AL)
The accumulator is the primary source and destination for data used in a large
number of 8086 instructions. The following data movement instructions give
some idea of the range of options available:
MOV AL,data Moves 8-bit immediate data into the least-significant
byte of the accumulator, AL.
MOV AH,data Moves 8-bit immediate data into the most-significant
byte of the accumulator, AH.
MOV AX,register Copies the contents of the specified 16-bit register to
the 16-bit extended accumulator (AX).
MOV AH,register Copies the byte present in the specified 8-bit register to
the 8-bit register, AH.
MOV AX,[address] Copies the 16-bit word at the specified address into the
general-purpose base register, AX.
BX (BH and BL) register
The BX register is normally as a base register (address pointer). The following
data movement instructions give some idea of the range of options that are
available:
MOV BX,data
Moves
16-bit
immediate
data
into
the
general-
purpose base register (BX).
MOV BX, [address] Copies the 16-bit word at the specified address into
the general-purpose base register (BX).
Copies the contents of the specified register to the
base register (BX).
MOV BX,register
Copies the contents of the AL register to the memory
address specified by the BX register.
MOV [BX],AL
CX (CH and CL) register
The CX register is often employed as a loop counter. The 8086 LOOP instruction
tests the contents of the CX register pair in order to determine whether the 1oop
should be repeated, or not. This makes coding loops extremely simple as the
following code fragment shows:
start: MOV CX,OCOOH ; Number of times round the loop
delay: LOOP delay
; Count down finished?
RET
The CX and CL registers are also used to implement repeated string moves,
shifts,
and rotates.
The following example shows how the contents of the
Search WWH ::




Custom Search