up: Chapter 16 -- Mixing 16-Bit and 32 Bit Code
prev: 16.1 How the 80386 Implements 16-Bit and 32-Bit Features
next: 16.3 Sharing Data Segments Among Mixed Code Segments


16.2 Mixing 32-Bit and 16-Bit Operations

The 80386 has two instruction prefixes that allow mixing of 32-bit and 16-bit operations within one segment:

These prefixes reverse the default size selected by the D-bit. For example, the processor can interpret the word-move instruction MOV mem, reg in any of four ways:

These examples illustrate that any instruction can generate any combination of operand size and address size regardless of whether the instruction is in a USE16 or USE32 segment. The choice of the USE16 or USE32 attribute for a code segment is based upon these criteria:
  1. The need to address instructions or data in segments that are larger than 64 Kilobytes.
  2. The predominant size of operands.
  3. The addressing modes desired. (Refer to Chapter 17 for an explanation of the additional addressing modes that are available when 32-bit addressing is used.)
Choosing a setting of the D-bit that is contrary to the predominant size of operands requires the generation of an excessive number of operand-size prefixes.


up: Chapter 16 -- Mixing 16-Bit and 32 Bit Code
prev: 16.1 How the 80386 Implements 16-Bit and 32-Bit Features
next: 16.3 Sharing Data Segments Among Mixed Code Segments