@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

            MDGx MAX Speed WinDOwS Tricks  Secrets  ugs  Fixes
            http://www.mdgx.com/
                             
		PC Memory Types, Architecture, Regions + Mapping
		



NOTES:	- For memory management guide + optimization tips see MEMORY.TXT
	(included).
	- For DOS + Windows extended + expanded memory managers technical
	details see EMM386.TXT (included).
	- For abbreviations + terms explanations see GLOSSARY.TXT (included):
	http://www.mdgx.com/glossary.htm
	- For Microsoft EMM386.EXE + HIMEM.SYS undocumented parameters see
	related topics in SECRETS.TXT (included):
	http://www.mdgx.com/secrets.htm

CREDITS: "PC MEMORY TYPES + ARCHITECTURE" chapter is based in part on these
	 public domain articles:
	 http://www.textfiles.com/computers/ext-ram.txt
	 http://www.textfiles.com/computers/dosmem.txt
	 and includes current PC memory specifications + technology updates.


REGIONS.TXT Contents:

I.   PC MEMORY TYPES + ARCHITECTURE:
	1. "Measure" Your Memory: bits + Bytes
	2. Conventional Memory: below the 1st MegaByte
	3. Extended and Expanded Memory: above the 1st MegaByte:
		A. Extended Memory = XMS a.k.a. "long memory"
		B. Expanded Memory = EMS a.k.a. "fat memory"
II.  MS-DOS UPPER MEMORY REGIONS + MAPPING
III. MDGx ADDENDUM = UPPER MEMORY REGIONS MANAGEMENT


PC memory resources on the Internet:
- MDGx Wikipedia Reference: Computer Memory Management Terms + System Files:
http://www.mdgx.com/mem7.htm#WKL
- PC Guide: System Memory:
http://www.pcguide.com/ref/ram/
- MSKB: Memory Management in MS-DOS:
http://support.microsoft.com/help/95555
- MSKB: General Tutorial on Various Forms of Memory:
http://support.microsoft.com/help/37242
- MSKB: How to Increase Conventional Memory for MS-DOS Based Programs:
http://support.microsoft.com/help/134399
- MSKB: Optimizing Use of Upper Memory Blocks:
http://support.microsoft.com/help/77083
- MSKB: Microsoft Windows 98 SE MSDOSDRV.TXT File:
http://support.microsoft.com/help/234868
- MSKB: Microsoft Windows 98 SE CONFIG.TXT File:
http://support.microsoft.com/help/234853
- MS TechNet: MS-DOS Memory Management:
http://www.microsoft.com/technet/archive/msdos/05_memry.mspx
- X86 CPU Modes + Memory:
http://www.deinmeister.de/x86modes.htm
- 80x86 Memory Modes:
http://www.classicdosgames.com/tutorials/modes.html
- My DOS7 [a.k.a. Windows 95/98] MEMory Specs:
http://www.mdgx.com/mem7.htm
- My DOS6 [+ WfWG 3.1x] MEMory Specs:
http://www.mdgx.com/mem6.htm
- My DOS7 [a.k.a. Windows 95/98] CONFIG.SYS:
http://www.mdgx.com/bench.htm#CON
- My DOS7 [a.k.a. Windows 95/98] AUTOEXEC.BAT:
http://www.mdgx.com/bench.htm#AUT
- MDGx Reference: Numerical Measurement Standards, Systems + Units:
http://www.mdgx.com/mem7.htm#NMS
______________________________________________________________________________



			I. PC MEMORY TYPES + ARCHITECTURE



1. "Measure" Your Memory: bits + Bytes


Computer memory is measured in Bytes (Binary octets, abbreviated as B).
http://en.wikipedia.org/wiki/Byte
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.
http://en.wikipedia.org/wiki/Bit
Computer data (like memory amount or disk storage capacity) is measured using
the binary (bin) numeric system (base of 2).
http://en.wikipedia.org/wiki/Binary_number
Multiples for Byte [powers of 2, mod(1024)]:
http://www.cknow.com/cms/ref/bits-bytes-and-multiple-bytes.html
- 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 =
1,099,511,627,776 B (2^40 Bytes).
- etc.
Do not confuse this with the bit (used for example in networking and internet
communications transfer rates/throughput), which is measured using the decimal
(dec) numeric system (base of 10).

Multiples for bit [powers of 10, mod(1000)]:
http://www.cknow.com/cms/ref/bits-bytes-and-multiple-bytes.html
- 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 = 1,000,000,000 kb =
1,000,000,000,000 b (10^12 bits).
- etc.
And to make it even more confusing, here is the new IEC (International
Electrotechnical Commission) standard:
Multiples for bi(Byte) [powers of 2, mod(1024)]:
http://www.cknow.com/cms/ref/bits-bytes-and-multiple-bytes.html
- 1 kibi or kibiByte (Ki) = 1,024 Bytes (~ 1.02x10^3 Bytes).
- 1 mebi or mebiByte (Mi) = 1,024 Ki = 1,048,576 B (~ 1.05x10^6 Bytes).
- 1 gibi or gibiByte (Gi) = 1,024 Mi = 1,048,576 Ki = 1,073,741,824 B (~
1.07x10^9 Bytes).
- 1 tebi or tebiByte (Ti) = 1,024 Gi = 1,048,576 Mi = 1,073,741,824 Ki =
1,099,511,627,776 B (~ 1.10x10^12 Bytes).
- etc.
More details:
http://en.wikipedia.org/wiki/Binary_prefix

Memory addresses and ranges use the hexadecimal (hex) numeric notation:
numbers 0 to 9 and letters A to F, allowing 16 possible combinations of values
for each hex digit.
Computers translate data using the binary system, because they understand only
ones (1) and zeroes (0).
This translation table shows the correspondence among the three numeric
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

Most 16-bit and some 32-bit programming languages require each character to be
represented by 2 Bytes: double-byte character set (DBCS).
http://en.wikipedia.org/wiki/DBCS
Maximum number of characters that can be represented by:
- 1 Byte = 256
- 2 Bytes = 65,536.

Reference:
- See "Computer Memory Management Terms + System Files @ Wikipedia":
http://www.mdgx.com/mem7.htm#WKL
- See "Numerical Measurement Standards, Systems + Units":
http://www.mdgx.com/mem7.htm#NMS


2. Conventional Memory: below the 1st MegaByte


FYI:
Microsoft removed support for 16-bit (DOS) virtual memory allocation + mapping
(NTVDM) and 16-bit programs from all their Windows
XP/2003/Vista/2008/7/8/8.1/2012/10/2016/newer (NTx) 64-bit OSes.
http://en.wikipedia.org/wiki/Virtual_DOS_machine#Windows_NTVDM
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 (1024 KB)
total = 64 pages of 16 KB each.
This space is divided into two major blocks (regions):
- 0K - 640K [640 KB = 40 pages] = "Low (DOS) RAM", used by software: DOS core,
system, I/O, programs, devices, drivers, TSRs (Terminate and Stay Resident
programs/devices/drivers) 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) ROM/BIOS, Floppy Disk Controller (FDC) ROM/BIOS
etc.
Conventional memory is divided (mapped) into 64 linear pages of 16 KB 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 Number	Segment Address (hex)	Linear Address
------------------------------------------------------
 0	  	0000			   0 K
 1	  	0400			  16 K
 2	  	0800			  32 K
 4	  	1000			  64 K
 8	  	2000			 128 K
12	  	3000			 196 K
40	  	A000			 640 K
63	  	FC00			1008 K

1st MegaByte memory map [0000 - FFFF = 1 MB] usage on a typical X86 PC:

Address Range	Used by			Size in KB
--------------------------------------------------
0000 - 0FFF	Low DOS RAM		640
A000 - AFFF	VGA graphics		 64
B000 - B7FF	Monochrome video	 32
B800 - BFFF	VGA text		 32
C000 - C7FF	Video and HDC ROM	 32
C800 - CFFF	Available to DOS	 32
D000 - DFFF	EMS page frame		 64
E000 - EFFF	Available to DOS	 64
F000 - FFFF	BIOS and FDC ROM	 64

Microsoft provides two "real mode" (DOS based, 16-bit, legacy) programs to
visualize your computer's memory "innards":
- MEM.EXE = MEMory viewer and
- MSD.EXE = MicroSoft Diagnostics,
bundled with all MS-DOS 6.xx and Windows 3.xx/95/98/ME releases.
32-bit (console based) versions of MEM.EXE + MSD.EXE (a.k.a. WINMSD.EXE,
a.k.a. SystemInfo.exe) are included with all Windows
NT/2000/XP/2003/Vista/2008/7/8/8.1/2012/10/2016 (NTx) builds.
FYI:
Microsoft replaced the 16-bit MSD.EXE DOS mode tool with the 32-bit WinMSD
(WINMSD.EXE) GUI based counterpart in Windows NT 3.5x/4.0 + 2000/XP/2003:
http://www.ss64.com/nt/winmsd.html
WinMSD [stub =
runs C:\Program Files\Common Files\Microsoft Shared\MSInfo\MSINFO32.EXE
(default location)] was replaced with the more advanced MsInfo 32-bit
(MSINFO32.EXE) tool in Windows 2000/XP/2003/Vista/2008/7/8/8.1/2012/10/2016,
also available in Windows 98/98 SE(U)/ME.
In Windows 2000/XP/2003/Vista/2008/7/8/8.1/2012/10/2016 you can also use the
SystemInfo.exe command line tool to display a list of brief system specs:
http://technet.microsoft.com/library/bb491007.aspx
These two 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.
- 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/true/pure MS-DOS mode
or in a DOS box/session started from within Windows 3.xx/95/98/ME GUI.
The undocumented "MEM /A" command line parameter is explained in "MEM.EXE
HIDDEN PARAMETERS" from SECRETS.TXT (included):
http://www.mdgx.com/secrets.htm#MEM
Some of these switches are not available to MEM.EXE in Windows
NT/2000/XP/2003/Vista/2008/7/8/8.1/2012/10/2016 32-bit. Run:
MEM /?
from a command prompt box to see all available parameters.
MEM.EXE similar tool for DOS (free):
http://www.freedos.org/software/?prog=mem
For more details take a look at:
* These MSD (MicroSoft Diagnostics utility) reports:
- Win95/98/ME + DOS 7/8 users: MSD9X.TXT (part of W95-11D.EXE):
http://www.mdgx.com/95.htm
- Win31 + DOS6 users: MSD62.TXT (part of W31-11D.ZIP):
http://www.mdgx.com/31.htm
* These "MEM /A/C/P" stats in:
- Win95/98/ME + DOS 7/8 users: DOS9XMEM.TXT + WIN9XMEM.TXT (both part of
W95-11D.EXE):
http://www.mdgx.com/mem7.htm
- Win31 + DOS 6 users: MEM62.TXT + MEM31.TXT (both part of W31-11D.ZIP):
http://www.mdgx.com/mem6.htm

To comply with the industry standard IBM PC/AT architecture this memory is
organized as follows:

Top of memory area
     1M +---------------+ 0xFFFF \	 \		 \
	| System BIOS	|	 |	 |		 |
	| ROM, Boot ROM	|	 | 64 KB |		 |
	| + FDC ROM   	|	 |	 |		 |
   960K +---------------+ 0xF000 X	 |		 |
	| Option ROM,	|	 |	 |		 |
	| PnP BIOS ROM	|	 |144 KB |		 |
	| + Option RAM	|	 |	 |		 |
   816K +---------------+ 0xCC00 X	 | High RAM (UMA)|
	| HDC BIOS RAM	|	 | 16 KB | 384 KB	 |
   800K +---------------+ 0xC800 X	 | [640K - 1M]	 |
	| Video BIOS	|	 |	 | A000 - FFFF	 |
	| ROM, Option	|	 | 32 KB |		 | Conventional RAM
	| ROM + RAM	|	 |	 |		 | 1 MB
   768K +---------------+ 0xC000 X	 |		 | [0K - 1M]
	| Video RAM:	|	 |	 |		 | 0000 - FFFF
	| VGA color	|	 |128 KB |		 |
	| + MGA		|	 |	 |		 |
	| monochrome	|	 |	 /		 |
   640K +---------------+ 0xA000 X			 |
	|		|	 |			 |
	| Base		|	 |			 |
	| System	|	 | Low (DOS) RAM	 |
	| RAM		|	 | 640 KB		 |
	|		|	 | [0K - 640K]		 |
     1K +---------------+ 0x0100 | 0000 - 0FFF		 |
	| IV + BDA	|	 |			 |
     0K +---------------+ 0x0000 /			 /
Bottom of memory area

MS-DOS Conventional memory map from 0 KiloBytes up to 1 MegaByte [1 MB]:

Module Name + Usage					Range		Size
------------------------------------------------------------------------------
* Low (DOS) RAM:					0K - 640K	640 KB
- Interrupt Vectors (IV) + BIOS Data Area (BDA)		0K - 1K		  1 KB
- Base System RAM					1K - 640K	639 KB
* High RAM (UMA):					640K - 1M	384 KB
- Video RAM (VGA color and MGA monochrome)		640K - 768K	128 KB
- Video BIOS ROM, Option ROM + Option RAM		768K - 800K	 32 KB
- Hard Drive Controller (HDC) BIOS RAM			800K - 816K	 16 KB
- Option ROM, Plug-and-Play (PnP) BIOS ROM + Option RAM	816K - 960K	144 KB
- System BIOS ROM, Boot ROM + FDC[*] ROM		960K - 1M	 64 KB
* TOTAL Conventional RAM				0K - 1M		  1 MB
[*] FDC = Floppy Drive Controller

Memory mapping details:
- See "Reference: Computer Memory Management Terms + System Files @
Wikipedia":
http://www.mdgx.com/mem7.htm#WKL
- Wikipedia: x86 memory segmentation:
http://en.wikipedia.org/wiki/X86_memory_segmentation
- Memory Map (x86):
http://wiki.osdev.org/Memory_Map_%28x86%29
- Physical Memory Maps:
http://www.osdata.com/system/physical/memmap.htm
- DOS Memory Map:
http://web.archive.org/web/20071229012037/http://www.nfinity.com/~exile/memmap.htm

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, PCIe) and chipset brand/model (3dfx, 3Dlabs, ATI, Cirrus,
Diamond, Intel, Kyro, Matrox, Number Nine, NVidia, Oak Technology, PowerVR, S3,
Trident, Tseng Labs, Volari 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, and even parts of DOS
code 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 +
EMM386.EXE "combo" (bundled with all Microsoft OSes/Environments 16-bit +
32-bit), which load from CONFIG.SYS and/or IO.SYS (MS-DOS 5.0/6.xx and Windows
95/98/ME), or CONFIG.NT and/or NTIO.SYS (Windows NT/2000/XP/2003/newer 32-bit)
at bootup.
MS-DOS allocates UMBs through XMS services using hardware Interrupt 21h
(Int21), 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,
motherboard 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, McAfee (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 a.k.a. "long memory"

Extended memory is an intrinsic part of the X86 (AMD, Cyrix, Evergreen, IBM,
IDT, Intel, NEC, Transmeta etc) CPU architecture. It is addressed directly in
the CPU memory address space above the 1st MegaByte, starting at 10000 hex
(bottom) up to the last hex (top) of available RAM, on all IBM PC/AT/XT
compatible "clones".
MS-DOS [still :(] assumes that it runs on an Intel 8088 CPU (!), and can thus
address only the first 1 MegaByte [1024 KiloBytes] of memory space.
Newer CPUs starting with the Intel 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, Lineo
(Caldera) DR-DOS, IBM PC-DOS, FreeDOS, Novell N-DOS, PT-DOS etc.
But newer DOS based programs and games are designed to use a "Protected Mode"
run-time environment ["DOS extender" using the DPMI (DOS Protected Mode
Interface) mode: CWSDPMI.EXE, DOS32A.EXE or DOS4GW.EXE "DPMI hosts"]:
http://www.mdgx.com/dos.htm#DPMI
to access most or even all available extended memory for intensive graphics
rendering (SVGA/XVGA modes), 3D textures and audio/video/animation
playback/recording.
Examples: Eidos Tomb Raider, Lucas Arts Rebel Assault + Rebel Assault II, 3D
Realms Duke Nukem 3D.
Other programs like RAM disk emulators (MS RAMDRIVE.SYS, XMSDSK.EXE,
EMSDSK.EXE), print spoolers (MS PRINT.EXE), disk cache routines (MS
SMARTDRV.EXE, CACHECLK.EXE, HYPERDKX.EXE), use a ROM BIOS feature (on newer
PCs that support it) using hardware Interrupt 13h (Int13) 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, SYS, 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 box/session/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:
http://www.nondot.org/sabre/os/files/MemManagement/XMS30.txt
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 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 (only
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 BIOS Setups 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 PCs.
More info:
- Windows 95/98/ME: open MSDOSDRV.TXT (located in your Windows folder) in
Notepad to read the HIMEM.SYS topic, or go to:
http://support.microsoft.com/help/234868
- MS-DOS 6.xx: run this DOS command:
HELP HIMEM.SYS
Beginning 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 a.k.a. "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 beginning with the Intel 8088.

The Lotus-Intel-Microsoft (LIM) 4.0 agreement is currently recognized as the
common Expanded Memory Specification (EMS) industry standard:
http://www.nondot.org/sabre/os/files/MemManagement/LIMEMS41.txt
LIM 4.0 describes the following memory architecture:

	PC (X86) MAIN MEMORY		LIM 4.0 EXPANDED MEMORY

Top of memory area
 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
Bottom of memory area

EMS allows up to 32 MegaBytes of memory to be mapped into a total of 36 (16K
each) 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. 3rd party "enhanced" memory managers like Symantec
(Quarterdeck) QEMM386.SYS (beginning 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 conventional
(DOS) memory region, and allows the existing RAM to be "shadowed", usually
reserved for use by Operating Systems/Environments, like Windows (all
releases).
The Page Frame above the 640K barrier occupies a 64K contiguous upper 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 Windows use for this purpose MS EMM386.EXE (MicroSoft Expanded
Memory Manager), which loads from CONFIG.SYS (CONFIG.NT) upon bootup on all
X86 compatible PCs, and 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 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
particular 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, and/or limited to specific
hardware and/or software, such as: Symantec (Quarterdeck) QEMM386.SYS, McAfee
(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":
http://www.mdgx.com/newtip20.htm#9SMM
also in MYTIPS95.TXT (part of W95-11D.EXE):
http://www.mdgx.com/95.htm
for more memory management guides.

Thus MS-DOS and 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/DVD drivers like MS MSCDEX.EXE (MicroSoft Compact Disk EXtensions);
- EMS games and applications 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 (1994) questions concerning MS-DOS upper memory regions
mapping:

"Beyond the first 640K of conventional memory (0000h - 9FFFh), in the Upper
Memory Areas (UMA), 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 (floppy controllers 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 (CPU) 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. 3rd 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), NetRoom (Discover) 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."
______________________________________________________________________________



	III. MDGx ADDENDUM = UPPER MEMORY REGIONS MANAGEMENT



To exemplify the Upper Memory Regions (UMRs) on a PC/AT IBM (X86) compatible
computer (clone) I have pasted below my computer 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"

Top of memory area
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
Bottom of memory area			     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 (for Memory layout).
See MSD9X.TXT (part of W95-11D.EXE):
http://www.mdgx.com/95.htm
or MSD62.TXT (part of W31-11D.ZIP):
http://www.mdgx.com/31.htm
for more 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 TSRs "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, McAfee (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/games 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.
Legend above explains the meaning of the symbols. Areas marked with ## (ROM)
and RR (RAM) canNOT be mapped by memory managers, because they are used by
Extended, Hard Disk, Floppy Disk, Option and/or Video BIOS ROM and RAM. The
64K contiguous area marked with PP (Page Frame), between C800 - D7FF in this
case [determined by the Mx switch (M3 used above)], is occupied by the
EMM386.EXE Page Frame, in expanded memory mode, enabled by the EMM386.EXE RAM
parameter.
Areas marked with UU (Used), in region 1 and 2 in this case, 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 (Free) areas
represent free UMBs, and can be used by programs specifically written to make
use of the UMA, like Windows.

TIP:
The EMM386.EXE line MUST FOLLOW the HIMEM.SYS line in CONFIG.SYS. ALL OTHER
DEVICE(HIGH)/INSTALL(HIGH) CONFIG.SYS commands (if any) MUST FOLLOW the
HIMEM.SYS and EMM386.EXE lines.

The "n" variable (used by the "/L:n" switch) can have any integer value
beginning 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=drive:\path\IFSHLP.SYS

This line loads MS IFSHLP.SYS (MicroSoft Installable File System HeLPer), the
mandatory Windows 3.xx/9x/ME 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/Environments IF you don't use two VGA controllers in the
same PC, or an older black and white (MGA monochrome) video adapter.
Therefore you can gain an extra 32 KB of contiguous upper memory available to
programs/residents/processes/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 boot time.
An example is loading the DOS Mouse driver in UMA region 1 [AUTOEXEC.BAT lines
are processed after CONFIG.SYS lines when your computer boots]:

LOADHIGH /L:1=drive:\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
optimal 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.
See MEMORY.TXT (included) for more details.
Alternatively you can use DOSBox (free GPL):
http://www.mdgx.com/dos.htm#BOX
from within any Windows 32-bit (Win32, x86) or 64-bit (Win64, x64) OS.

Have fun.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
