Advanced Micro Devices, Inc. (“AM D”) reserves the right to make changes in
its products without notice in order to improve design or performance characteristics.
The information in this publication is believed to be accurate at the time of publication, but AMD makes no representations or warranties with
respect to the accuracy or completeness of the contents of this publication or the information contained herein, and reserves the right to make
changes at any time, without notice. AMD disclaims responsibility for any consequences resulting from the use of the information included in this
publication.
This publication neither states nor implies any representations or warranties of any kind, including but not limited to, any implied w arranty of
merchantability or fitness for a particular purpose. AMD products are not authorized for use as critical components in life support devices or
systems without AMD’s written approval. AMD assumes no liability whatsoever for claims assoc iated with the sale or use (including the use of
engineering samples) of AMD products except as provided in AMD’s Terms and Conditions of Sale for such products.
Trademarks
AMD, the AMD logo, and combinations thereof are trademarks of Advanced Micro Devices, Inc.
Am386 and Am486 are registered trademarks of Advanced Micro Devices, Inc.
Am186, Am188, E86, AMD Facts-On-Demand, and K86 are trademarks of Advanced Micro Devices, Inc.
FusionE86 is a service mark of Advanced Micro Devices, Inc.
Product names used in this publication are for identification purposes only and may be trademarks of their respective companies.
IF YOU HAVE QUESTIONS, WE’RE HERE TO HELP YOU.
Customer Ser v ic e
The AMD customer service network includes U.S. offices, international offices, and a
customer training center. Expert t echnical assista nce is available from the worl dwide staff
of AMD field application engineers and factory support staff to answer E86™ family
hardware and software development questions.
Hotline and World Wide W eb Support
For answers to technical questions, AMD provides a toll-fr ee n umb er for direct access to
our corporate applications hotli ne. Also available is the AMD World Wide Web home page
and FTP site, which provides the la test E86 family product i nformation, including t echnical
information and data on upcoming product releases.
For technical support question s on all E86 products, send E-mail to lpd.support@amd.com.
Corporate A p plications Hotline
800-222-9323toll-free for U.S. and Canada
44-(0) 1276-803-299U.K. and Europe hotline
World Wide Web Home Page and FTP Site
To access the AMD home page go to http://www.amd.com.
To download documents and software, ftp to ftp.amd.com and log on as anonymous using
your E-mail address as a password. Or via your web browser, go to ftp://ft p .amd.com.
Questions, requests, and input concer ning AMD’s WWW pages c an be se nt via E-mail t o
webmaster@amd.com.
Documentation an d Literature
Free E86 family infor mation such as data books, user’ s manuals , data shee ts, ap plicatio n
notes, the FusionE86SM Partner Solu tions Catalog, and othe r literature is avail able with a
simple phone call. Internationally, contact your local AMD sales office for complete E86
family literature.
Literature Ordering
800-222-9323toll-free for U.S. and Canada
512-602-5651direct dial worldwide
512-602-7639fax
800-222-9323AMD Facts-On-Demand™ faxback service
Figure 3-1Am186ER Micr ocontr ol le r Ad dres s Bus —Normal Read
Figure 3-2Am186ER Microcontroller—Read and Write with Address Bus Disable
Figure 3-3Am188ER Microcontroller Address Bus—Normal Read and Write Operation.3-20
Figure 3-4 Am188ER Microcontroller—Read and Write with Address Bus Disable
AMD’s Am186™ and Am188Q™ family of microcontrol lers is base d on the archite cture of
the original 8086 and 8088 microcontr olle rs, and cu rr ently i ncludes t he 80C18 6, 80C188 ,
80L186, 80L188, Am186ER, Am188ER, Am186EMLV, Am188EMLV, Am186ES,
Am188ES, Am186ESLV, Am188ESLV, Am186EM, Am188EM, Am186ED, and
Am186EDLV microcontrollers. The Am186ER and Am188ER microcontroll e rs provide a
natural migration path for 80C186/188 designs that need performance and system cost
enhancements.
The Am186ER an d A m1 8 8E R m ic r oc o n t ro l l er s p r o v id e a lo w -c o st , h ig h - pe r f o rm a nc e s ol u ti o n
for embedded sy ste m designe rs wh o want to use th e x86 a rchit ectur e. By i nteg rati ng multi ple
fun c t i onal b l o c k s a n d 3 2 K b y t e o f i n t e r n a l R A M w i t h t h e C P U , the Am186ER and Am188ER
microcontrollers eliminate the need for off-chip system-interface logic. It is possible to
implement a fully functio nal system wit h ROM and RAM, serial int erfaces, and custom I / O
capability without additional system-interface logic.
The Am186ER and Am188ER microcontrollers can opera te at f requenci es up t o 40 MHz.
The microcontrollers in clude an on-boar d PLL so that the clock input frequency can b e as
little as one fourth the processor operating frequency. The Am186ER and Am188ER
microcontrollers are available in versions operating at 20, 25, 33, and 40 MHz.
PURPOSE OF THIS MANUAL
This manual describes the technical features and programming inte rface of the Am186ER
and Am188ER microcontrollers. The complete inst ruction set is documented in the
and Am188 Family Instruction Set Manual,
order #21267.
Am186
INTENDED AUDIENCE
This manual is intended for computer hardware and software engineers and system
architects who are designing or are considering designi ng systems based on the Am186ER
and Am188ER microcontrollers.
USER’S MANUAL OVERVIEW
This manual contains information on the Am186ER and Am188ER mic rocontrollers and is
essential for system architects and design engineers . Additional information is avail able in
the form of data sheets, application notes, and othe r documentation that is provided with
software products and hardware-development tools.
The information in this manual is organized into 12 chapters and 1 appendix.
n Chapter 1 introduces the features and performance aspects of the Am186ER and
Am188ER microcontrollers.
n Chapter 2 describes the programmer’s model of the Am186 and Am188 family
microcontrollers, including an instruction set overview and register model.
n Chapter 3 provides an overview of the system interfaces, along with clocking
features.
Introduction and Overview
xiii
n Chapter 4 provides a description of the peripheral control block al ong wit h power
management and reset configuration.
n Chapter 5 provides a description of the chip select unit.
n Chapter 6 provides a description of the internal memory.
n Chapter 7 provides a description of the refresh control unit.
n Chapter 8 provides a description of the on-chip interrupt controller.
n Chapter 9 describes the timer control unit.
n Chapter 10 describes the DMA controller.
n Chapter 11 describes the asynchronous serial port.
n Chapter 12 describes the synchronous serial interface.
n Chapter 13 describes the programmable I/O pins.
n Appendix A includes a complete summary of peripheral registers and fields.
For complete information on the Am186ER and Am188ER microcontroller pi n lists, timing,
thermal characteristics, and physical dimensions, please refer to the
Am188ER Microcontrollers Data Sheet
, order #20732.
Am186ER and
AMD DOCUMENTATION
E86™ Microcontroller Family
ORDER NO.DOCUMENT TITLE
20732Am186ER and Am188ER Microcon troller s Dat a Sheet
Hardware docume ntati on: pin desc ript ions, funct ion al desc ript ions, absol ute
maximum ratings, operating ranges, switching characteristics and waveforms,
connection diagr ams an d pinout s, and package p hysic al dime nsions .
21267Am186 and Am188 Family Instr uctio n Set Manua l
Provides a detail ed description and examples for eac h instruction included in the
Am186 and Am188 Famil y Ins tructi on Set.
SM
19255FusionE86
Catalog
Provides info rmat ion on t ool s that s peed a n E86 fami ly em bedde d produc t to
market. Include s products fr om expert suppl iers of emb edded develo pment solutions.
20071E86 Family Support Tools Bri ef
Lists avail able E86 family sof tware and hard ware developme nt tools, as well a s
contact information for suppliers.
21058FusionE86 Development Too ls Refe rence CD
Provides a sing le-so urce multim edia to ol for cus tomer eva luatio n of AMD pr oducts, as well as Fu sion partner tools and techno logies that support the E86 family
of microcontrollers and microprocessors. T echnical documentation for the E86
family is included on the CD in PDF format.
To order literature, contact the neares t AMD sales office or call 800-222-9323, opt ion 3 (in
the U.S. and Canada ) or dir ect di al from any locat ion 512 -602 -5651.
xiv
Literature is also available in postscript and PDF formats on the AMD web site. To access the
AMD home page, go to http://www.amd.com. To download documents and software, ftp t o
ftp.amd.com and log on as anonymous using your E-mail address as a password. Or via
your web browser, go to ftp://ftp.amd.com.
Introduction and Overview
CHAPTER
1
FEATURES AND PERFORMANCE
Compared to the 80C186/188 microcontrollers, the Am186™ER and Am188™ER
microcontroller s enable designers to increase perf ormance and functionality , while reducing
the cost, s ize, and power consumption of embedded systems. The Am186ER and Am188ER
microcontrollers are cost-effective, enhanced versions of the AMD 80C186/188 devices.
The Am186ER and Am188ER microcontrollers deliver 80C186/188 compatibility plus
32 Kbyte of integrated memory, increased performance, reduced power consumption,
serial communications, and a glueless bus interface. Developed exclusively for the
embedded marketplace, the Am186ER and Am188ER microcontrollers increase the
performance of existing 80C186/188 systems while decreasing their cost.
Because the Am186ER and Am188ER microcontrollers integrate memory, on-chip
peripherals, and system logic and offer up to twice the performance of an 80C186/188,
they are ideal solutions for customer s who need to enhance and cost-reduce their pres ent
x86 designs.
1.1KEY FEATURES AND BENEFITS
The Am186ER and Am188ER microcontrollers extend the AMD family of microcontroller s
based on the industry-standard x86 archit ecture. Upgrading to the Am186ER or Am188ER
microcontrollers is attractive for the following reasons:
n Minimized total system co st—The new on-chip RAM, peripherals , and system-int erface
logic nearly eliminate the need f or external devices, reducing t he overal l system cos t of new
or existing 80C186/188 designs.
n Integrated RAM—32 Kbyte of internal RAM ensures a low-cost supply of memor y and
also a smaller form fa ctor and lower power consumption for syst em designs. The internal
memory provides the same performance as external zero-wait-state RAM devices.
n Enhanced performance—The Am186ER and Am188ER microcontrollers offer up to
40-MHz operation, which requires only a 10-MHz input clock. The nonmultiplexed
address bus offers faster, unbuffered access to memory.
n Zero-wait-state operation—Enhanced bus timing permits zero -wait-state op e rati on at
40 MHz with internal RAM or inexpensive 70-ns memories.
n 3.3-V supply voltage with 5-V-tolerant I/O—The Am186ER and Am188ER
microcontrollers use a 3.3-V supply over the ent ire range of operating frequencies,
increasing the performance of on e-sup ply 3.3- V systems whi le preser ving much l ower
power consumption when compared to 5-V operation. The 5-V-tolerant I/O
accommodates existing 5-V designs.
n Enhanced functionality—The new and enhanced on-chip peripherals include an
asynchronous serial port, a virtual watchdog timer, an additional interrupt pin, a highspeed synchronous serial interface, a PSRAM controller, a 16-bit Reset Configuration
Register, enhanced chip-select functionality, and 32 programmable I/Os.
n x86 software compatibility—The Am186ER and Am188ER microcontrollers are
80C186/188-compatible and upward-compatible with the AMD E86 family.
Features and Performance
1-1
The Am186ER and Am188ER microcontrollers are part of the AMD E86 family of embedded
microcontroll ers and microproc essors based on th e x86 architectu re. The 16-bit me mbers of the
E86 family, ref erred to t hrough out t his man ual as t he Am186 and Am188 f amily , includ e the
80C186, 80C188, 80L186, 80L188, Am186ER, Am188ER, Am186EM, Am188EM,
Am186EMLV, Am188EMLV, Am186ES, Am188ES, Am186ESLV, Am188ESLV,
Am186ED and Am186EDLV microcontrollers.
The Am186ER and Am188ER microcontrollers are designed to meet the most common
requirements of embedded products developed for t he offi ce automation, mass storage,
communications, and general embedded markets. Applications include disk drive
controllers, hand-held an d desktop terminals, fax machines, printers, phot ocopiers, feature
phones, cellular phones, PBXs, multiplexers, modems, and industrial control.
1.2DISTINCTIVE CHARACTERISTICS
A block diagram of each microcontroller is shown in Figure 1-1 and Figure 1-2. The
Am186ER microcontroller uses a 16-bit external bus, while the Am188ER microcontr oller
has an 8-bit external bus.
The Am186ER and Am188ER microcontrollers provide the following features:
n Memory Integration:
– 32 Kbyte of internal RAM with an internal chip sel ect register
– Internal RAM provides same performance as zero-wait-state external memory
n Reduced power consumption:
– 3.3-V ± 0.3-V operation at all operating frequencies
– I/O drivers tolerate 5-V signal s
n High performance:
– 20-, 25-, 33-, and 40-MHz operating frequencies
– Support for zero-wait-state operation at 40 MHz with 70-ns memory
– 1-Mbyte memory address space and 64-Kbyte I/O space
n New features remove the requirement for a 2x clock i nput and provi de faster access to
memory:
– Phase-locked loop (PLL) allows processor to operate at up to four times the clock
input frequency
– Nonmultiplexed address bus
n New integrated peripherals increase functionalit y wh ile reducing system cost:
– 32 programmable I/O (PIO) pins
– Asynchronous serial port allows full-duplex, 7-bit or 8-bit data transfers
– Synchronous serial interface allows high-speed, half-duplex, bidirectional data
transfer to and from application-specific integrated circuits (ASICs)
1-2
– Controller for external pseudo-static RAM (PSRAM) with auto refresh capability
– Reset Configuration Register
– Additional external and internal interrupts
– Timer 1 can be configured to provide a watchdog timer interrupt
Features and Performance
n Familiar 80C186 peripherals:
– Two independent DMA channels
– Programmable interrupt controller with six external interrupts
– Three programmable 16-bit timers
– Programmable memory and peripheral chip-s elect logic
– Programmable wait-state gen erator
– Power-save clock divider
n Software-compatible with the 80C186/188 microcontroller
n Widely available native development tools, applications, and system software
n Available for commercial or industrial temperature range
n Available in the following packages:
1. All PIO signals are shared wi th other physic al pins. See the pin des criptions in Chapter 3 and
Table 3-1 on page 3-10 for information on shared functions.
Features and Performance
Figure 1-2Am188ER Microcontroller Block Diagram
INT2/INTA0
V
CC
GND
RES
ARDY
SRDY
S1/IMDIS
S0/SREN
DT/R
DEN
HOLD
HLDA
S6/
CLKSEL
UZI
CLKSEL
S2
1
/
2
A19–A0
CLKOUTA
X2
X1
Clock and
Power
Management
Unit
Control
Registers
Control
Registers
AO15–AO8
AD7–AD0
INT3/INTA
CLKOUTB
Bus
Interface
Unit
ALE
1/IRQ
INT4
Interrupt
Control Unit
Control
Registers
Refresh
Control
Unit
RD
WB
WR
RFSH2/ADEN
INT1/SELECT
INT0
NMI
Execution
32 Kbyte
RAM
(32K x 8)
LCS/ONCE0
MCS3/RFSH
Unit
MCS
TMROUT0TMROUT1
TMRIN0TMRIN1
Timer Control
01 (WDT)20 1
Max Count B
Registers
Max Count A
16-Bit Count
PSRAM
Control
Registers
Unit
Chip-Select
Unit
2–MCS0
UCS
/ONCE1
Unit
Registers
Registers
Control
Registers
Control
PCS
PCS
PCS
5/A1
3–PCS0
DRQ0DRQ1
DMA
Unit
20-Bit Source
Pointers
20-Bit Destination
Pointers
16-Bit Count
Registers
Control
Registers
Control
Registers
Asynchronous
Serial Port
Control
Registers
Synchronous Serial
Interface
SCLK
SDEN0 SDEN1
6/A2
Control
Registers
SDATA
PIO
Unit
PIO31–
1
PIO0
TXD
RXD
Notes:
1. All PIO signals are shared wi th other physic al pins. See the pin des criptions in Chapter 3 and
Table 3-1 on page 3-10 for information on shared functions.
Features and Performance
1-5
1.3APPLICATION CONSIDERATIONS
The integration enhancements of the Am186ER and Am188ER microc ontrollers provide a
high-performance, low-syst em-cost solution for 16-bit embedded microcontrolle r designs.
The internal 32-Kbyte RAM allows t he manufacture of a complete embedded sy stem using
only one external ROM device and a low-cost crystal, plus any voltage conversion or current
drivers required for I/O. Internal RAM is enabled and configured by using the Internal
Memory Chip Select (IMCS) Register described in Chapter 6, “Internal Memory.”
The nonmultiplexed address bus (A19–A0) eliminates system-interface logic for external
memory, while the multi plexed address /data bus maint ains the value of existin g customerspecific peripherals and circuits within the upgraded design.
The nonmultiplexed address bus is available in additi on to the 80C186 and 80C188
microcontrollers’ multiplexed addres s/d ata bus (AD15–AD0). The two buses can operate
simultaneously, or the AD15–AD0 bus can be configured to operate only during the data
phase of a bus cycle. See the BHE
and see section 5 .5.1 an d sectio n 5.5.2 for a dditio nal in form ation regard ing the AD15 –AD0
address enabling and di sablin g.
Figure 1-3 illustrates a functi onal sy stem de sig n tha t uses t he integ rat ed peri pheral se t t o
achieve high performance with reduced system cost.
/ADEN and RFSH2/ ADEN pin desc ription s in Chapt er 3,
Figure 1-3Basic Functional System Design
Am186ER
Microcontroller
10-MHz
Crystal
Serial Port
RS-232
Level
Converter
X2
X1
32 Kbyte
RAM
TXD
RXD
1.3.1Clock Generation
The integrated PLL clock-generation circuitry of the Am186ER and Am188ER
microcontrollers allows operation at one times or four times t he crystal frequency, in addition
to the one-half frequency operat ion required by 80C186 and 80C188 microc ontrollers. The
design in Figure 1-3 achieves 40-MHz CPU operation with a 10-MHz cryst al.
WR
A19–A0
AD15–AD0
RD
UCS
Timer 0–2
INT4–INT0
DMA 0–1
CLKOUTA
Am29F400
Flash
WE
Address
Data
OE
CS
40 MHz
1-6
The integrated PLL lowers system cost by reducing the cost of the crystal and reduces
electromagnetic interference (EMI ) in the system.
Features and Performance
1.3.2Memory Interface
The integrated memory controller logic of t he Am186ER and Am188ER microcontrollers
provides a direct address bus interface to memory devices. The use of an external address
latch controlled by the address latch enable (ALE) signal is not required.
Individual byte write-enable signals are provided to eliminate the need for external high/
low-byte, write-enable circuitr y. The maximum bank size programmable for the memory
chip-select signals is increased to 512 Kbyte to facil itate the use of high-density memory
devices.
Improved memory timing specifications enable the use of zero-wait-state memories with
70-ns access times at 40-MHz CPU operation. This reduces overall system cost
significantly by allowing the use of commonly available memory devices. The integrated
32-Kbyte RAM operates at the same speed as zero-wait-state external memory.
Figure 1-3 illustrates an Am186ER microcontroller-based configurati on with 512 Kbyte of
external Flash EPROM in addition to the internal 32-Kbyte memory. Addit ional external
RAM can also be added. The external memory interface requires the following:
n The processor A19–A0 bus connects to the memory address inputs.
n The AD bus connects directly to the data inputs/outputs.
n The UCS chip select connects to the memory chip-select input.
External read operations require that the RD
) input pin. External write operati ons require that the byte write enables con nect to the SRAM
(OE
Write Enable (WE
The example design shown in Figure 1-3 uses a 4-Mbit (256-K x 16) external Flash EPROM
for application memory, mapped into the upper region of the microcontroller’s 1-Mbyte
address space at 80000h–FFFFFh. After a valid reset, the Am186ER or Am188ER
microcontroller will fetch the first instruction from address FFFF0h. The user application
can then enable and configure the location of the integrated 32-Kbyte RAM within the
remaining address space ; in this example, it would be at address 00000h to accommodate
the interrupt vector table.
) input pin.
1.3.3Seri al Communications Port
The integrated universal asynchronous receiver/transmitter (UART) controller in the
Am186ER and Am188ER microcontrollers eliminates the need for external logic to
implement a communications interface. The integrated UART generates the serial clock
from the CPU clock so that no external time-base oscillato r is r equir ed.
Figure 1-3 shows a minimal implementation of an RS-232 console or modem
communications port. The RS-232 to CMOS voltage-level converter is required for the
proper electrical interface with the external device.
The Am186ER and Am188ER microcontrollers al so include a synchronous serial interface.
For more information, see Chapter 11.
output connect s to t he SRAM Out put E nable
Features and Performance
1-7
1.4THIRD-PARTY DEVELOPMENT SUPPORT PRODUCTS
The FusionE86 Program of Partne rships for Applica tion Solut ions p rovid es the cus tomer w ith
an array of prod ucts design ed to meet cri tic al time- to-m arket needs . Produc ts a nd solut ions
available fro m the AMD Fusi onE86 pa rtn ers incl ude emu lators , hardw are and s oftwar e
debuggers, board-level products, and software development tools.
In addition, mature development tools and applications for the x86 platform are widely
available in the general marketplace.
1-8
Features and Performance
CHAPTER
PROGRAMMING
2
All members of the Am186 and Am188 family of microcontr ollers, includi ng the Am186ER
and Am188ER, contain the same basic set of registers, instructions, and addressing modes,
and are compatible with the original industry-standard 186/188 parts.
2.1REGISTER SET
The base architecture of the Am186ER and Am188ER microcontrollers has 14 registers,
as shown in Figure 2-1. These registers are grouped into the following categories:
n General Registers—Eight 16-bit general purpose registers ca n be used for arit hmetic
and logical operands. Four of these ( AX, BX, CX, and DX) can be used as 16-bit registers
or split into pairs of se parate 8-bit register s (AH, AL, BH, BL, CH, CL, DH, an d DL). The
Destination Index (DI) and Source Index (SI) general-purpose registers are used for
data movement and string instructions. The Base Point er (BP) and St ack Pointer (SP)
general-purpose register s are used for the stack segment and poi nt 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 part icular locations within a
segment. The addressing mode sel ects the specific registers for operand and addre ss
calculations.
PUSHF) utilize the stack pointer. The Stack Pointer 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. (For usage, refer to sectio n
2.2.)
n Status and Control Registers—Two 16-bit speci al-purpose registers record or alter certain
aspects of the processor state—the Instruction Pointer (IP) Register contains the offset
address of the ne xt s equenti al instru cti on to be ex ecut ed and th e Proc esso r Stat us Flags
(FLAGS) Register contains status and control flag bits (see Figure 2-1 and Figure 2-2).
Note that the Am186ER and Am188ER microcon trollers have additional on-chip per ipheral
registers, which are exter nal to the proc essor. These exter nal register s are not accessibl e
by the instruction set. However, because the processor t reat s 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 on-chip
peripheral registers, are described in the chapters that follow.
Programming
2-1
Figure 2-1Register Set
16-Bit
Register Name
Byte
Addressable
(8-Bit
Register
Names
Shown)
7 0 7 0
AX
DX
CX
BX
BP
SI
DI
SP
AH
DH
CH
BH
Base Pointer
Source Index
Destination Index
15 0
General
Registers
AL
DL
CL
BL
Special Register
Functions
Multiply/Divide
I/O Instructions
Loop/Shift/Repeat/Count
Base Registers
Index Registers
Stack Pointer
2.1.1Processor Status Flags Register
The 16-bit processor Status Flags Register ( Figure 2-2) reco rds specific c haracteristics of
the result of logical and arithmetic instructions (bits 0, 2, 4, 6, 7, and 11) and controls the
operation of the microcontroller within a given operating mode (bits 8, 9, and 10).
16-Bit
Register Name
FLAGS
15 0
CS
DS
SS
ES
Segment Registers
15 0
Processor Status Flags
IP
Instruction Pointer
Status and Control
Code Segment
Data Segment
Stack Segment
Extra Segment
Registers
After an instruction is ex ecuted, the va lue of the f lags may be set ( to 1), cl eared/reset (set
to 0), unchanged, or undefined. The term
execution of the instruction is not preserved, and the value of the flag after the instruction is
executed cannot be predi cted.
Figure 2-2Processor Statu s Flags Registe r (FLAGS)
15
Reserved
OF
DF
IF
TF
SF
ZF
70
AF
Res
Bits 15–12—Reserved
undefined
PF
Res
Res
means that the fl ag va lue pri or to the
CF
2-2
Bit 11: Overflow Flag (OF)—Set if the signed result cannot be expressed within the number
of bits in the destination operand; cleared o ther wise.
Bit 10: Direction Flag (DF)—Causes string instructions to auto-decrement the appropriate
index registers when set. Clearing DF causes auto-increment.
Programming
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 .
Bit 8: Trace Flag (TF)—When set, a trace interrupt occurs after instructions execute. TF
is cleared by the t race interr upt after t he processor st atus flags are pushed onto t he stack.
The trace service routine can continue t racing by poppi ng the fl ags back with an int errupt
return (IRET) instruct ion.
Bit 7: Sign Flag (SF)—Set equal to h igh-order bit of r esult (0 if 0 or positive, 1 if negative).
Bit 6: Zero Flag (ZF)—Set if result is 0; clear ed otherwise.
Bit 5: Reserved
Bit 4: Auxiliary Carry (AF)—Set on carry f rom or borrow to the low-or der 4 bits of the AL
general-purpose register; cleared otherwise.
Bit 3: Reserved
Bit 2: Parity Flag (PF)—Set if low-order 8 bi ts of resul t contain an ev en number of 1 bits;
cleared otherwise.
Bit 1: Reserved
Bit 0: Carry Flag (CF)—Set on high-order bit carry or borrow; cleared otherwise.
2.2MEMORY ORGANIZATION AND ADDRESS GENERATION
Memory is organized in sets of segments. Each segment is a linear contiguous sequence
of 64K (2
of a 16-bit segment value and a 16-bit offset. The offset is the number of bytes from the
beginning of the segment (the segment address) to the data or instruction that is being
accessed.
16
) 8-bit bytes. Memory is addressed using a two-component address that consists
The processor forms the physical address of the target location by taking the segment
address, shifting it to the left 4 bits (multi plying by 16), and adding this to the 16-b it offset.
The result is the 20-bit address of the target data or instruction. This allows for a 1-Mbyte
physical address size.
For example, if the segment register is loaded with 12A4h and the offset i s 0022h, the
resultant address is 12A62h (see Figure 2-3). To find the result:
1. The segment register contains 12A4h.
2. The segment register is shifted left 4 places and is now 12A40h.
3. The offset is 0022h.
4. The shifted segment address (12A40h) is added to the offset (00022h) to get 12A62h.
5. This address is placed on the pins of the controller.
All instructions that address operands in memory must specify (implicitly or explicitly) a
16-bit segment value and a 16-bit of fset value. The 16-bit segment values a re con tained i n
one of four int er na l s eg me nt r egi st e rs ( C S, DS , ES , an d SS) . See “Add ress ing Modes” on
page 2-10 for more information on calculating the offset value. See “Segments” on page
2-8 for more information on CS, DS, ES, and SS.
In addition to memory space, all Am186 and Am188 family microcontrollers provide 64K
of I/O space (see Figure 2-4).
Programming
2-3
Figure 2-3Physical Address Generatio n
Shift
Left
4 Bits
1 2 A 4 0
190
0 0 0 2 2
150
1 2 A 4
150
15
0 0 2 2
Segment
Base
Offset
0
Logical
Address
1 2 A 6 2
190
To Memory
2.3I/O SPACE
The I/O space consists of 64K 8-bit or 32K 16-bit port s. The IN and OUT instructions address
the I/O space with either an 8-bit port addr ess specified in the instruction, or a 16-bit port
address in the DX Register. Eight-bit port addresses are zero-extended so that A15–A8
are Low. I/O port addresses 00F8h through 00FFh are reserved. The Am186ER and
Am188ER microcontrollers provide specific instructions for addressing I/O space.
Figure 2-4Memory an d I/O Space
Memory
Space
1M
I/O
Space
Physical Address
64K
2.4INSTRUCTION SET
The Am186ER and Am188ER microcontrollers use the same instruction set as the 80C186
microcontroller. An instruct ion can reference from zero to several operands. An operand
can reside in a register , in the inst ruction itself, or in memory. Specif ic operand addressi ng
modes are discussed on page 2-10.
Table 2-1 lists the instructions for the Am1 86ER and Am188ER microcont rollers in
alphabetical order.
#21267, provides detailed information on the format and function of the following
instructions.
2-4
The Am186™ and Am188™ Family Instruction Set Manual
, order
Programming
Table 2-1Instruction Set
MnemonicInstruction Name
AAAASCII adjust for addition
AADASCII adjust for division
AAMASCII adjust for multiplication
AASASCII adjust for subtraction
ADCAdd byte or word with carry
ADDAdd byte or word
ANDLogical AND byte or word
BOUNDDetects values outside prescribed range
CALLCall procedure
CBWConvert byte to word
CLCClear carry flag
CLDClear direction flag
CLIClear interrupt-enable flag
CMCComplement carry flag
CMPCompare byte or word
CMPSCompare byte or word string
CWDConvert word to doubleword
DAADecimal adjust for addition
DASDecimal adjust for subtraction
DECDecrement byte or word by 1
DIVDivide byte or word unsigned
ENTERFormat stack for procedure entry
ESCEscape to extension processor
HLTHalt until interrupt or reset
IDIVInteger divide byte or word
IMULInteger multiply byte or word
INInput byte or word
INCIncrement byte or word by 1
INSInput bytes or word string
INTInterrupt
INTOInterrupt if overflow
IRETInterrupt return
JA/JNBEJump if above/not below or equal
JAE/JNBJump if above or equal/not below
Programming
2-5
MnemonicInstruction Name
JB/JNAEJump if below/not above or equal
JBE/JNAJump if below or equal/not above
JCJump if carry
JCXZJump if register CX = 0
JE/JZJump if equal/zero
JG/JNLEJump if greater/not less or equal
JGE/JNLJump if greater or equal/not less
JL/JNGEJump if less/not greater or equal
JLE/JNGJump if less or equal/not greater
JMPJump
JNCJump if not carry
JNE/JNZJump if not equal/not zero
JNOJump if not overflow
JNP/JPOJump if not parity/parity odd
JNSJump if not sign
JOJump if overflow
JP/JPEJump if parity/parity even
JSJump if sign
LAHFLoad AH register from flags
LDSLoad pointer using DS
LEALoad effective address
LEAVERestore stack for procedure exit
LESLoad pointer using ES
LOCKLock bus during next instruction
LODSLoad byte or word string
LOOPLoop
LOOPE/
LOOPZ
LOOPNE/
LOOPNZ
MOVMove byte or word
Loop if equal/zero
Loop if not equal/not zero
2-6
MOVSMove byte or word string
MULMultiply byte or word unsigned
NEGNegate byte or word
NOPNo operation
NOTLogical NOT byte or word
Programming
MnemonicInstruction Name
ORLogical inclusive OR byte or word
OUTOutput byte or word
POPPop word off stack
POPAPop all general register off stack
POPFPop flags off stack
PUSHPush word onto stack
PUSHAPush all general registers onto stack
PUSHFPush flags onto stack
RCLRotate left through carry byte or word
RCRRotate right through carry byte or word
REPRepeat
REPE/REPZRepeat while equal/zero
REPNE/
REPNZ
RET0Return from procedure
ROLRotate left byte or word
RORRotate right byte or word
SAHFStore AH register in flags SF, ZF, AF, PF, and CF
SAL Shift left arithmetic byte or word
SARShift right arithmetic byte or word
SBBSubtract byte or word with borrow
SCASScan byte or word string
SHL Shift left logical byte or word
SHRShift right logical byte or word
STCSet carry flag
STDSet direction flag
STISet interrupt-enable flag
STOSStore byte or word string
Repeat while not equal/not zero
SUBSubtract byte or word
TESTTest (logical AND, flags only set) byte or word
XCHGExchange byte or word
XLATTranslate byte
XORLogical exclusive OR byte or word
Programming
2-7
2.5SEGMENTS
The Am186ER and Am188ER microcontrollers use four segment registers:
1. Data Segment (DS): The processor assumes that all accesses to the program’s
variables are from the 64K space pointed to by the DS Register. The data segment holds
data, operands, etc.
2. Code Segment (CS): This 64K space is the default locati on for all instruct ions. All code
must be executed from the code segment.
3. Stack Segment (SS): The processor uses the SS Register to perform operations that
involve the stack, such as pushes and pops. The st ack segment i s used for t emporar y
space.
4. Extra Segment (ES): Usually this segment is used for large string operati ons and for
large data structures. Certain str ing i n structions assume the extra segment as the
segment portion of the address. The extra segment is also used (by using segment
override) as a spare data segment.
When a segment is not defined for a data movement instruc tion, it’s assumed to be a data
segment. An instruction prefix can be used to override the segment register. For speed
and compact instruction encoding, the segment register used for physical address
generation is implied by the addressing mode used (see Table 2-2).
Table 2-2Segment Regist er Selection Rules
Memory Reference
Needed
Local DataData (DS)All data references
InstructionsCode (CS)Instructions (including immedi ate data)
StackStack (SS)All stack pushes and pops
External Data (Global)Extra (ES)All string instruc tion references that use the DI Regi s-
Segment Register
Used
2.6DATA TYPES
The Am186ER and Am188ER microcontrollers directly support the following data types:
n Integer—A signed binary numeric value contained in an 8-bit byte or a 16-bit word. All
operations assume a two’s complement representation.
n Ordinal—An unsigned binary numeric value contained in an 8-bit byt e or a 16-bit wor d.
n Double Word—A signed binary numeric value contained in two sequential 16-bit
addresses, or in a DX::AX register pair.
n Quad Word—A signed binary numeric value contained in four sequential 16-bit
addresses.
Implicit Segment Selection Rule
Any memory references that use the BP Reg ister
ter as an index
2-8
n Binary-Coded Decimal (BCD)—An unpacked byte representation of the decimal
digits 0–9.
n ASCII—A byte representation of alphanumeric and c ontr ol char acters usi ng the ASCII
standard of character representation.
n Packed BCD—A packed byte representation of two decimal digits (0–9). One digit is
stored in each nibble (4 bits) of the byte.
Programming
Loading...
+ 166 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.