Programming
2-8
2.5 SEGMENTS
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 location for all instructions. 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 stack segment is used for temporary
space.
4. Extra Segment (ES): Usually this segment is used for large string operations and for
large data structures. Certain string instructions 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 instruction, 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-2 Segment Register Selection Rules
2.6 DATA 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 byte or a 16-bit word.
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.
n Binary-Coded Decimal (BCD)—An unpacked byte representation of the decimal
digits 0–9.
n ASCII—A byte representation of alphanumeric and control characters using 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.
Memory Reference
Needed
Segment Register
Used
Implicit Segment Selection Rule
Local Data Data (DS) All data references
Instructions Code (CS) Instructions (including immediate data)
Stack Stack (SS) All stack pushes and pops
Any memory references that use the BP Register
External Data (Global) Extra (ES) All string instruction references that use the DI Regis-
ter as an index