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 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

 

 

Memory Reference

Segment Register

Implicit Segment Selection Rule

 

Needed

Used

 

 

 

 

 

 

 

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

 

 

 

 

2.6DATA TYPES

The Am186ER and Am188ER microcontrollers directly support the following data types:

ν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.

νOrdinal—An unsigned binary numeric value contained in an 8-bit byte or a 16-bit word.

νDouble Word—A signed binary numeric value contained in two sequential 16-bit addresses, or in a DX::AX register pair.

νQuad Word—A signed binary numeric value contained in four sequential 16-bit addresses.

νBinary-Coded Decimal (BCD)—An unpacked byte representation of the decimal digits 0–9.

νASCII—A byte representation of alphanumeric and control characters using the ASCII standard of character representation.

νPacked BCD—A packed byte representation of two decimal digits (0–9). One digit is stored in each nibble (4 bits) of the byte.

2-8

Programming

Page 30
Image 30
AMD Am186TMER Segments, Data Types, Segment Register Selection Rules, Segment Register Implicit Segment Selection Rule