
Programming
1-3
Bit 10: Direction Flag (DF)
—Causes string instructions to auto decrement the appropriate
index registers when set. Clearing DF causes auto-increment. See the CLD and STD
instructions, respectively, for how to clear and set the Direction Flag.
Bit 9: Interrupt-Enable Flag (IF)
—When set, enables maskable interrupts to cause the
CPU to transfer control to a location specified by an interrupt vector. See the CLI and STI
instructions, respectively, for how to clear and set the Interrupt-Enable Flag.
Bit 8: Trace Flag (TF)
—When set, a trace interrupt occurs after instructions execute. TF
is cleared by the trace interrupt after the processor status flags are pushed onto the stack.
The trace service routine can continue tracing by popping the flags back with an IRET
instruction.
Bit 7: Sign Flag (SF)
—Set equal to high-order bit of result (set to 0 if 0 or positive, 1 if
negative).
Bit 6: Zero Flag (ZF)
—Set if result is 0; cleared otherwise.
Bit 5: Reserved
Bit 4: Auxiliary Carry (AF)
—Set on carry from or borrow to the low-order 4 bits of the AL
general-purpose register; cleared otherwise.
Bit 3: Reserved
Bit 2: Parity Flag (PF)
—Set if low-order 8 bits of result contain an even number of 1 bits;
cleared otherwise.
Bit 1: Reserved
Bit 0: Carry Flag (CF)
—Set on high-order bit carry or borrow; cleared otherwise. See the
CLC, CMC, and STC instructions, respectively, for how to clear, toggle, and set the Carry
Flag. You can use CF to indicate the outcome of a procedure, such as when searching a
string for a character. For instance, if the character is found, you can use STC to set CF to
1; if the character is not found, you can use CLC to clear CF to 0. Then, subsequent
instructions that do not affect CF can use its value to determine the appropriate course of
action.
1.2
INS T RUCT ION S ET
Each member of the Am186 and Am188 family of microcontrollers shares the standard 186
instruction set. An instruction can reference from zero to several operands. An operand
can reside in a register, in the instruction itself, or in memory. Specific operand addressing
modes are discussed on page 1-7.
Chapter 2
provides an overview of the instruction set, describing the format of the
instructions.
Chapter 3
lists all the instructions for the Am186 and Am188 microcontrollers
in both functional and alphabetical order.
Chapter 4
details each instruction.
1.3
MEMORY ORGANIZAT ION AND ADDRES S GENERAT ION
The Am186 and Am188 microcontrollers organize memory in sets of segments. Memory
is addressed using a two-component address that consists of a 16-bit segment value and
a 16-bit offset. Each segment is a linear contiguous sequence of 64K (2
16
) 8-bit bytes of
memory in the processor’s address space. The offset is the number of bytes from the
beginning of the segment (the segment address) to the data or instruction which is being
accessed.
The processor forms the physical address of the target location by taking the segment
address, shifting it to the left 4 bits (multiplying by 16), and adding this to the 16-bit offset.