This chapter looks at memory from both a physical and
logical point of view. We will discuss the physical chips and
memory modules that you can purchase and install. The chapter
also looks at the logical layout of memory, as well as defines
the different areas and uses of these areas from the system's
point of view. Because the logical layout and uses are within
the "mind" of the processor, memory remains as perhaps the
most difficult subject to grasp in the PC universe. This
chapter contains much useful information that removes the
mysteries associated with memory and enables you to get the
most out of your system.
The System
Logical Memory Layout
The original PC had a total of 1M of addressable memory,
and the top 384K of that was reserved for use by the system.
Placing this reserved space at the top (between 640K and 1024K
instead of at the bottom, between 0K and 640K) led to what
today is often called the conventional memory barrier.
The constant pressures on system and peripheral manufacturers
to maintain compatibility by never breaking from the original
memory scheme of the first PC has resulted in a system memory
structure that is (to put it kindly) a mess. Almost two
decades after the first PC was introduced, even the newest
Pentium II-based systems are limited in many important ways by
the memory map of the first PCs.
Someone who wants to become knowledgeable about personal
computers must at one time or another come to terms with the
types of memory installed on their system--the small and large
pieces of different kinds of memory, some accessible by
software application programs, and some not. The following
sections detail the different kinds of memory installed on a
modern PC. The kinds of memory covered in the following
sections include the following:
- Conventional (Base) memory
- Upper Memory Area (UMA)
- High Memory Area (HMA)
- Extended memory (XMS)
- Expanded memory (obsolete)
- Video RAM memory (part of UMA)
- Adapter ROM and Special-Purpose RAM (part of
UMA)
- Motherboard ROM BIOS (part of UMA)
Subsequent sections also cover preventing memory conflicts
and overlap, using memory managers to optimize your system's
memory, and making better use of memory. In an AT system, the
memory map extends beyond the 1M boundary and can continue to
16M on a system based on the 286 or higher processor, 4G
(4,096M) on a 386DX or higher, or as much as 64G (65,536M) on
a Pentium II. Any memory past 1M is called extended
memory.
Figure 7.1 shows the logical address locations for a
PC-compatible system. If the processor is running in real
mode, only the first megabyte is accessible. If the processor
is in protected mode, the full 16; 4,096; or 65,536M are
accessible. Each symbol is equal to 1K of memory; each line or
segment is 64K; and this map shows the first two megabytes of
system memory.
NOTE: To save space, this
map is ended after the end of the second megabyte. In
reality, this map continues to the maximum of addressable
memory.
Conventional
(Base) Memory
The original PC/XT-type system was designed to use 1M of
memory workspace, sometimes called RAM (random access
memory). This 1M of RAM is divided into several sections,
some of which have special uses. DOS can read and write to the
entire megabyte, but can manage the loading of programs only
in the portion of RAM space called conventional
memory, which at the time the first PC was introduced
was 512K. The other 512K was reserved for use by the system
itself, including the motherboard and adapter boards plugged
into the system slots.
IBM decided after introducing the system that only 384K was
needed for these reserved uses, and the company began
marketing PCs with 640K of user memory. Thus, 640K became the
standard for memory that can be used by DOS for running
programs, and is often termed the 640K memory barrier.
The remaining memory after 640K was reserved for use by the
graphics boards, other adapters, and the motherboard ROM BIOS.
Upper Memory Area
(UMA)
The term Upper Memory Area (UMA) describes the
reserved 384K at the top of the first megabyte of system
memory on a PC/XT and the first megabyte on an AT-type
system. . = Program-accessible memory (standard RAM)
G = Graphics Mode Video RAM
M = Monochrome Text Mode Video RAM
C = Color Text Mode Video RAM
V = Video ROM BIOS (would be "a" in PS/2)
a = Adapter board ROM and special-purpose RAM (free UMA space)
r = Additional PS/2 Motherboard ROM BIOS (free UMA in non-PS/2 systems)
R = Motherboard ROM BIOS
b = IBM Cassette BASIC ROM (would be "R" in IBM compatibles)
h = High Memory Area (HMA), if HIMEM.SYS is loaded.
Conventional (Base) Memory:
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
000000: ................................................................
010000: ................................................................
020000: ................................................................
030000: ................................................................
040000: ................................................................
050000: ................................................................
060000: ................................................................
070000: ................................................................
080000: ................................................................
090000: ................................................................
Upper Memory Area (UMA):
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0A0000: GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
0B0000: MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0C0000: VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
0D0000: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0E0000: rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
0F0000: RRRRRRRRRRRRRRRRRRRRRRRRbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbRRRRRRRR
Extended Memory:
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
100000: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
Extended Memory Specification (XMS) Memory:
110000: ................................................................
120000: ................................................................
130000: ................................................................
140000: ................................................................
150000: ................................................................
160000: ................................................................
170000: ................................................................
180000: ................................................................
190000: ................................................................
1A0000: ................................................................
1B0000: ................................................................
1C0000: ................................................................
1D0000: ................................................................
1E0000: ................................................................
1F0000: ................................................................
FIG. 7.1 The logical memory map of the
first 2M. This memory has the addresses from A0000 through
FFFFF.
The way the 384K of upper memory is used breaks down as
follows:
- The first 128K after conventional memory is called
Video RAM. It is reserved for use by video adapters.
When text and graphics are displayed on-screen, the
electronic impulses that contain their images reside in this
space. Video RAM is allotted the address range from
A0000-BFFFF.
- The next 128K is reserved for the adapter BIOS that
resides in read-only memory chips on some adapter boards
plugged into the bus slots. Most VGA-compatible video
adapters use the first 32K of this area for their on-board
BIOS. The rest can be used by any other adapters installed.
Many network adapters also use this area for special purpose
RAM called Shared Memory. Adapter ROM and special purpose
RAM is allotted the address range from C0000-DFFFF.
- The last 128K of memory is reserved for motherboard
BIOS, (the basic input/output system, which is stored in
read-only RAM chips or ROM). The POST (Power-On Self Test)
and bootstrap loader, which handles your system at bootup
until the operating system takes over, also reside in this
space. Most systems only use the last 64K (or less) of this
space, leaving the first 64K or more free for remapping with
memory managers. Some systems also include the CMOS Setup
program in this area. The motherboard BIOS is allotted the
address range from E0000-FFFFF.
Not all the 384K of reserved memory is fully used on most
AT-type systems. For example, according to IBM's definition of
the PC standard, reserved video RAM begins at address A0000,
which is right at the 640K boundary. Normally, this is used
for VGA graphics modes, while the monochrome and color text
modes use B0000-B7FFF and B8000-BFFFF, respectively. Older
non-VGA adapters only used memory in the B0000 segment.
Different video adapters use varying amounts of RAM for their
operations depending mainly on the mode they are in. However,
to the processor it always appears as the same 128K area no
matter how much RAM is really on the video card. This is
managed by bank switching areas of memory on the card in and
out of the A0000-BFFFF segments.
Although the top 384K of the first megabyte was originally
termed reserved memory, it is possible to use
previously unused regions of this memory to load device
drivers (like ANSI.SYS) and memory-resident programs (like
MOUSE.COM), which frees up the conventional memory they would
otherwise require. The amount of free UMA space varies from
system to system depending on the adapter cards installed on
the system. For example, most SCSI adapters and network
adapters require some of this area for built-in ROMs or
special-purpose RAM use.
Segment Addresses and Linear
Addresses
One thing that can be confusing is the difference between a
segment address and a full linear address. The use of
segmented address numbers comes from the internal structure of
the Intel processors, and is used primarily by older, 16-bit
operating systems. They use a separate register for the
segment information and another for the offset. The concept is
very simple. For example, assume that I am staying in a hotel
room, and somebody asks for my room number. The hotel has 10
floors, numbered from zero through nine; each floor has 100
rooms, numbered from 00 to 99. A segment is defined as any
group of 100 rooms starting at a multiple of 10, and indicated
by a two-digit number. So, a segment address of 54 would
indicate the actual room 540, and you could have an offset of
00 to 99 rooms from there.
Thus in this hotel example, each segment is specified as a
two- digit number from 00 to 99, and an offset can be
specified from any segment starting with a number from 00 to
99 as well.
As an example, let's say I am staying in room 541. If the
person needs this information in segment:offset form, and each
number is two digits, I could say that I am staying at a room
segment starting address of 54 (room 540), and an offset of 01
from the start of that segment. I could also say that I am in
room segment 50 (room 500), and an offset of 41. You could
even come up with other answers, such as I am at segment 45
(room 450) offset 91 (450+91=541). Here is an example of how
this adds up:
Segment |
Offset |
Total |
54 |
01 |
541 |
50 |
41 |
541 |
45 |
91 |
541 |
As you can see, although the particular segment and offset
are different, they all add up to the same room address. In
the Intel x86 processors, a similar scheme is used where a
segment and offset are added internally to produce the actual
address. It can be somewhat confusing, especially if you are
writing assembly language or machine language software!
This is exactly how segmented memory in an Intel processor
works. Notice that the segment and offset numbers essentially
overlap on all digits except the first and last. By adding
them together with the proper alignment, you can see the
linear address total.
With 32-bit operating systems, segment addresses are not an
issue. A linear address is one without segment:offset
boundaries, such as saying room 541. It is a single number and
not comprised of two numbers added together. For example, a
SCSI host adapter might have 16K ROM on the card addressed
from D4000 to D7FFF. These numbers expressed in segment:offset
form are D400:0000 to D700:0FFF. The segment portion is
composed of the most significant four digits, and the offset
portion is composed of the least significant four digits.
Because each portion overlaps by one digit, the ending address
of its ROM can be expressed in four different ways, as
follows:
D000:7FFF = D000 segment D7F0:00FF = D7F0 segment
+ 7FFF offset + 00FF offset
_____ _____
= D7FFF total = D7FFF total
D700:0FFF = D700 segment D7FF:000F = D7FF segment
+ 0FFF offset + 000F offset
_____ _____
= D7FFF total = D7FFF total
As you can see in each case, although the segment and
offset differ slightly, the total ends up being the same.
Adding together the segment and offset numbers makes possible
even more combinations, as in the following examples:
D500:2FFF = D500 segment
+ 2FFF offset
_____
= D7FFF total
D6EE:111F = D6EE segment
+ 111F offset
_____
= D7FFF total
As you can see, several combinations are possible. The
correct and generally accepted way to write this address as a
linear address is D7FFF, whereas most would write the
segment:offset address as D000:7FFF. Keeping the segment
mostly zeros makes the segment:offset relationship easier to
understand and the number easier to comprehend. If you
understand the segment:offset relationship to the linear
address, you know why when a linear address number is
discussed it is five digits, whereas a segment number is only
four.
Another important concept with newer 32-bit operating
systems is their capability to map RAM from adapter cards into
system memory using linear addressing. There is no 64K limit
to the amount of memory that can be mapped here, as there is
in the UMA.
Video RAM
Memory
A video adapter installed in your system uses some of your
system's memory to hold graphics or character information for
display. Some adapters, like the VGA, also have on-board BIOS
mapped into the system's space reserved for such types of
adapters. Generally, the higher the resolution and color
capabilities of the video adapter, the more system memory the
video adapter uses. It is important to note that most VGA or
Super VGA adapters have additional on-board memory used to
handle the information currently displayed on-screen and to
speed screen refresh.
See "Video
Memory,"
In the standard system-memory map, a total of 128K is
reserved for use by the video card to store currently
displayed information. The reserved video memory is located in
segments A000 and B000. The video adapter ROM uses additional
upper memory space in segment C000.
The location of video adapter RAM is responsible for the
640K DOS conventional memory barrier. DOS can use all
available contiguous memory in the first megabyte of memory
until the video adapter RAM is encountered. The use of
adapters such as the MDA and CGA allows DOS access to more
than 640K of system memory. The video memory wall
begins at A0000 for the EGA, MCGA, and VGA systems, but the
MDA and CGA do not use as much video RAM, which leaves some
space that can be used by DOS and programs. The previous
segment and offset examples show that the MDA adapter enables
DOS to use an additional 64K of memory (all of segment A000),
bringing the total for DOS program space to 704K. Similarly,
the CGA enables a total of 736K of possible contiguous memory.
The EGA, VGA, or MCGA is limited to the normal maximum of 640K
of contiguous memory because of the larger amount used by
video RAM. The maximum DOS-program memory workspace,
therefore, depends on which video adapter is installed. Table
7.1 shows the maximum amount of memory available to DOS using
the referenced video card.
Table 7.1 DOS Memory
Limitations Based on Video Adapter Type
Video Adapter Type |
Maximum DOS Memory |
Monochrome Display Adapter (MDA) |
704K |
Color Graphics Adapter (CGA) |
736K |
Enhanced Graphics Adapter (EGA) |
640K |
Video Graphics Array (VGA) |
640K |
Super VGA (SVGA) |
640K |
eXtended Graphics Array (XGA) |
640K |
Using this memory to 736K might be possible depending on
the video adapter, the types of memory boards installed, ROM
programs on the motherboard, and the type of system. You can
use some of this memory if your system has a 386 or higher
processor. With memory manager software, such as EMM386 that
comes with DOS, which can operate the 386+ Memory Management
Unit (MMU), you can remap extended memory into this space.
The following sections examine how standard video adapters
use the system's memory. Figures show where in a system the
monochrome, EGA, VGA, and IBM PS/2 adapters use memory. This
map is important because it may be possible to recognize some
of this as unused in some systems, which may free up more
space for software drivers to be loaded.
Monochrome Display Adapter Memory
(MDA)
Figure 7.2 shows where the original Monochrome Display
Adapter (MDA) uses the system's memory. This adapter uses only
a 4K portion of the reserved video RAM from B0000-B0FFF.
Because the ROM code used to operate this adapter is actually
a portion of the motherboard ROM, no additional ROM space is
used in segment C000. . = Empty Addresses
M = Original Monochrome Adapter RAM
m = Additional Memory used in VGA Monochrome Text Mode
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0A0000: ................................................................
0B0000: MMMMmmmmmmmmmmmmmmmmmmmmmmmmmmmm................................
FIG. 7.2 The Monochrome Display
Adapter memory map.
Note that although the original Monochrome Display Adapter
only used 4K of memory starting at B0000, a VGA adapter
running in Monochrome emulation mode (Mono Text Mode)
activates 32K of RAM at this address. A true Monochrome
Display Adapter has no on-board BIOS, and instead is operated
by driver programs found in the primary motherboard BIOS.
Color Graphics Adapter (CGA)
Memory
Figure 7.3 shows where the Color Graphics Adapter (CGA)
uses the system's memory. The CGA uses a 16K portion of the
reserved video RAM from B8000-BBFFF. Because the ROM code used
to operate this adapter is a portion of the motherboard ROM,
no additional ROM space is used in segment C000. . = Empty Addresses
C = Original Color Graphics Adapter (CGA) RAM
c = Additional Memory used in VGA Color Text Mode
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0A0000: ................................................................
0B0000: ................................CCCCCCCCCCCCCCCCcccccccccccccccc
FIG. 7.3 The Color Graphics Adapter
(CGA) memory map.
The CGA card leaves memory from A0000-B7FFF free, which can
be used by memory managers for additional DOS memory space.
However, this precludes using any graphics mode software such
as Windows. The original CGA card only used 16K of space
starting at B8000, whereas a VGA adapter running in CGA
emulation (Color Text) mode can activate 32K of RAM at this
address. The original CGA card has no on-board BIOS and is
instead operated by driver programs found in the primary
motherboard BIOS.
Enhanced Graphics Adapter (EGA)
Memory
Figure 7.4 shows where the Enhanced Graphics Adapter (EGA)
uses the system's memory. This adapter uses all 128K of the
video RAM from A0000-BFFFF. The ROM code used to operate this
adapter is on the adapter itself and consumes 16K of memory
from C0000-C3FFF. . = Empty Addresses
G = Enhanced Graphics Adapter (EGA) Graphics Mode Video RAM
M = EGA Monochrome Text Mode Video RAM
C = EGA Color Text Mode Video RAM
V = Standard EGA Video ROM BIOS
R = Standard Motherboard ROM BIOS
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0A0000: GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
0B0000: MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0C0000: VVVVVVVVVVVVVVVV................................................
0D0000: ................................................................
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0E0000: ................................................................
0F0000: RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
FIG. 7.4 The Enhanced Graphics Adapter
(EGA) memory map.
The original IBM EGA card only used 16K of ROM space at
C0000. Aftermarket compatible EGA adapters can use additional
ROM space up to 32K total. The most interesting thing to note
about EGA (and this applies to VGA adapters as well) is that
segments A000 and B000 are not all used at all times. For
example, if the card is in a graphics mode, only segment A000
would appear to have RAM installed, whereas segment B000 would
appear completely empty. If you switched the mode of the
adapter (through software) into Color Text mode, segment A000
would instantly appear empty, and the last half of segment
B000 would suddenly "blink on." The monochrome text mode RAM
area would practically never be used on a modern system,
because little or no software would ever need to switch the
adapter into that mode. Figure 7.4 also shows the standard
mother-board ROM BIOS as well so that you can get a picture of
the entire UMA.
The EGA card became somewhat popular after it appeared, but
this was quickly overshadowed by the VGA card that followed.
Most of the VGA characteristics with regard to memory are the
same as the EGA because the VGA is backward-compatible with
EGA.
Video Graphics Array (VGA)
Memory
All VGA-compatible cards, including Super VGA cards, are
almost identical to the EGA in terms of memory use. Just as
with the EGA, they use all 128K of the video RAM from
A0000-BFFFF, but not all at once. Again, the video RAM area is
split into three distinct regions, and each of these regions
is used only when the adapter is in the corresponding mode.
One minor difference with the EGA cards is that virtually all
VGA cards use the full 32K allotted to them for on-board ROM
(C0000 to C7FFF). Figure 7.5 shows the VGA adapter memory
map. . = Empty Addresses
G = Video Graphics Array (VGA) Adapter Graphics Mode Video RAM
M = VGA Monochrome Text Mode Video RAM
C = VGA Color Text Mode Video RAM
V = Standard VGA Video ROM BIOS
R = Standard Motherboard ROM BIOS
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0A0000: GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
0B0000: MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0C0000: VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV................................
0D0000: ................................................................
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0E0000: ................................................................
0F0000: RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
FIG. 7.5 The VGA (and Super VGA)
adapter memory map.
You can see that the typical VGA card uses a full 32K of
space for the on-board ROM containing driver code. Some VGA
cards may use slightly less, but this is rare. Just as with
the EGA card, the video RAM areas are only active when the
adapter is in the particular mode designated. In other words,
when a VGA adapter is in graphics mode, only segment A000 is
used; and when it is in color text mode, only the last half of
segment B000 is used. Because the VGA adapter is almost never
run in monochrome text mode, the first half of segment B000
remains unused (B0000-B7FFF). Figure 7.5 also shows the
standard motherboard ROM BIOS so that you can get a picture of
how the entire UMA is laid out with this adapter.
Systems that use the LPX (Low Profile) motherboard design
in an LPX- or Slimline-type case incorporate the video adapter
into the motherboard. In these systems, even though the video
BIOS and motherboard BIOS may be from the same manufacturer,
they are always set up to emulate a standard VGA-type adapter
card. In other words, the video BIOS appears in the first 32K
of segment C000 just as if a stand-alone VGA-type card were
plugged into a slot. The built-in video circuit in these
systems can be easily disabled via a switch or jumper, which
then allows a conventional VGA-type card to be plugged in. By
having the built-in VGA act exactly as if it were a separate
card, disabling it allows a new adapter to be installed
without the compatibility problems that might arise if the
video drivers had been incorporated into the motherboard
BIOS.
If you were involved with the PC industry in 1987, you
might remember how long it took for clone video card
manufacturers to accurately copy the IBM VGA circuits. It took
nearly two years (almost until 1989) before you could buy an
aftermarket VGA card and expect it to run everything an IBM
VGA system would with no problems. Some of my associates who
bought some of the early cards inadvertently became members of
the video card manufacturer's "ROM of the week" club! They
were constantly finding problems with the operation of these
cards, and many updated and patched ROMs were sent to try to
fix the problems. Not wanting to pay for the privilege of beta
testing the latest attempts at VGA compatibility, I bit the
bullet and took the easy way out. I bought the IBM VGA card
(PS/2 Display Adapter) for $595. That is still about as much
as you would pay for the best Local Bus Super VGA cards on the
market today.
Although the card worked very well, and although I never
did find any compatibility problems, I did later run into some
interesting problems with the memory use of this card. This
was my first introduction to what I call scratch pad
memory use by an adapter. I found that many different
types of adapters may use some areas in the UMA for mapping
scratch pad memory. This refers to memory on the card that
stores status information, configuration data, or any other
temporary type of information of a variable nature. Most cards
keep this scratch pad memory to themselves and do not attempt
to map it into the processor's address space. But some cards
do place this type of memory in the address space so that the
driver programs for the card can use it. Figure 7.6 shows the
memory map of the IBM PS/2 Display Adapter (IBM's VGA
card).
There is no difference between this VGA card and any other
with respect to the Video RAM area. What is different is that
the ROM code that operates this adapter only consumes 24K of
memory from C0000-C5FFF. Also strange is the 2K "hole" at
C6000, and the 6K of scratch pad memory starting at C6800, as
well as the additional 2K of scratch pad memory at CA000. In
particular, the 2K "straggler" area really caught me off guard
when I installed a SCSI host adapter in this system that had a
16K on-board BIOS with a default starting address of C8000. I
immediately ran into a conflict that completely disabled the
system. In fact, it would not boot, had no display at all, and
could only beep out error codes that indicated that the video
card had failed. I first thought that I had somehow "fried"
the card, but removing the new SCSI adapter made everything
function normally. I also could get the system to work with
the SCSI adapter and an old CGA card substituted for the VGA
card, so I immediately knew a conflict was underfoot. This
scratch pad memory use was not documented clearly in the
technical-reference information for the adapter, so it was
something that I had to find out by trial and error. If you
have ever had the IBM VGA card and had conflicts with other
adapters, now you know why! . = Empty Addresses
G = Video Graphics Array (VGA) Adapter Graphics Mode Video RAM
M = VGA Monochrome Text Mode Video RAM
C = VGA Color Text Mode Video RAM
V = IBM VGA Video ROM BIOS
v = IBM VGA Scratch Pad memory (used by the card)
R = Standard Motherboard ROM BIOS
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0A0000: GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
0B0000: MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0C0000: VVVVVVVVVVVVVVVVVVVVVVVV..vvvvvv........vv......................
0D0000: ................................................................
: 0---1---2---3---4---5---6---7---8---9---
-A---B---C---D---E---F---
0E0000: ................................................................
0F0000: RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
FIG. 7.6 IBM's ISA-bus VGA card (PS/2
Display Adapter) memory map.
Needless to say, nothing could be done about this 2K of
scratch pad memory hanging out there. I had to work around it
as long as I had this card in the system. I solved my SCSI
adapter problem by merely moving the SCSI adapter BIOS to a
different address.
NOTE: I have seen other VGA-type video adapters use
scratch pad memory, but they have all kept it within the
C0000-C7FFF 32K region allotted normally for the video ROM
BIOS. By using a 24K BIOS, I have seen other cards with up
to 8K of scratch pad area, but none--except for IBM's--in
which the scratch pad memory goes beyond C8000.
Adapter ROM and Special Purpose RAM
Memory
The second 128K of upper memory beginning at segment C000
is reserved for the software programs, or BIOS (basic
input/output system), on the adapter boards plugged into the
system slots. These BIOS programs are stored on special chips
known as read-only memory (ROM), which have fused circuits so
that the PC cannot alter them. ROM is useful for permanent
programs that always must be present while the system is
running. Graphics boards, hard disk controllers,
communications boards, and expanded memory boards, for
example, are adapter boards that might use some of this
memory. On systems based on the 386 CPU chip or higher, memory
managers like the MS DOS 6 MEMMAKER, IBM DOS RAMBOOST, or
aftermarket programs like QEMM by Quarterdeck, can load device
drivers and memory-resident programs into unused regions in
the UMA.
To actually move the RAM usage on any given adapter
requires that you consult the documentation for the card. Most
older cards require that specific switches or jumpers be
changed, and the settings will probably not be obvious without
the manual. Most newer cards, especially those that are Plug
and Play, allow these settings to be changed by software that
either comes with the card itself, or the Configuration
Manager program that goes with some of the newer operating
systems like Windows 95 or OS/2.
Video Adapter
BIOS
The video adapter BIOS handles communication between the
video chipset and the video RAM. Although 128K of upper memory
beginning at segment C000 is reserved for use by the video
adapter BIOS, not all this space is used by various video
adapters commonly found on PCs. Table 7.2 details the amount
of space used by the BIOS on each type of common video adapter
card.
Table 7.2 Memory Used by
Different Video Cards
Type of Adapter |
Adapter BIOS Memory Used |
Monochrome Display Adapter (MDA) |
None - Drivers in Motherboard BIOS |
Color Graphics Adapter (CGA) |
None - Drivers in Motherboard BIOS |
Enhanced Graphics Adapter (EGA) |
16K on-board (C0000-C3FFF) |
Video Graphics Array (VGA) |
32K on-board (C0000-C7FFF) |
Super VGA (SVGA) |
32K on-board
(C0000-C7FFF) |
Some more advanced graphics accelerator cards on the market
do use most or all of the 128K of upper memory beginning at
segment C000 to speed the repainting of graphics displays in
Windows, OS/2, or other graphical user interfaces (GUIs). In
addition, these graphics cards may contain up to 4M or more of
on-board memory in which to store currently displayed data and
more quickly fetch new screen data as it is sent to the
display by the CPU.
Hard Disk Controller and SCSI Host
Adapter BIOS
The upper memory addresses C0000 to DFFFF also are used for
the BIOS contained on many hard drive controllers. Table 7.3
details the amount of memory and the addresses commonly used
by the BIOS contained on hard drive adapter cards.
Table 7.3 Memory Addresses
Used by Different Hard Drive Adapter Cards
Disk Adapter Type |
On-Board BIOS Size |
BIOS Address Range |
IBM XT 10M Controller |
8K |
C8000-C9FFF |
IBM XT 20M Controller |
4K |
C8000-C8FFF |
Most XT Compatible Controllers |
8K |
C8000-C9FFF |
Most AT Controllers |
None |
Drivers in Motherboard BIOS |
Most IDE Adapters |
None |
Drivers in Motherboard BIOS |
Most ESDI Controllers |
16K |
C8000-CBFFF |
Most SCSI Host Adapters |
16K |
C8000-CBFFF |
The hard drive or SCSI adapter card used on a particular
system may use a different amount of memory, but it is most
likely to use the memory segment beginning at C800 because
this address is considered part of the IBM standard for
personal computers. Virtually all the disk controller or SCSI
adapters today that have an on-board BIOS allow the BIOS
starting address to be easily moved in the C000 and D000
segments. The locations listed in Table 7.3 are only the
default addresses that most of these cards use. If the default
address is already in use by another card, you have to consult
the documentation for the new card to see how to change the
BIOS starting address to avoid any conflicts.
Figure 7.7 shows an example memory map for an Adaptec
AHA-1542CF SCSI adapter. . = Empty Addresses
G = Video Graphics Array (VGA) Adapter Graphics Mode Video RAM
M = VGA Monochrome Text Mode Video RAM
C = VGA Color Text Mode Video RAM
V = Standard VGA Video ROM BIOS
S = SCSI Host Adapter ROM BIOS
R = Standard Motherboard ROM BIOS
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0A0000: GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
0B0000: MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0C0000: VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV................................
0D0000: ................................................SSSSSSSSSSSSSSSS
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0E0000: ................................................................
0F0000: RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
FIG. 7.7 Adaptec AHA-1542CF SCSI
adapter default memory use.
Note how this SCSI adapter fits in here. Although no
conflicts are in the UMA memory, the free regions have been
fragmented by the placement of the SCSI BIOS. Because most
systems do not have any BIOS in segment E000, that remains as
a free 64K region. With no other adapters using memory, this
example shows another free UMB (Upper Memory Block) starting
at C8000 and continuing through DBFFF, which represents an 80K
free region. Using the EMM386 driver that comes with DOS,
memory can be mapped into these two regions for loading
memory-resident drivers and programs. Unfortunately, because
programs cannot be split across regions, the largest program
you could load is 80K, which is the size of the largest free
region. It would be much better if you could move the SCSI
adapter BIOS so that it is next to the VGA BIOS, as this would
bring the free UMB space to a single region of 144K. It is
much easier and more efficient to use a single 144K region
than two regions of 80K and 64K, respectively.
Fortunately, it is possible to move this particular SCSI
adapter, although doing so requires that several switches be
reset on the card itself. One great thing about this Adaptec
card is that a sticker is placed directly on the card
detailing all the switch settings, or the settings are
screened into the card! This means that you don't have to go
hunting for a manual that may not be nearby. More adapter card
manufacturers should place this information right on the
card.
After changing the appropriate switches to move the SCSI
adapter BIOS to start at C8000, the optimized map would look
like Figure 7.8. . = Empty Addresses
G = Video Graphics Array (VGA) Adapter Graphics Mode Video RAM
M = VGA Monochrome Text Mode Video RAM
C = VGA Color Text Mode Video RAM
V = Standard VGA Video ROM BIOS
S = SCSI Host Adapter ROM BIOS
R = Standard Motherboard ROM BIOS
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0A0000: GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
0B0000: MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0C0000: VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVSSSSSSSSSSSSSSSS................
0D0000: ................................................................
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0E0000: ................................................................
0F0000: RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
FIG. 7.8 Adaptec AHA-1542CF SCSI
adapter with optimized memory use. Notice how the free space
is now a single contiguous block of 144K.
This represents a far more optimum setup than the default
settings.
Network
Adapters
Network adapter cards also can use upper memory in segments
C000 and D000. The exact amount of memory used and the
starting address for each network card varies with the type
and manufacturer of the card. Some network cards do not use
any memory at all. A network card might have two primary uses
for memory. They are as follows:
- IPL (Initial Program Load or Boot) ROM
- Shared Memory (RAM)
An IPL ROM is usually an 8K ROM that contains a
bootstrap loader program that allows the system to boot
directly from a file server on the network. This allows the
removal of all disk drives from the PC, creating a diskless
workstation. Because no floppy or hard disk would be in the
system to boot from, the IPL ROM gives the system the
instructions necessary to locate an image of the operating
system on the file server and load it as if it were on an
internal drive. If you are not using your system as a diskless
workstation, it would be beneficial to disable any IPL ROM or
IPL ROM Socket on the adapter card. Note that many network
adapters do not allow this socket to be disabled, which means
that you lose the 8K of address space for other hardware even
if the ROM chip is removed from the socket!
Shared memory refers to a small portion of RAM
contained on the network card that is mapped into the PC's
Upper Memory Area. This region is used as a memory window onto
the network and offers very fast data transfer from the
network card to the system. IBM pioneered the use of shared
memory for its first Token-Ring Network adapters, and now
shared memory is in common use among other companies' network
adapters today. Shared memory was first devised by IBM because
they found that transfers using the DMA channels were not fast
enough in most systems. This had mainly to do with some quirks
in the DMA controller and bus design, which especially
affected 16-bit ISA bus systems. Network adapters that do not
use shared memory will either use DMA or Programmed I/O (PIO)
transfers to move data to and from the network adapter.
Although shared memory is faster than either DMA or PIO for
ISA systems, it does require 16K of UMA space to work. Most
standard performance network adapters use PIO because this
makes them easier to configure, and they require no free UMA
space, whereas most high performance adapters will use shared
memory. The shared memory region on most network adapters that
use one is usually 16K in size and may be located at any
user-selected 4K increment of memory in segments C000 or
D000.
Figure 7.9 shows the default memory addresses for the IPL
ROM and shared memory of an IBM Token-Ring Network adapter,
although other network adapters such as Ethernet adapters
would be similar. . = Empty Addresses
G = Video Graphics Array (VGA) Adapter Graphics Mode Video RAM
M = VGA Monochrome Text Mode Video RAM
C = VGA Color Text Mode Video RAM
V = Standard VGA Video ROM BIOS
I = Token Ring Network Adapter IPL ROM
N = Token Ring Network Adapter Shared RAM
R = Standard Motherboard ROM BIOS
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0A0000: GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
0B0000: MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0C0000: VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV................IIIIIIII........
0D0000: ................................NNNNNNNNNNNNNNNN................
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0E0000: ................................................................
0F0000: RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
FIG. 7.9 Network adapter default memory
map.
I have also included the standard VGA video BIOS in Figure
7.9 because nearly every system would have a VGA-type video
adapter as well. Note that these default addresses for the IPL
ROM and the shared memory can easily be changed by
reconfiguring the adapter. Most other network adapters are
similar in that they also would have an IPL ROM and a shared
memory address, although the sizes of these areas and the
default addresses may be different. Most network adapters that
incorporate an IPL ROM option can disable the ROM and socket
such that those addresses are not needed at all. This helps to
conserve UMA space and prevent possible future conflicts if
you are never going to use the function.
Notice in this case that the SCSI adapter used in Figure
7.9 would fit both at its default BIOS address of DC000, as
well as the optimum address of C8000. The Token-Ring shared
memory location is not optimum and causes the UMB space to be
fragmented. By adjusting the location of the shared memory,
this setup can be greatly improved. Figure 7.10 shows an
optimum setup with both the Token-Ring adapter and the SCSI
adapter in the same machine. . = Empty Addresses
G = Video Graphics Array (VGA) Adapter Graphics Mode Video RAM
M = VGA Monochrome Text Mode Video RAM
C = VGA Color Text Mode Video RAM
V = Standard VGA Video ROM BIOS
S = SCSI Host Adapter ROM BIOS
I = Token Ring Network Adapter IPL ROM
N = Token Ring Network Adapter Shared RAM
R = Standard Motherboard ROM BIOS
: 0---1---2---3---4---5---6---7---8---9---A---B---C---D---E---F---
0A0000: GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
0B0000: MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMCCCCCCCC |