home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 24 DOS
/
24-DOS.zip
/
doswitip.zip
/
REGIONS.TXT
< prev
next >
Wrap
Text File
|
2002-05-07
|
33KB
|
690 lines
AXCEL216's MAX Speeed
PC Memory Types, Architecture, Regions + Mapping
NOTES: - For memory management guide + optimization tips *READ* MEMORY.TXT
(included).
- For DOS + Windows extended + expanded memory managers technical
details see EMM386.TXT (included).
- For abbreviations + terms explanations see GLOSSARY.TXT (included).
- For Microsoft EMM386.EXE + HIMEM.SYS undocumented parameters see
related topics in SECRETS.TXT (included).
CREDITS: - "PC MEMORY TYPES + ARCHITECTURE" chapter is based in part on
Raymond Dunn's public domain USENET article [EXT-RAM.TXT, 5 KB]:
http://wcarchive.cdrom.com/pub/simtelnet/msdos/info/ext_ram.zip
and includes current PC memory specifications + technology updates.
- "MS-DOS UPPER MEMORY REGIONS + MAPPING" chapter appears courtesy of
Dale F. Ogden, computer programmer.
REGIONS.TXT Contents:
I. PC MEMORY TYPES + ARCHITECTURE:
1. Measure Your Memory
2. Conventional Memory [below the 1st MegaByte]
3. Extended and Expanded Memory [above the 1st MegaByte]:
A. Extended Memory = XMS ["long memory"]
B. Expanded Memory = EMS ["fat memory"]
II. MS-DOS UPPER MEMORY REGIONS + MAPPING
III. AXCEL216's ADDENDUM ON UPPER MEMORY REGIONS MANAGEMENT
PC memory resources on the Internet:
- PC Guide: Logical Memory Layout:
http://www.pcguide.com/ref/ram/logic.htm
- MSKB: Memory Management in MS-DOS:
http://support.microsoft.com/support/kb/articles/q95/5/55.asp
- MSKB: A General Tutorial on the Various Forms of Memory:
http://support.microsoft.com/support/kb/articles/q37/2/42.asp
- MSKB: How to Increase Conventional Memory for MS-DOS-Based Programs:
http://support.microsoft.com/support/kb/articles/q134/3/99.asp
- MSKB: Optimizing Your Use of Upper Memory Blocks:
http://support.microsoft.com/support/kb/articles/q77/0/83.asp
- MS TechNet: MS-DOS Memory Management:
http://www.microsoft.com/technet/archive/msdos/05_memry.asp
- ZDNet: PC Memory Tutorial:
http://cma.zdnet.com/book/upgraderepair/ch07/ch07.htm
- X86 CPU Modes + Memory:
http://pure.l33t3.de/deinmeister/x86modes.htm
- PC Forrest Windows 95/98 CONFIG.SYS, Memory + Commands:
http://www.forrestandassociates.co.uk/pcforrest/config_sys.html
- My DOS7 [a.k.a. Windows 95/98] MEMory Specs:
http://members.aol.com/axcel216/mem7.htm
- My DOS6 [+ WfWG 3.1x] MEMory Specs:
http://members.aol.com/axcel216/mem6.htm
- My DOS7 [a.k.a. Windows 95/98] CONFIG.SYS settings:
http://members.aol.com/axcel216/bench.htm#CON
- My DOS7 [a.k.a. Windows 95/98] AUTOEXEC.BAT settings:
http://members.aol.com/axcel216/bench.htm#AUT
______________________________________________________________________________
I. PC MEMORY TYPES + ARCHITECTURE
1. Measure Your Memory
Computer memory is measured in Bytes (Binary octets, abbreviated as B). Each
Byte contains 8 bits. The bit (binary digit, abbreviated as b) is the basic
unit of digital data/information, and can be either 0 or 1.
Computer data (like memory amount or disk storage capacity) is measured using
the hexadecimal system (base of 16).
Multiples for Byte [powers of 2, mod(1024)]:
- 1 KiloByte (KB) = 1,024 Bytes (2^10 Bytes).
- 1 MegaByte (MB) = 1,024 KB = 1,048,576 B (2^20 Bytes).
- 1 GigaByte (GB) = 1,024 MB = 1,048,576 KB = 1,073,741,824 B (2^30 Bytes).
- 1 TeraByte (TB) = 1,024 GB = 1,048,576 MB = 1,073,741,824 KB = etc... (2^40
Bytes).
FYI: Do not confuse this with the bit (used for example in internet, modem and
networking communications transfer rates/throughput), which is measured using
the decimal system (base of 10).
Multiples for bit [powers of 10, mod(1000)]:
- 1 kilobit (kb) = 1,000 bits (10^3 bits).
- 1 megabit (mb) = 1,000 kb = 1,000,000 b (10^6 bits).
- 1 gigabit (gb) = 1,000 mb = 1,000,000 kb = 1,000,000,000 b (10^9 bits).
- 1 terabit (tb) = 1,000 gb = 1,000,000 mb = etc... (10^12 bits).
Memory addresses and ranges use the hexadecimal (hex) notation: numbers 0 to 9
and letters A to F, allowing 16 possible values for each hex digit.
Computers translate data using the binary numbering system, because they
understand only ones (1) and zeroes (0).
This translation table shows the correspondence among the three numbering
systems used in computing language:
Decimal (base 10) Binary (base 2) Hexadecimal (base 16)
---------------------------------------------------------------------
00 0000 0
01 0001 1
02 0010 2
03 0011 3
04 0100 4
05 0101 5
06 0110 6
07 0111 7
08 1000 8
09 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
More info:
- Bits, Bytes + Bandwidth:
http://www.speedguide.net/Cable_modems/bandwidth.shtml
- Binary System:
http://www.wugnet.com/tips/99/4-16/
- Hexadecimal System:
http://www.wugnet.com/tips/99/6-4/
- Binary System:
http://www.pcnineoneone.com/howto/binary1.html
- Hexadecimal System:
http://www.pcnineoneone.com/howto/hex1.html
2. Conventional Memory [below the 1st MegaByte]
MS-DOS (MicroSoft Disk Operating System) was designed around the original 8088
Intel CPU which was [and still is :(] able to address only up to 1 MegaByte
(MB) of memory (RAM), called "Conventional memory" (sometimes incorrectly
referred to as "Low memory"), and located between 0K and 1M [1 MB = 64 pages].
This space is divided into two major blocks:
- 0K - 640K [640 KB = 40 pages] = "Low (DOS) RAM", used by software: MS-DOS
core, system, I/O, programs, devices, drivers, TSRs etc.
- 640K - 1M [384 KB = 24 pages] = "High RAM", used by hardware: ROM, BIOS Data
Area (BDA), Extended BIOS Data Area (EBDA), Video (VGA) Controller ROM/BIOS,
Hard Disk Controller (HDC), Floppy Disk Controller (FDC) etc.
Conventional memory is divided into 64 pages of 16K each, referred to as page
0, page 1, page 2... and so on, or by their hexadecimal segment addresses:
page 0 at segment 0, page 1 at segment 0400, page 2 at segment 0800... etc.
Examples of page numbers with corresponding starting segments and linear
addresses:
Page Segment Address Linear Address
----------------------------------------------
0 0000 0K
1 0400 16K
2 0800 32K
4 1000 64K
8 2000 128K
12 3000 196K
40 A000 640K
63 FC00 1008K
1st MegaByte memory map [0000 - FFFF = 1M] usage on a typical X86 PC:
Address Range Used by Size
----------------------------------------------
0000 - 0FFF Low DOS RAM 640 KB
A000 - AFFF VGA graphics 64 KB
B000 - B7FF Monochrome video 32 KB
B800 - BFFF VGA text 32 KB
C000 - C7FF Video and HDC ROM 32 KB
C800 - CFFF Available to DOS 32 KB
D000 - DFFF EMS page frame 64 KB
E000 - EFFF Available to DOS 64 KB
F000 - FFFF BIOS and FDC ROM 64 KB
Microsoft provides two "real mode" (DOS based, 16-bit) programs to visualize
your computer's memory "innards":
- MEM.EXE = MEMory viewer;
- MSD.EXE = MicroSoft Diagnostics,
bundled with all MS-DOS 6.xx and Windows 3.xx/95/98/ME releases.
A 32-bit (console based) version of MEM.EXE is included with all Windows
NT/2000/XP/.Net builds.
These two DOS memory tools are used in examples below:
- To see a graphical map of all modules/programs/drivers using the memory
below the 1st MegaByte, their sizes, the free memory status with specific hex
address locations and the available memory blocks, run:
MSD
and press M to bring up the Memory screen.
MSD works also from a Windows NT/2000/XP/.Net command prompt.
- To see a detailed list of all modules/drivers using the memory below the 1st
MegaByte, their sizes and the free memory status with specific hex address
locations, run:
MEM/A/D/P
- To see a classified list of all programs/drivers using the memory below the
1st MegaByte, their sizes, the free memory summary and the available memory
blocks, run:
MEM/A/C/P
These commands can be executed either from native/real MS-DOS mode or in a DOS
box/session started from within MS Windows 3.xx/95/98/ME GUI.
The undocumented "MEM /A" command line parameter is explained in "MEM.EXE
HIDDEN PARAMETERS" in SECRETS.TXT (included).
Some of these switches are not available to MEM.EXE in Windows
NT/2000/XP/.Net.
For more details take a look at:
* These MSD (MicroSoft Diagnostics utility) reports in:
- MSD95.TXT (part of W95-11D.ZIP) = Win95/98/ME + DOS 7/8 users.
- MSD62.TXT (part of W31-11D.ZIP) = Win31 + DOS6 users.
* These "MEM/A/C/P" stats in:
- DOS95MEM.TXT + WIN95MEM.TXT (both part of W95-11D.ZIP) = Win95/98/ME + DOS
7/8 users.
- MEM62.TXT + MEM31.TXT (both part of W31-11D.ZIP) = Win31 + DOS6 users.
To comply with the industry standard IBM PC/AT architecture, this memory is
organized as follows:
1M +---------------+ 0xFFFF \ \
| System BIOS | | |
| ROM and | | |
| FDC ROM | | |
960K +---------------+ 0xF000 | |
| Option ROM, | | |
| PnP BIOS ROM | | |
| & Option RAM | | |
816K +---------------+ 0xCC00 | High RAM |
| HDC BIOS RAM | | 384 KB |
800K +---------------+ 0xC800 | [640K - 1M] |
| Video BIOS | | A000 - FFFF |
| ROM, Option | | | Conventional RAM
| ROM and RAM | | | 1 MB
768K +---------------+ 0xC000 | | [0K - 1M]
| Video RAM: | | | 0000 - FFFF
| VGA color | | |
| and | | |
| monochrome | / |
640K +---------------+ 0xA000 \ |
| | | |
| Base | | |
| System | | Low (DOS) RAM |
| RAM | | 640 KB |
| | | [0K - 640K] |
1K +---------------+ 0x0100 | 0000 - 0FFF |
| IV and BDA | | |
0K +---------------+ 0x0000 / /
MS-DOS Conventional memory map from 0 KiloBytes up to 1 MegaByte [1 MB]:
Module Name and Usage Range Size
--------------------------------------------------------------------------------------
* Low (DOS) RAM: 0K - 640K 640 KB
- Interrupt Vectors (IV) and BIOS Data Area (BDA) 0K - 1K 1 KB
- Base System RAM 1K - 640K 639 KB
* High RAM: 640K - 1M 384 KB
- Video RAM (VGA color and monochrome) 640K - 768K 128 KB
- Video BIOS ROM, Option ROM and Option RAM 768K - 800K 32 KB
- Hard Drive Controller (HDC) BIOS RAM 800K - 816K 16 KB
- Option ROM, Plug-and-Play (PnP) BIOS ROM and Option RAM 816K - 960K 144 KB
- System BIOS ROM and Floppy Drive Controller (FDC) ROM 960K - 1M 64 KB
* TOTAL Conventional RAM 0K - 1M 1 MB
The physical RAM below 640K is used by MS-DOS as its resource, mapped as shown
above.
Some of the memory above 640K is used for Video RAM, because various video
types (CGA, EGA, MGA, PGA, 8514, VGA) have different requirements, sizes and
starting/ending addresses, depending also on video controller bus types (ISA,
VLB, PCI, AGP) and chipset brand/model (3dfx, 3Dlabs, ATI, Cirrus, Diamond,
Matrox, Number Nine, NVidia, Oak Technology, PowerVR, S3, Trident, Tseng Labs
etc).
But MS-DOS can map the unused "chunks" of remaining RAM immediately above the
640K barrier [the 384 KB "High RAM" area, which is not the same as the "High
Memory Area" (HMA), discussed further below], if the BIOS "tells" it to at
boot time. That's why this region is also called the "Upper Memory Area"
(UMA), and can be used to load programs, drivers, TSRs (Terminate and Stay
Resident programs), and even parts of DOS itself "high", thus freeing more
Conventional memory. This is possible by mapping the Upper Memory Blocks
(UMBs) into usable RAM, by upper/extended/expanded memory managers, like the
Microsoft HIMEM.SYS and EMM386.EXE "combo" (bundled with all Microsoft
OSes/Environments), which load from CONFIG.SYS or IO.SYS (MS-DOS 5.0/6.xx and
Windows 95/98/ME), CONFIG.NT or NTIO.SYS (Windows NT/2000/XP/.Net) at bootup.
MS-DOS allocates UMBs through XMS services using Interrupt 21h, only if this
line is present in CONFIG.SYS (CONFIG.NT):
DOS=UMB
Similar (3rd party) upper memory mappers like Uwe Sieber's UMBPCI.SYS and/or
HIRAM.EXE (which only map and enable unused Shadow RAM as UMA using HIMEM.SYS,
chipset specific), or upper/extended/expanded "enhanced" memory managers (most
of which don't need HIMEM.SYS to enable the UMA) like Symantec (Quarterdeck)
QEMM386.SYS, Network Associates (Helix) NetRoom RM386.EXE, Qualitas (IBM)
386MAX.SYS, Lineo (Caldera) DR-DOS EMM386.EXE etc can also map available UMBs
into usable memory.
3. Extended and Expanded Memory [above the 1st MegaByte]
A. Extended Memory = XMS ["long memory"]
Extended memory is an intrinsic part of the Intel CPU (X86) architecture. It
is addressed directly in the CPU memory address space, above the 1st MegaByte
[10000 -> top of available RAM] on all IBM PC compatibles (clones).
MS-DOS [still :(] assumes that it runs on an 8088 CPU, and can thus only
address the first 1 MegaByte [1024 KiloBytes] of memory space.
Newer CPUs starting with the 80286 are capable of addressing the memory above
the 1st Meg. Normally this memory canNOT be accessed by processors in "Real
Mode" (designed for compatibility with the old 8088), using a single-tasking
"Real Mode" Operating System, like Microsoft MS-DOS.
But newer DOS based programs and games are designed to use a "Protected Mode"
run-time environment ("DOS extender" using the DPMI interface: CWSDPMI.EXE or
DOS4GW.EXE "DPMI hosts") to access up to 32 MegaBytes of extended memory for
intensive graphics rendering (SVGA/XVGA modes), 3D textures and
video/animation playback. Examples: Eidos Tomb Raider, Lucas Arts Rebel
Assault + Rebel Assault II, 3D Realms Duke Nukem 3D.
Other programs like RAM disks (MS RAMDRIVE.SYS), print spoolers (MS
PRINT.EXE), disk caches (MS SMARTDRV.EXE), use a ROM BIOS feature (on newer
PCs that support it) that allows them to copy data between conventional and
extended memory. Although these programs cannot execute in extended memory,
they can use it as storage space.
To access the entire physical extended memory on X86 compatible PCs, software
programs need to perform in "Protected Mode" (also called "386 Enhanced Mode")
by loading special (virtual I/O: 386, DLL, DRV, VXD etc) drivers, thus
allowing multi-tasking, multi-threading and faster (32-bit or even 64-bit) I/O
transfers, like Microsoft Windows in all its newer incarnations starting with
Windows NT and 95.
Another processor mode is the "Virtual Real Mode", which allows "Real Mode"
DOS programs to execute from within a "Protected Mode" environment in a
confined (isolated) DOS session/box/window, by emulating a "Virtual Machine"
(VM), and used by "Protected Mode" OSes/Environments, like Microsoft Windows.
Extended memory can be used according to the XMS (eXtended Memory
Specification) 3.0 standard, defined jointly by Microsoft, Intel, Lotus and
AST, if mapped by an XMS device driver like HIMEM.SYS, provided with all
Microsoft OSes/Environments.
The XMS 3.0 standard allows the extended memory to be used by software
designed to take advantage of it:
- Terminate and Stay Resident (TSR) programs like DOS MOUSE Drivers;
- Extended Memory Specification (XMS) applications like MS Windows;
- XMS DOS games like 3D Realms Duke Nukem 3D;
- Static or dynamic RAM disks like MS RAMDRIVE.SYS;
- Disk caching software like MS SMARTDRV.EXE;
- Expanded Memory Specification (EMS) implementation like MS EMM386.EXE
enhanced upper/extended/expanded memory manager, which uses page mapping (on
80386 and newer X86 CPUs) to convert extended RAM into expanded, thus freeing
additional conventional memory for use by MS-DOS and DOS programs.
The first 64 KB (minus 16 Bytes) of contiguous extended (XMS) memory space
located above the 1st Meg [10000 - 10FFF] is referred to as the "High Memory
Area" (HMA), and is addressable within by MS-DOS as a result of the segmented
memory scheme used to allow X86 CPUs (80286 and newer) to address more than 64
KB of RAM.
HMA can be addressed in "Real Mode" (also called "80X86 emulation") on 80286
and newer CPUs if the A20 handler (the 21st Address Line) is active at boot
time.
IBM PC compatibles can turn the A20 line on and off by using the keyboard
port (hardware dependent). Some BIOSes include the "A20 Handler" ("Fast Gate")
setting, which needs to be set to Enabled (Fast), to activate A20 each time
the computer boots. BIOSes without this switch always turn on the A20 line.
Microsoft HIMEM.SYS high/extended memory manager can adapt the A20 handler to
different machine types. HIMEM.SYS machine default is type 1, used by the
majority of IBM compatible PC clones.
For more info:
- MS Windows 95/98/ME: open MSDOSDRV.TXT (located in your Windows folder) in
Notepad to read the HIMEM.SYS topic.
- MS-DOS 6.xx: run this DOS command:
HELP HIMEM.SYS
Begining with MS-DOS 5.00, a large portion of the MS-DOS resident module, DOS
BUFFERS or some DOS Mouse drivers can be stored in the HMA, only if enabled by
this CONFIG.SYS (CONFIG.NT) line:
DOS=HIGH
XMS allocates/deallocates HMA as a single block, which means it can be used
only by one program at a time. That's why MS-DOS canNOT load in the HMA if it
is already occupied by another resident program at bootup.
B. Expanded Memory = EMS ["fat memory"]
Expanded memory is defined within the architecture of the IBM PC/AT standard.
It is referred to as "Paged Memory", can be addressed through a Page Frame
within the first 1 MegaByte [1024 KiloBytes], and is thus accessible on all
80X86 compatible CPUs begining with the 8088.
The Lotus-Intel-Microsoft (LIM) 4.0 agreement is currently recognized as the
common Expanded Memory Specification (EMS) industry standard.
LIM 4.0 describes the following memory architecture:
PC (X86) MAIN MEMORY LIM EXPANDED MEMORY
16M/4T +---------------+
| Extended |
| Memory (XMS) |
. up to 16 MB . +---------------+ 32M
. on a 80286, . /| |
. 4 GB on a . // | |
. 80386/80486, . / / | |
. 4 TB on a . / / | |
| 80586/80686 | / / | |
| etc... | / / | |
1M +---------------+ / / | |
| High RAM |/ / | |
960K +---------------+ / | |
| High Page | / | |
| Frame: 12 | / | |
| 16K Physical | / | |
| Pages | / . Expanded .
768K +---------------+ / . Memory (EMS) .
| High RAM |/ . divided into .
640K +---------------+\ . 16K Logical .
| Low Page | \ . Pages .
| Frame: 24 | \ | |
| 16K Physical | \ | |
| Pages | \ | |
| | \ | |
256K +---------------+ \ | |
| |\ \ | |
| Low RAM | \ \ | |
| | \ \ | |
0 +---------------+ \ \ | |
\ \ | |
\ \ | |
\\ | |
\| |
+---------------+ 0
EMS allows up to 32 MegaBytes of memory to be mapped into a total of 36 16K
pages (as shown above) by swapping ("bank switching") small blocks ("pages")
of extra memory into the 1st Meg address space, so that only a few pages are
addressable at a time, if using an expanded memory manager like Microsoft
EMM386.EXE. Third party "enhanced" memory managers like Symantec (Quarterdeck)
QEMM386.SYS (begining with version 7.0) can map and use up to 64 MegaBytes as
EMS.
The Page Frame below the 640K mark loads in a 64K contiguous low (DOS) RAM
region, and allows the existing RAM to be shadowed, usually reserved for use
by Operating Systems/Environments, like MS Windows.
The Page Frame above the 640K barrier occupies a 64K contiguous high RAM
region in the Video RAM and ROM areas, and is designed for DOS apps/games
usage. Program code can be run or data can be stored interchangeably in any of
these frames.
Software using LIM 4.0 standard can thus have a fairly large amount of
physical memory available, but MUST access it by manually switching pages as
required.
LIM 4.0 is not integrated into the Operating System though. EMS needs to be
implemented ("emulated") through a software control program called EMS device
driver, which maps the computer's physical eXtended Memory Standard (XMS) in
"Virtual X86 Mode" on any 80X86 CPU, so that the memory is mapped into any of
the physical LIM pages.
MS-DOS and MS Windows use for this purpose MS EMM386.EXE (MicroSoft Expanded
Memory Manager), which loads from the CONFIG.SYS (CONFIG.NT) file upon bootup
on all X86 compatible PCs, and is provided with all Microsoft
OSes/Environments.
EMM386.EXE was designed for 80386 and all newer X86 CPUs outfitted with XMS,
and uses XMS to create and manage EMS and/or XMS and UMBs. EMS is available to
programs through the LIM 4.0 interface, and UMBs are available through the XMS
3.0 interface. EMM386.EXE only provides the UMBs by answering requests to
allocate or deallocate them. All other XMS requests are managed by MS
HIMEM.SYS (MicroSoft HIgh MEMory SYStem). That's why HIMEM.SYS needs to load
in memory before EMM386.EXE, and both need to be mentioned in CONFIG.SYS
(CONFIG.NT) [except for MS Windows Millennium Edition (ME), which loads
HIMEM.SYS from IO.SYS (In/Out SYStem), before CONFIG.SYS is processed] on
dedicated command lines using custom parameters, in order to tailor the memory
layout to your programs/games' specific needs.
ALL Microsoft OSes/Environments use by default HIMEM.SYS as their mandatory
high/extended memory interface/manager and EMM386.EXE as their optional
upper/extended/expanded memory interface/manager, but there are other (3rd
party) "enhanced" memory managers that perform a similar job with better
results (reclaim more free memory and/or provide faster memory access), but
sometimes at the expense of less compatibility (limited to specific hardware
and/or software), such as: Symantec (Quarterdeck) QEMM386.SYS, Network
Associates (Helix) NetRoom RM386.EXE, Qualitas (IBM) 386MAX.SYS, Lineo
(Caldera) DR-DOS EMM386.EXE, Uwe Sieber's UMBPCI.SYS (UMA mapper) etc.
See "95/98/ME SETUP + MEMORY MANAGERS" in MYTIPS95.TXT (part of W95-11D.ZIP)
for more memory managers details.
Thus MS-DOS and MS Windows recognize the LIM 4.0 presence and allow various
DOS devices/drivers/TSRs/programs/games to be allocated ("loaded") into LIM
pages:
- RAM (virtual) disks like MS RAMDRIVE.SYS (MicroSoft RAM DRIVE SYStem);
- Disk caching routines like MS SMARTDRV.EXE (MicroSoft SMARTDRiVe);
- CD-ROM/DVD drivers like MS MSCDEX.EXE (MicroSoft Compact Disk EXtensions);
- EMS games/apps like Lucas Arts X-Wing, Autodesk CAD etc.
Some such programs have the ability to be configured for using extended and/or
expanded memory under the LIM 4.0 standards, as needed.
See "BASIC *ESSENTIAL* MEMORY TIPS" in MEMORY.TXT (included) for a list of DOS
applications, utilities and games that use EMS.
II. MS-DOS UPPER MEMORY REGIONS + MAPPING
Dale F. Ogden, computer programmer, was very kind to send me this detailed
answer to my early questions concerning MS-DOS upper memory regions mapping:
"Greetings,
Beyond the first 640K of conventional memory (0000h - 9FFFh), in the Upper
Memory Areas, there are various types of information stored in ROM BIOS that
depend upon the type of installed hardware. There are also areas reserved by
the system for specific purposes (all memory addresses are in hexadecimal
notation):
* A000 - AFFF: VGA graphics.
* B000 - B7FF: monochrome text (this region is usually available for loading
TSRs and drivers "high" into UMBs).
* B800 - BFFF: VGA Text.
* C000 - C7FF: accelerated video cards.
* C800 - EFFF: much of this region is available to create the page frame for
EMS memory or to load TSR programs and drivers. Somewhere in that region
there is ROM for the hard drives and likely for other hardware, too.
* F000 to FFFF: usually cluttered with ROM (the floppies use this area) and
most is not available for loading stuff; however, some of this area may be
available.
* 10000 to 10FFF: the first 64K beyond 1MB is referred to as the High Memory
Area (HMA) that is addressable within by DOS as a result of the segmented
memory scheme used to allow a 16-bit processor to address more than 64
KiloBytes of memory (2^16=64K). Starting with MS-DOS 5.0, a large portion of
the MS-DOS resident module is stored in the HMA, including, in some cases,
Microsoft mouse drivers.
* Beyond that is extended memory which, since the '386, can be "mapped" to
whatever you want it to be.
Memory managers, like EMM386, QEMM386, RM386, use command line parameters to
load TSRs and drivers into specific regions of upper memory. These regions
are defined not by specific addresses, but by available contiguous regions.
The region B000 to B7FF (32K) is the first available region or UMB (Upper
Memory Block) on my system. From CB00 to DBFF (68K) is the second available
region and the EMS page frame is stored from DC00 to EBFF (64K). Each system
is likely to be somewhat different.
HiMem.Sys is the most conservative of all the memory managers in that it uses
only areas not needed by anything else. Third party memory managers usually
are more aggressive (but almost infinitely configurable) and recover memory
used by ROMs that might only be needed at BOOT. In addition, certain
technologies developed by the vendors of 3rd party memory managers (QEMM's
"Stealth" and NetRoom's "Cloaking"), allow the Upper Memory Area (UMA) to be
used for multiple purposes, but of course, not at the same time. The memory
manager controls which function has access to the memory at any particular
time and swaps the other information to extended (XMS) or expanded (EMS)
memory (if available).
The regions are not defined by any particular addresses. When DOS loads
something in upper memory, it looks for available UMBs. Without a switch
(/L:n, where usually n=1-4), it would load it into the first available UMB.
The /L:n switch causes it to load in the designated available UMB.
The purpose of this is to efficiently use the memory. TSRs and Drivers usually
must be loaded into contiguous blocks of memory, so you want to load larger
TSRs into larger UMBs and smaller TSRs into smaller UMBs.
The actual addresses of those upper memory regions depend upon your system.
The utilities that come with QEMM (Manifest) and other 3rd party utilities are
more useful than MSD and make it easier to analyze what is happening with
memory.
The documentation that comes with QEMM is as good as any textbook in
describing what is going on with conventional and extended memory, UMBs, HMA,
EMS, XMS, VCPI and DPMI. There are also articles about optimizing memory usage
at MicroSoft Knowledge Base (MSKB):
http://support.microsoft.com/
If your goal is to maximize conventional memory (you now have 623K which seems
adequate for almost any purpose, I've never seen anything to need more than
619K to run, and 634K is the maximum possible with a VGA video card), invest
in QEMM, but that seems a high price to pay for potentially only 11K of RAM.
Hope I've been helpful.
Dale F. Ogden"
III. AXCEL216's ADDENDUM ON UPPER MEMORY REGIONS MANAGEMENT
To exemplify the Upper Memory Regions (UMRs) on a PC/AT IBM (X86) compatible
computer, I have pasted below my system's MSD (the DOS based MicroSoft
Diagnostics tool) Upper Memory Area (UMA) chart:
------------------------------- Memory -----------------------------
Legend: Available " " RAM "##" ROM "RR" Possibly Available ".."
EMS Page Frame "PP" Used UMBs "UU" Free UMBs "FF"
1024K FC00 RRRRRRRRRRRRRRRR FFFF Conventional Memory
F800 RRRRRRRRRRRRRRRR FBFF Total: 640K
F400 RRRRRRRRRRRRRRRR F7FF Available: 625K
960K F000 RRRRRRRRRRRRRRRR F3FF 640864 bytes
EC00 FFFFFFFFFFFFFFFF EFFF
E800 UUUUUUUUUUUUUUFF EBFF Extended Memory
E400 UUUUUUUUUUUUUUUU E7FF Total: 64512K
896K E000 UUUUUUUUUUUUUUUU E3FF
DC00 UUUUUUUUUUUUUUUU DFFF MS-DOS Upper Memory Blocks
D800 UUUUUUUUUUUUUUUU DBFF Total UMBs: 122K
D400 PPPPPPPPPPPPPPPP D7FF Total Free UMBs: 17K
832K D000 PPPPPPPPPPPPPPPP D3FF Largest Free Block: 17K
CC00 PPPPPPPPPPPPPPPP CFFF
C800 PPPPPPPPPPPPPPPP CBFF Expanded Memory (EMS)
C400 RRRRRRRRRRRRRRRR C7FF LIM Version: 4.00
768K C000 RRRRRRRRRRRRRRRR C3FF Page Frame Address: C800H
BC00 ################ BFFF Total: 33152K
B800 ################ BBFF Available: 32720K
B400 UUUUUUUUUUUUUUUF B7FF
704K B000 UUUUUUUUUUUUUUUU B3FF XMS Information
AC00 AFFF XMS Version: 3.00
A800 ABFF Driver Version: 3.5f
A400 A7FF A20 Address Line: Enabled
640K A000 A3FF High Memory Area: In use
Available: 65535K
Largest Free Block: 65535K
Available SXMS: 214976K
Largest Free SXMS: 214976K
VCPI Information
VCPI Detected: Yes
Version: 1.00
Available Memory: 32720K
To display this graphic on your system, run:
MSD
from a DOS prompt, and then press M.
See MSD95.TXT (part of W95-11D.ZIP) or MSD62.TXT (part of W31-11D.ZIP) for MSD
details.
The UMA is contained between memory addresses A000 - FFFF on all X86 Intel
compatible PCs (see chart above).
As you can see in this particular layout, the entire UMA is mapped into two
regions of available Upper Memory Blocks (UMBs):
- region 1: located between addresses B000 - B7FF, enabled by the I=B000-B7FF
EMM386.EXE switch (see further below), and
- region 2: located between addresses C800 - EFFF, enabled by the I=C800-EFFF
EMM386.EXE switch (see further below).
These two UMRs are available for loading devices, drivers and/or TSR
(Terminate and Stay Resident) programs "high", using the CONFIG.SYS DEVICEHIGH
and INSTALLHIGH, and the AUTOEXEC.BAT LOADHIGH (abbreviated as LH) commands.
Such an UMA layout can be obtained ONLY by using an upper/extended/expanded
memory manager in CONFIG.SYS, like the Microsoft HIMEM.SYS + EMM386.EXE
"combo", or a similar 3rd party enhanced memory manager, such as Symantec
(Quarterdeck) QEMM386.SYS, Network Associates (Helix) NetRoom RM386.EXE,
Qualitas (IBM) 386MAX.SYS, Lineo (Caldera) DR-DOS EMM386.EXE, Uwe Sieber's
UMBPCI.SYS etc, to map the UMA, and to provide UMBs that allow
drivers/devices/TSRs to load "high" and programs to use it. Example:
DEVICE=drive:\path\HIMEM.SYS /TESTMEM:OFF
DEVICE=drive:\path\EMM386.EXE RAM I=C800-EFFF I=B000-B7FF M3 AUTO
The above UMA layout corresponds to these two I=xxxx-yyyy EMM386.EXE switches.
The Legend explains the meaning of the symbols. Areas marked with ## and RR
canNOT be mapped by memory managers, because they are used by Extended, Hard
Disk, Option and/or Video BIOS ROM and RAM. The 64K contiguous area marked
with PP (between C800 - D7FF in this case) is occupied by the EMM386.EXE Page
Frame, in expanded memory mode, enabled by the EMM386.EXE RAM parameter.
Areas marked with UU (in region 1 and 2) are taken by devices, drivers and/or
TSRs, ONLY if loaded with DEVICEHIGH/INSTALLHIGH in CONFIG.SYS, or LOADHIGH
(LH for short) in AUTOEXEC.BAT. The FF areas represent free UMBs, and can be
used by programs specifically written to make use of the UMA, like MS Windows.
NOTE: The EMM386.EXE line MUST FOLLOW the HIMEM.SYS line in CONFIG.SYS!
ALL OTHER DEVICE(HIGH)/INSTALL(HIGH) CONFIG.SYS commands MUST FOLLOW
the HIMEM.SYS and EMM386.EXE lines!
The "n" variable (used by the "/L:n" switch) can have any integer value
begining with 1 and up to the maximum number of UMRs available on your
machine, as mapped by an upper/extended/expanded memory manager (EMM386.EXE,
QEMM386.SYS, RM386.EXE, 386MAX.SYS, UMBPCI.SYS etc) loaded from CONFIG.SYS.
You can fiddle with the "/L:1", "/L:2"... "/L:n" switches to determine your
best UMA setup.
Example of CONFIG.SYS DEVICEHIGH line that uses a specific /L:n switch to load
a particular device/driver/TSR into a targeted UMR [CONFIG.SYS lines are
processed before AUTOEXEC.BAT lines when your machine boots]:
DEVICEHIGH /L:1=C:\path\IFSHLP.SYS
This line loads MS IFSHLP.SYS (MicroSoft Installable File System HeLPer), the
mandatory MS Windows 32-bit disk access compatibility (legacy) DOS mode
support driver in the UMA region 1, located in this example between addresses
B000 - B7FF.
The B000 - B7FF UMR is NOT used by the standard PC/AT computer BIOS or
Microsoft based OSes if you don't use two video controllers in the same PC, or
an older black and white (monochrome) video adapter.
Therefore you can gain an extra 32 KB of contiguous upper memory available to
programs/TSRs, ONLY IF you add the I=B000-B7FF switch to your memory manager
line in CONFIG.SYS (see the EMM386.EXE line above).
Same /L:n switches can also be used with the LOADHIGH (abbreviated as LH)
command in AUTOEXEC.BAT, to load MS-DOS mode TSRs/drivers at bootup.
An example is loading the DOS Mouse driver in UMA region 1 [AUTOEXEC.BAT lines
are processed after CONFIG.SYS lines when your machine boots]:
LOADHIGH /L:1=C:\path\MOUSE <YOUR_MOUSE_DRIVER_PARAMETERS>
The order of loading devices/drivers/TSRs in upper memory is of UTMOST
importance: larger FIRST, smaller LAST.
Run:
LOADHIGH /?
from any DOS prompt for usage details.
You need to experiment with multiple configurations until you reach your
optimum memory setup, eventually loading ALL your devices/drivers/TSRs in
UMA, and thus freeing MAXimum possible low DOS memory, which is better used by
DOS based programs/games.
Have fun!