AMD Am186TMER Microscope & Magnifier User Manual


 
Programming
2-10
2.7 ADDRESSING MODES
The Am186ER and Am188ER microcontrollers use eight categories of addressing modes
to specify operands. Two addressing modes are provided for instructions that operate on
register or immediate operands; six modes are provided to specify the location of an
operand in a memory segment.
Register and Immediate Operands
n Register Operand Mode—The operand is located in one of the 8- or 16-bit registers.
n Immediate Operand Mode—The operand is included in the instruction.
Memory Operands
A memory-operand address consists of two 16-bit components: a segment value and an
offset. The segment value is supplied by a 16-bit segment register either implicitly chosen
by the addressing mode or explicitly chosen by a segment override prefix. The offset, also
called the effective address, is calculated by summing any combination of the following
three address elements:
1. Displacement—an 8-bit or 16-bit immediate value contained in the instruction
2. Base—contents of either the BX or BP base registers
3. Index—contents of either the SI or DI index registers
Any carry from the 16-bit addition is ignored. Eight-bit displacements are sign-extended to
16-bit values.
Combinations of the above three address elements define the following six memory
addressing modes (see Table 2-3):
1. Direct Mode—The operand offset is contained in the instruction as an 8- or 16-bit
displacement element.
2. Register Indirect Mode—The operand offset is in one of the registers: SI, DI, BX, or BP.
3. Based Mode—The operand offset is the sum of an 8- or 16-bit displacement and the contents
of a base register (BX or BP).
4. Indexed Mode—The operand offset is the sum of an 8- or 16-bit displacement and the
contents of an index register (SI or DI).
5. Based Indexed Mode—The operand offset is the sum of the contents of a base register
(BX or BP) and an index register (SI or DI).
6. Based Indexed Mode with Displacement—The operand offset is the sum of a base
register’s contents, an index register’s contents, and an 8-bit or 16-bit displacement.
Table 2-3 Memory Addressing Mode Examples
Addressing Mode Example
Direct mov ax, ds:4
Register Indirect mov ax, [si]
Based mov ax, [bx]4
Indexed mov ax, [si]4
Based Indexed mov ax, [si][bx]
Based Indexed with Displacement mov ax, [si][bx]4