* remove "\r" nonsense
[mascara-docs.git] / i386 / i386.reference / c16.htm
blobf2bb861137d1a78497147355c1bb946067519f2e
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
2 <HTML>
3 <HEAD>
4 <TITLE>80386 Programmer's Reference Manual -- Chapter 16</TITLE>
5 </HEAD>
6 <BODY>
7 <B>up:</B> <A HREF="toc.htm">
8 Table of Contents</A><BR>
9 <B>prev:</B>
10 <A HREF="s15_07.htm">15.7 Differences From 80286 Real-Address Mode</A><BR>
11 <B>next:</B>
12 <A HREF="s16_01.htm">
13 16.1 How the 80386 Implements 16-Bit and 32-Bit Features</A>
14 <P>
15 <HR>
16 <P>
17 <H1>Chapter 16 Mixing 16-Bit and 32 Bit Code</H1>
18 <P>
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:
21 <OL>
22 <LI>Executing 8086/80286 16-bit programs efficiently with complete
23 compatibility.
25 <LI>Mixing 16-bit modules with 32-bit modules.
27 <LI>Mixing 16-bit and 32-bit addresses and operands within one module.
28 </OL>
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.
35 <P>
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:
39 <UL>
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.
44 </UL>
45 A pure 32-bit module has these characteristics:
46 <UL>
47 <LI>Segments may occupy more than 64 Kilobytes (zero bytes to 4
48 gigabytes).
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.
55 </UL>
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
63 conditions is true:
64 <UL>
65 <LI>Modules will be converted one-by-one from 16-bit environments to
66 32-bit environments.
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
75 16-bit words.
77 <LI>The native word size of the source language is 16 bits.
78 </UL>
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
82 features.
83 <P>
84 <A HREF="s16_01.htm">
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>
88 <BR>
89 <A HREF="s16_04.htm">16.4 Transferring Control Among Mixed Code Segments</A>
90 <P>
91 <HR>
92 <P>
93 <B>up:</B> <A HREF="toc.htm">
94 Table of Contents</A><BR>
95 <B>prev:</B>
96 <A HREF="s15_07.htm">15.7 Differences From 80286 Real-Address Mode</A><BR>
97 <B>next:</B>
98 <A HREF="s16_01.htm">
99 16.1 How the 80386 Implements 16-Bit and 32-Bit Features</A>
100 </BODY>