1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML 2.0//EN">
4 <TITLE>80386 Programmer's Reference Manual -- Chapter
16</TITLE>
7 <B>up:
</B> <A HREF=
"toc.htm">
8 Table of Contents
</A><BR>
10 <A HREF=
"s15_07.htm">15.7 Differences From
80286 Real-Address Mode
</A><BR>
13 16.1 How the
80386 Implements
16-Bit and
32-Bit Features
</A>
17 <H1>Chapter
16 Mixing
16-Bit and
32 Bit Code
</H1>
19 The
80386 running in protected mode is a
32-bit microprocessor, but it is
20 designed to support
16-bit processing at three levels:
22 <LI>Executing
8086/
80286 16-bit programs efficiently with complete
25 <LI>Mixing
16-bit modules with
32-bit modules.
27 <LI>Mixing
16-bit and
32-bit addresses and operands within one module.
29 The first level of support for
16-bit programs has already been discussed
30 in
<A HREF=
"c13.htm">Chapter
13</A>,
31 <A HREF=
"c14.htm">Chapter
14</A>,
32 and
<A HREF=
"c15.htm">Chapter
15</A>. This chapter shows how
16-bit
33 and
32-bit modules can cooperate with one another, and how one module can
34 utilize both
16-bit and
32-bit operands and addressing.
36 The
80386 functions most efficiently when it is possible to distinguish
37 between pure
16-bit modules and pure
32-bit modules. A pure
16-bit module
38 has these characteristics:
40 <LI>All segments occupy
64 Kilobytes or less.
41 <LI>Data items are either
8 bits or
16 bits wide.
42 <LI>Pointers to code and data have
16-bit offsets.
43 <LI>Control is transferred only among
16-bit segments.
45 A pure
32-bit module has these characteristics:
47 <LI>Segments may occupy more than
64 Kilobytes (zero bytes to
4
50 <LI>Data items are either
8 bits or
32 bits wide.
52 <LI>Pointers to code and data have
32-bit offsets.
54 <LI>Control is transferred only among
32-bit segments.
56 Pure
16-bit modules do exist; they are the modules designed for
16-bit
57 microprocessors. Pure
32-bit modules may exist in new programs designed
58 explicitly for the
80386. However, as systems designers move applications
59 from
16-bit processors to the
32-bit
80386, it will not always be possible
60 to maintain these ideals of pure
16-bit or
32-bit modules. It may be
61 expedient to execute old
16-bit modules in a new
32-bit environment without
62 making source-code changes to the old modules if any of the following
65 <LI>Modules will be converted one-by-one from
16-bit environments to
68 <LI>Older,
16-bit compilers and software-development tools will be
69 utilized in the new32-bit operating environment until new
32-bit
70 versions can be created.
72 <LI>The source code of
16-bit modules is not available for modification.
74 <LI>The specific data structures used by a given module inherently utilize
77 <LI>The native word size of the source language is
16 bits.
79 On the
80386,
16-bit modules can be mixed with
32-bit modules. To design a
80 system that mixes
16- and
32-bit code requires an understanding of the
81 mechanisms that the
80386 uses to invoke and control its
32-bit and
16-bit
85 16.1 How the
80386 Implements
16-Bit and
32-Bit Features
</A><BR>
86 <A HREF=
"s16_02.htm">16.2 Mixing
32-Bit and
16-Bit Operations
</A><BR>
87 <A HREF=
"s16_03.htm">16.3 Sharing Data Segments Among Mixed Code Segments
</A>
89 <A HREF=
"s16_04.htm">16.4 Transferring Control Among Mixed Code Segments
</A>
93 <B>up:
</B> <A HREF=
"toc.htm">
94 Table of Contents
</A><BR>
96 <A HREF=
"s15_07.htm">15.7 Differences From
80286 Real-Address Mode
</A><BR>
99 16.1 How the
80386 Implements
16-Bit and
32-Bit Features
</A>