
Programming
1-1
CHAPTER
1
PROGRAMMING
All members of the Am186 and Am188 family of microcontrollers contain the same basic
set of registers, instructions, and addressing modes, and are compatible with the original
industry-standard 186/188 parts.
1.1
RE GIS T ER S E T
The base architecture for Am186 and Am188 microcontrollers has 14 registers (see Figure
1-1), which are controlled by the instructions detailed in this manual. These registers are
grouped into the following categories.
n
General Registers
—Eight 16-bit general purpose registers can be used for arithmetic
and logical operands. Four of these (AX, BX, CX, and DX) can be used as 16-bit registers
or split into pairs of separate 8-bit registers (AH, AL, BH, BL, CH, CL, DH, and DL). The
Destination Index (DI) and Source Index (SI) general-purpose registers are used for
data movement and string instructions. The Base Pointer (BP) and Stack Pointer (SP)
general-purpose registers are used for the stack segment and point to the bottom and
top of the stack, respectively.
–
Base and Index Registers
—Four of the general-purpose registers (BP, BX, DI, and
SI) can also be used to determine offset addresses of operands in memory. These
registers can contain base addresses or indexes to particular locations within a
segment. The addressing mode selects the specific registers for operand and address
calculations.
–
Stack Pointer Register
—All stack operations (POP, POPA, POPF, PUSH, PUSHA,
PUSHF) utilize the stack pointer. The Stack Pointer (SP) register is always offset
from the Stack Segment (SS) register, and no segment override is allowed.
n
Segment Registers
—Four 16-bit special-purpose registers (CS, DS, ES, and SS)
select, at any given time, the segments of memory that are immediately addressable
for code (CS), data (DS and ES), and stack (SS) memory.
n
Status and Control Registers
—Two 16-bit special-purpose registers record or alter certain
aspects of the processor state—the Instruction Pointer (IP) register contains the offset
address of the next sequential instruction to be executed and the Processor Status Flags
(FLAGS) register contains status and control flag bits (see Figure 1-2).
Note that all members of the Am186 and Am188 family of microcontrollers have additional
peripheral registers, which are external to the processor. These peripheral registers are
not directly accessible by the instruction set. However, because the processor treats these
peripheral registers like memory, instructions that have operands that access memory can
also access peripheral registers. The above processor registers, as well as the additional
peripheral registers, are described in the user’s manual for each specific part.