home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 24 DOS / 24-DOS.zip / doswitip.zip / REGIONS.TXT < prev    next >
Text File  |  2002-05-07  |  33KB  |  690 lines

  1.               AXCEL216's MAX Speeed
  2.         PC Memory Types, Architecture, Regions + Mapping
  3.  
  4.  
  5.  
  6.  
  7. NOTES:    - For memory management guide + optimization tips *READ* MEMORY.TXT
  8.     (included).
  9.     - For DOS + Windows extended + expanded memory managers technical
  10.     details see EMM386.TXT (included).
  11.     - For abbreviations + terms explanations see GLOSSARY.TXT (included).
  12.     - For Microsoft EMM386.EXE + HIMEM.SYS undocumented parameters see
  13.     related topics in SECRETS.TXT (included).
  14.  
  15. CREDITS: - "PC MEMORY TYPES + ARCHITECTURE" chapter is based in part on
  16.      Raymond Dunn's public domain USENET article [EXT-RAM.TXT, 5 KB]:
  17.      http://wcarchive.cdrom.com/pub/simtelnet/msdos/info/ext_ram.zip
  18.      and includes current PC memory specifications + technology updates.
  19.      - "MS-DOS UPPER MEMORY REGIONS + MAPPING" chapter appears courtesy of
  20.      Dale F. Ogden, computer programmer.
  21.  
  22.  
  23. REGIONS.TXT Contents:
  24.  
  25.  
  26. I.   PC MEMORY TYPES + ARCHITECTURE:
  27.     1. Measure Your Memory
  28.     2. Conventional Memory [below the 1st MegaByte]
  29.     3. Extended and Expanded Memory [above the 1st MegaByte]:
  30.         A. Extended Memory = XMS ["long memory"]
  31.         B. Expanded Memory = EMS ["fat memory"]
  32. II.  MS-DOS UPPER MEMORY REGIONS + MAPPING
  33. III. AXCEL216's ADDENDUM ON UPPER MEMORY REGIONS MANAGEMENT
  34.  
  35.  
  36. PC memory resources on the Internet:
  37. - PC Guide: Logical Memory Layout:
  38. http://www.pcguide.com/ref/ram/logic.htm
  39. - MSKB: Memory Management in MS-DOS:
  40. http://support.microsoft.com/support/kb/articles/q95/5/55.asp
  41. - MSKB: A General Tutorial on the Various Forms of Memory:
  42. http://support.microsoft.com/support/kb/articles/q37/2/42.asp
  43. - MSKB: How to Increase Conventional Memory for MS-DOS-Based Programs:
  44. http://support.microsoft.com/support/kb/articles/q134/3/99.asp
  45. - MSKB: Optimizing Your Use of Upper Memory Blocks:
  46. http://support.microsoft.com/support/kb/articles/q77/0/83.asp
  47. - MS TechNet: MS-DOS Memory Management:
  48. http://www.microsoft.com/technet/archive/msdos/05_memry.asp
  49. - ZDNet: PC Memory Tutorial:
  50. http://cma.zdnet.com/book/upgraderepair/ch07/ch07.htm
  51. - X86 CPU Modes + Memory:
  52. http://pure.l33t3.de/deinmeister/x86modes.htm
  53. - PC Forrest Windows 95/98 CONFIG.SYS, Memory + Commands:
  54. http://www.forrestandassociates.co.uk/pcforrest/config_sys.html
  55. - My DOS7 [a.k.a. Windows 95/98] MEMory Specs:
  56. http://members.aol.com/axcel216/mem7.htm
  57. - My DOS6 [+ WfWG 3.1x] MEMory Specs:
  58. http://members.aol.com/axcel216/mem6.htm
  59. - My DOS7 [a.k.a. Windows 95/98] CONFIG.SYS settings:
  60. http://members.aol.com/axcel216/bench.htm#CON
  61. - My DOS7 [a.k.a. Windows 95/98] AUTOEXEC.BAT settings:
  62. http://members.aol.com/axcel216/bench.htm#AUT
  63. ______________________________________________________________________________
  64.  
  65.  
  66.  
  67.             I. PC MEMORY TYPES + ARCHITECTURE
  68.  
  69.  
  70.  
  71. 1. Measure Your Memory
  72.  
  73.  
  74. Computer memory is measured in Bytes (Binary octets, abbreviated as B). Each
  75. Byte contains 8 bits. The bit (binary digit, abbreviated as b) is the basic
  76. unit of digital data/information, and can be either 0 or 1.
  77. Computer data (like memory amount or disk storage capacity) is measured using
  78. the hexadecimal system (base of 16).
  79. Multiples for Byte [powers of 2, mod(1024)]:
  80. - 1 KiloByte (KB) = 1,024 Bytes (2^10 Bytes).
  81. - 1 MegaByte (MB) = 1,024 KB = 1,048,576 B (2^20 Bytes).
  82. - 1 GigaByte (GB) = 1,024 MB = 1,048,576 KB = 1,073,741,824 B (2^30 Bytes).
  83. - 1 TeraByte (TB) = 1,024 GB = 1,048,576 MB = 1,073,741,824 KB = etc... (2^40
  84. Bytes).
  85. FYI: Do not confuse this with the bit (used for example in internet, modem and
  86. networking communications transfer rates/throughput), which is measured using
  87. the decimal system (base of 10).
  88. Multiples for bit [powers of 10, mod(1000)]:
  89. - 1 kilobit (kb) = 1,000 bits (10^3 bits).
  90. - 1 megabit (mb) = 1,000 kb = 1,000,000 b (10^6 bits).
  91. - 1 gigabit (gb) = 1,000 mb = 1,000,000 kb = 1,000,000,000 b (10^9 bits).
  92. - 1 terabit (tb) = 1,000 gb = 1,000,000 mb = etc... (10^12 bits).
  93.  
  94. Memory addresses and ranges use the hexadecimal (hex) notation: numbers 0 to 9
  95. and letters A to F, allowing 16 possible values for each hex digit.
  96. Computers translate data using the binary numbering system, because they
  97. understand only ones (1) and zeroes (0).
  98. This translation table shows the correspondence among the three numbering
  99. systems used in computing language:
  100.  
  101. Decimal (base 10)    Binary (base 2)        Hexadecimal (base 16)
  102. ---------------------------------------------------------------------
  103. 00            0000            0
  104. 01            0001            1
  105. 02            0010            2
  106. 03            0011            3
  107. 04            0100            4
  108. 05            0101            5
  109. 06            0110            6
  110. 07            0111            7
  111. 08            1000            8
  112. 09            1001            9
  113. 10            1010            A
  114. 11            1011            B
  115. 12            1100            C
  116. 13            1101            D
  117. 14            1110            E
  118. 15            1111            F
  119.  
  120. More info:
  121. - Bits, Bytes + Bandwidth:
  122. http://www.speedguide.net/Cable_modems/bandwidth.shtml
  123. - Binary System:
  124. http://www.wugnet.com/tips/99/4-16/
  125. - Hexadecimal System:
  126. http://www.wugnet.com/tips/99/6-4/
  127. - Binary System:
  128. http://www.pcnineoneone.com/howto/binary1.html
  129. - Hexadecimal System:
  130. http://www.pcnineoneone.com/howto/hex1.html
  131.  
  132.  
  133. 2. Conventional Memory [below the 1st MegaByte]
  134.  
  135.  
  136. MS-DOS (MicroSoft Disk Operating System) was designed around the original 8088
  137. Intel CPU which was [and still is :(] able to address only up to 1 MegaByte
  138. (MB) of memory (RAM), called "Conventional memory" (sometimes incorrectly
  139. referred to as "Low memory"), and located between 0K and 1M [1 MB = 64 pages].
  140. This space is divided into two major blocks:
  141. - 0K - 640K [640 KB = 40 pages] = "Low (DOS) RAM", used by software: MS-DOS
  142. core, system, I/O, programs, devices, drivers, TSRs etc.
  143. - 640K - 1M [384 KB = 24 pages] = "High RAM", used by hardware: ROM, BIOS Data
  144. Area (BDA), Extended BIOS Data Area (EBDA), Video (VGA) Controller ROM/BIOS,
  145. Hard Disk Controller (HDC), Floppy Disk Controller (FDC) etc.
  146. Conventional memory is divided into 64 pages of 16K each, referred to as page
  147. 0, page 1, page 2... and so on, or by their hexadecimal segment addresses:
  148. page 0 at segment 0, page 1 at segment 0400, page 2 at segment 0800... etc.
  149. Examples of page numbers with corresponding starting segments and linear
  150. addresses:
  151.  
  152. Page      Segment Address    Linear Address
  153. ----------------------------------------------
  154. 0      0000            0K
  155. 1      0400            16K
  156. 2      0800            32K
  157. 4      1000            64K
  158. 8      2000            128K
  159. 12      3000            196K
  160. 40      A000            640K
  161. 63      FC00            1008K
  162.  
  163. 1st MegaByte memory map [0000 - FFFF = 1M] usage on a typical X86 PC:
  164.  
  165. Address Range    Used by            Size
  166. ----------------------------------------------
  167. 0000 - 0FFF    Low DOS RAM        640 KB
  168. A000 - AFFF    VGA graphics        64 KB
  169. B000 - B7FF    Monochrome video    32 KB
  170. B800 - BFFF    VGA text        32 KB
  171. C000 - C7FF    Video and HDC ROM    32 KB
  172. C800 - CFFF    Available to DOS    32 KB
  173. D000 - DFFF    EMS page frame        64 KB
  174. E000 - EFFF    Available to DOS    64 KB
  175. F000 - FFFF    BIOS and FDC ROM    64 KB
  176.  
  177. Microsoft provides two "real mode" (DOS based, 16-bit) programs to visualize
  178. your computer's memory "innards":
  179. - MEM.EXE = MEMory viewer;
  180. - MSD.EXE = MicroSoft Diagnostics,
  181. bundled with all MS-DOS 6.xx and Windows 3.xx/95/98/ME releases.
  182. A 32-bit (console based) version of MEM.EXE is included with all Windows
  183. NT/2000/XP/.Net builds.
  184. These two DOS memory tools are used in examples below:
  185. - To see a graphical map of all modules/programs/drivers using the memory
  186. below the 1st MegaByte, their sizes, the free memory status with specific hex
  187. address locations and the available memory blocks, run:
  188. MSD
  189. and press M to bring up the Memory screen.
  190. MSD works also from a Windows NT/2000/XP/.Net command prompt.
  191. - To see a detailed list of all modules/drivers using the memory below the 1st
  192. MegaByte, their sizes and the free memory status with specific hex address
  193. locations, run:
  194. MEM/A/D/P
  195. - To see a classified list of all programs/drivers using the memory below the
  196. 1st MegaByte, their sizes, the free memory summary and the available memory
  197. blocks, run:
  198. MEM/A/C/P
  199. These commands can be executed either from native/real MS-DOS mode or in a DOS
  200. box/session started from within MS Windows 3.xx/95/98/ME GUI.
  201. The undocumented "MEM /A" command line parameter is explained in "MEM.EXE
  202. HIDDEN PARAMETERS" in SECRETS.TXT (included).
  203. Some of these switches are not available to MEM.EXE in Windows
  204. NT/2000/XP/.Net.
  205. For more details take a look at:
  206. * These MSD (MicroSoft Diagnostics utility) reports in:
  207. - MSD95.TXT (part of W95-11D.ZIP) = Win95/98/ME + DOS 7/8 users.
  208. - MSD62.TXT (part of W31-11D.ZIP) = Win31 + DOS6 users.
  209. * These "MEM/A/C/P" stats in:
  210. - DOS95MEM.TXT + WIN95MEM.TXT (both part of W95-11D.ZIP) = Win95/98/ME + DOS
  211. 7/8 users.
  212. - MEM62.TXT + MEM31.TXT (both part of W31-11D.ZIP) = Win31 + DOS6 users.
  213.  
  214. To comply with the industry standard IBM PC/AT architecture, this memory is
  215. organized as follows:
  216.  
  217.      1M +---------------+ 0xFFFF    \        \
  218.     | System BIOS    |        |        |
  219.     | ROM and    |        |        |
  220.     | FDC ROM    |        |        |
  221.    960K +---------------+ 0xF000    |        |
  222.     | Option ROM,    |        |        |
  223.     | PnP BIOS ROM    |        |        |
  224.     | & Option RAM    |        |        |
  225.    816K +---------------+ 0xCC00    | High RAM    |
  226.     | HDC BIOS RAM    |        | 384 KB    |
  227.    800K +---------------+ 0xC800    | [640K - 1M]    |
  228.     | Video BIOS    |        | A000 - FFFF    |
  229.     | ROM, Option    |        |        | Conventional RAM
  230.     | ROM and RAM    |        |        | 1 MB
  231.    768K +---------------+ 0xC000    |        | [0K - 1M]
  232.     | Video RAM:    |        |        | 0000 - FFFF
  233.     | VGA color    |        |        |
  234.     | and        |        |        |
  235.     | monochrome    |        /        |
  236.    640K +---------------+ 0xA000 \            |
  237.     |        |     |            |
  238.     | Base        |     |            |
  239.     | System    |     | Low (DOS) RAM    |
  240.     | RAM        |     | 640 KB        |
  241.     |        |     | [0K - 640K]        |
  242.      1K +---------------+ 0x0100 | 0000 - 0FFF        |
  243.     | IV and BDA    |     |            |
  244.      0K +---------------+ 0x0000 /            /
  245.  
  246. MS-DOS Conventional memory map from 0 KiloBytes up to 1 MegaByte [1 MB]:
  247.  
  248. Module Name and Usage                        Range        Size
  249. --------------------------------------------------------------------------------------
  250. * Low (DOS) RAM:                        0K - 640K    640 KB
  251. - Interrupt Vectors (IV) and BIOS Data Area (BDA)        0K - 1K        1 KB
  252. - Base System RAM                        1K - 640K    639 KB
  253. * High RAM:                            640K - 1M    384 KB
  254. - Video RAM (VGA color and monochrome)                640K - 768K    128 KB
  255. - Video BIOS ROM, Option ROM and Option RAM            768K - 800K    32 KB
  256. - Hard Drive Controller (HDC) BIOS RAM                800K - 816K    16 KB
  257. - Option ROM, Plug-and-Play (PnP) BIOS ROM and Option RAM    816K - 960K    144 KB
  258. - System BIOS ROM and Floppy Drive Controller (FDC) ROM        960K - 1M    64 KB
  259. * TOTAL Conventional RAM                    0K - 1M        1 MB
  260.  
  261. The physical RAM below 640K is used by MS-DOS as its resource, mapped as shown
  262. above.
  263. Some of the memory above 640K is used for Video RAM, because various video
  264. types (CGA, EGA, MGA, PGA, 8514, VGA) have different requirements, sizes and
  265. starting/ending addresses, depending also on video controller bus types (ISA,
  266. VLB, PCI, AGP) and chipset brand/model (3dfx, 3Dlabs, ATI, Cirrus, Diamond,
  267. Matrox, Number Nine, NVidia, Oak Technology, PowerVR, S3, Trident, Tseng Labs
  268. etc).
  269. But MS-DOS can map the unused "chunks" of remaining RAM immediately above the
  270. 640K barrier [the 384 KB "High RAM" area, which is not the same as the "High
  271. Memory Area" (HMA), discussed further below], if the BIOS "tells" it to at
  272. boot time. That's why this region is also called the "Upper Memory Area"
  273. (UMA), and can be used to load programs, drivers, TSRs (Terminate and Stay
  274. Resident programs), and even parts of DOS itself "high", thus freeing more
  275. Conventional memory. This is possible by mapping the Upper Memory Blocks
  276. (UMBs) into usable RAM, by upper/extended/expanded memory managers, like the
  277. Microsoft HIMEM.SYS and EMM386.EXE "combo" (bundled with all Microsoft
  278. OSes/Environments), which load from CONFIG.SYS or IO.SYS (MS-DOS 5.0/6.xx and
  279. Windows 95/98/ME), CONFIG.NT or NTIO.SYS (Windows NT/2000/XP/.Net) at bootup.
  280. MS-DOS allocates UMBs through XMS services using Interrupt 21h, only if this
  281. line is present in CONFIG.SYS (CONFIG.NT):
  282. DOS=UMB
  283. Similar (3rd party) upper memory mappers like Uwe Sieber's UMBPCI.SYS and/or
  284. HIRAM.EXE (which only map and enable unused Shadow RAM as UMA using HIMEM.SYS,
  285. chipset specific), or upper/extended/expanded "enhanced" memory managers (most
  286. of which don't need HIMEM.SYS to enable the UMA) like Symantec (Quarterdeck)
  287. QEMM386.SYS, Network Associates (Helix) NetRoom RM386.EXE, Qualitas (IBM)
  288. 386MAX.SYS, Lineo (Caldera) DR-DOS EMM386.EXE etc can also map available UMBs
  289. into usable memory.
  290.  
  291.  
  292. 3. Extended and Expanded Memory [above the 1st MegaByte]
  293.  
  294.  
  295. A. Extended Memory = XMS ["long memory"]
  296.  
  297. Extended memory is an intrinsic part of the Intel CPU (X86) architecture. It
  298. is addressed directly in the CPU memory address space, above the 1st MegaByte
  299. [10000 -> top of available RAM] on all IBM PC compatibles (clones).
  300. MS-DOS [still :(] assumes that it runs on an 8088 CPU, and can thus only
  301. address the first 1 MegaByte [1024 KiloBytes] of memory space.
  302. Newer CPUs starting with the 80286 are capable of addressing the memory above
  303. the 1st Meg. Normally this memory canNOT be accessed by processors in "Real
  304. Mode" (designed for compatibility with the old 8088), using a single-tasking
  305. "Real Mode" Operating System, like Microsoft MS-DOS.
  306. But newer DOS based programs and games are designed to use a "Protected Mode"
  307. run-time environment ("DOS extender" using the DPMI interface: CWSDPMI.EXE or
  308. DOS4GW.EXE "DPMI hosts") to access up to 32 MegaBytes of extended memory for
  309. intensive graphics rendering (SVGA/XVGA modes), 3D textures and
  310. video/animation playback. Examples: Eidos Tomb Raider, Lucas Arts Rebel
  311. Assault + Rebel Assault II, 3D Realms Duke Nukem 3D.
  312. Other programs like RAM disks (MS RAMDRIVE.SYS), print spoolers (MS
  313. PRINT.EXE), disk caches (MS SMARTDRV.EXE), use a ROM BIOS feature (on newer
  314. PCs that support it) that allows them to copy data between conventional and
  315. extended memory. Although these programs cannot execute in extended memory,
  316. they can use it as storage space.
  317. To access the entire physical extended memory on X86 compatible PCs, software
  318. programs need to perform in "Protected Mode" (also called "386 Enhanced Mode")
  319. by loading special (virtual I/O: 386, DLL, DRV, VXD etc) drivers, thus
  320. allowing multi-tasking, multi-threading and faster (32-bit or even 64-bit) I/O
  321. transfers, like Microsoft Windows in all its newer incarnations starting with
  322. Windows NT and 95.
  323. Another processor mode is the "Virtual Real Mode", which allows "Real Mode"
  324. DOS programs to execute from within a "Protected Mode" environment in a
  325. confined (isolated) DOS session/box/window, by emulating a "Virtual Machine"
  326. (VM), and used by "Protected Mode" OSes/Environments, like Microsoft Windows.
  327.  
  328. Extended memory can be used according to the XMS (eXtended Memory
  329. Specification) 3.0 standard, defined jointly by Microsoft, Intel, Lotus and
  330. AST, if mapped by an XMS device driver like HIMEM.SYS, provided with all
  331. Microsoft OSes/Environments.
  332. The XMS 3.0 standard allows the extended memory to be used by software
  333. designed to take advantage of it:
  334. - Terminate and Stay Resident (TSR) programs like DOS MOUSE Drivers;
  335. - Extended Memory Specification (XMS) applications like MS Windows;
  336. - XMS DOS games like 3D Realms Duke Nukem 3D;
  337. - Static or dynamic RAM disks like MS RAMDRIVE.SYS;
  338. - Disk caching software like MS SMARTDRV.EXE;
  339. - Expanded Memory Specification (EMS) implementation like MS EMM386.EXE
  340. enhanced upper/extended/expanded memory manager, which uses page mapping (on
  341. 80386 and newer X86 CPUs) to convert extended RAM into expanded, thus freeing
  342. additional conventional memory for use by MS-DOS and DOS programs.
  343.  
  344. The first 64 KB (minus 16 Bytes) of contiguous extended (XMS) memory space
  345. located above the 1st Meg [10000 - 10FFF] is referred to as the "High Memory
  346. Area" (HMA), and is addressable within by MS-DOS as a result of the segmented
  347. memory scheme used to allow X86 CPUs (80286 and newer) to address more than 64
  348. KB of RAM.
  349. HMA can be addressed in "Real Mode" (also called "80X86 emulation") on 80286
  350. and newer CPUs if the A20 handler (the 21st Address Line) is active at boot
  351. time.
  352. IBM PC compatibles can turn the A20 line on and off by using the keyboard
  353. port (hardware dependent). Some BIOSes include the "A20 Handler" ("Fast Gate")
  354. setting, which needs to be set to Enabled (Fast), to activate A20 each time
  355. the computer boots. BIOSes without this switch always turn on the A20 line.
  356. Microsoft HIMEM.SYS high/extended memory manager can adapt the A20 handler to
  357. different machine types. HIMEM.SYS machine default is type 1, used by the
  358. majority of IBM compatible PC clones.
  359. For more info:
  360. - MS Windows 95/98/ME: open MSDOSDRV.TXT (located in your Windows folder) in
  361. Notepad to read the HIMEM.SYS topic.
  362. - MS-DOS 6.xx: run this DOS command:
  363. HELP HIMEM.SYS
  364. Begining with MS-DOS 5.00, a large portion of the MS-DOS resident module, DOS
  365. BUFFERS or some DOS Mouse drivers can be stored in the HMA, only if enabled by
  366. this CONFIG.SYS (CONFIG.NT) line:
  367. DOS=HIGH
  368. XMS allocates/deallocates HMA as a single block, which means it can be used
  369. only by one program at a time. That's why MS-DOS canNOT load in the HMA if it
  370. is already occupied by another resident program at bootup.
  371.  
  372. B. Expanded Memory = EMS ["fat memory"]
  373.  
  374. Expanded memory is defined within the architecture of the IBM PC/AT standard.
  375. It is referred to as "Paged Memory", can be addressed through a Page Frame
  376. within the first 1 MegaByte [1024 KiloBytes], and is thus accessible on all
  377. 80X86 compatible CPUs begining with the 8088.
  378.  
  379. The Lotus-Intel-Microsoft (LIM) 4.0 agreement is currently recognized as the
  380. common Expanded Memory Specification (EMS) industry standard.
  381. LIM 4.0 describes the following memory architecture:
  382.  
  383.     PC (X86) MAIN MEMORY        LIM EXPANDED MEMORY
  384.  
  385.  16M/4T +---------------+
  386.     | Extended    |
  387.     | Memory (XMS)    |
  388.     . up to 16 MB    .        +---------------+ 32M
  389.     . on a 80286,    .           /|        |
  390.     . 4 GB on a    .         // |        |
  391.     . 80386/80486,    .       / /    |        |
  392.     . 4 TB on a    .     /  /    |        |
  393.     | 80586/80686    |      /   /    |        |
  394.     | etc...    |    /    /    |        |
  395.      1M +---------------+  /     /    |        |
  396.     | High RAM    |/      /    |        |
  397.    960K +---------------+      /     |        |
  398.     | High Page    |     /        |        |
  399.     | Frame: 12    |    /        |        |
  400.     | 16K Physical    |   /        |        |
  401.     | Pages        |  /        . Expanded    .
  402.    768K +---------------+ /        . Memory (EMS)    .
  403.     | High RAM    |/        . divided into    .
  404.    640K +---------------+\        . 16K Logical    .
  405.     | Low Page    | \        . Pages        .
  406.     | Frame: 24    |  \        |        |
  407.     | 16K Physical    |   \        |        |
  408.     | Pages        |    \        |        |
  409.     |        |     \     |        |
  410.    256K +---------------+      \    |        |
  411.     |        |\      \    |        |
  412.     | Low RAM    |  \     \    |        |
  413.     |        |    \    \    |        |
  414.       0 +---------------+      \   \    |        |
  415.                  \  \    |        |
  416.                    \ \    |        |
  417.                      \\ |        |
  418.                        \|        |
  419.                     +---------------+ 0
  420.  
  421. EMS allows up to 32 MegaBytes of memory to be mapped into a total of 36 16K
  422. pages (as shown above) by swapping ("bank switching") small blocks ("pages")
  423. of extra memory into the 1st Meg address space, so that only a few pages are
  424. addressable at a time, if using an expanded memory manager like Microsoft
  425. EMM386.EXE. Third party "enhanced" memory managers like Symantec (Quarterdeck)
  426. QEMM386.SYS (begining with version 7.0) can map and use up to 64 MegaBytes as
  427. EMS.
  428. The Page Frame below the 640K mark loads in a 64K contiguous low (DOS) RAM
  429. region, and allows the existing RAM to be shadowed, usually reserved for use
  430. by Operating Systems/Environments, like MS Windows.
  431. The Page Frame above the 640K barrier occupies a 64K contiguous high RAM
  432. region in the Video RAM and ROM areas, and is designed for DOS apps/games
  433. usage. Program code can be run or data can be stored interchangeably in any of
  434. these frames.
  435. Software using LIM 4.0 standard can thus have a fairly large amount of
  436. physical memory available, but MUST access it by manually switching pages as
  437. required.
  438. LIM 4.0 is not integrated into the Operating System though. EMS needs to be
  439. implemented ("emulated") through a software control program called EMS device
  440. driver, which maps the computer's physical eXtended Memory Standard (XMS) in
  441. "Virtual X86 Mode" on any 80X86 CPU, so that the memory is mapped into any of
  442. the physical LIM pages.
  443. MS-DOS and MS Windows use for this purpose MS EMM386.EXE (MicroSoft Expanded
  444. Memory Manager), which loads from the CONFIG.SYS (CONFIG.NT) file upon bootup
  445. on all X86 compatible PCs, and is provided with all Microsoft
  446. OSes/Environments.
  447. EMM386.EXE was designed for 80386 and all newer X86 CPUs outfitted with XMS,
  448. and uses XMS to create and manage EMS and/or XMS and UMBs. EMS is available to
  449. programs through the LIM 4.0 interface, and UMBs are available through the XMS
  450. 3.0 interface. EMM386.EXE only provides the UMBs by answering requests to
  451. allocate or deallocate them. All other XMS requests are managed by MS
  452. HIMEM.SYS (MicroSoft HIgh MEMory SYStem). That's why HIMEM.SYS needs to load
  453. in memory before EMM386.EXE, and both need to be mentioned in CONFIG.SYS
  454. (CONFIG.NT) [except for MS Windows Millennium Edition (ME), which loads
  455. HIMEM.SYS from IO.SYS (In/Out SYStem), before CONFIG.SYS is processed] on
  456. dedicated command lines using custom parameters, in order to tailor the memory
  457. layout to your programs/games' specific needs.
  458. ALL Microsoft OSes/Environments use by default HIMEM.SYS as their mandatory
  459. high/extended memory interface/manager and EMM386.EXE as their optional
  460. upper/extended/expanded memory interface/manager, but there are other (3rd
  461. party) "enhanced" memory managers that perform a similar job with better
  462. results (reclaim more free memory and/or provide faster memory access), but
  463. sometimes at the expense of less compatibility (limited to specific hardware
  464. and/or software), such as: Symantec (Quarterdeck) QEMM386.SYS, Network
  465. Associates (Helix) NetRoom RM386.EXE, Qualitas (IBM) 386MAX.SYS, Lineo
  466. (Caldera) DR-DOS EMM386.EXE, Uwe Sieber's UMBPCI.SYS (UMA mapper) etc.
  467. See "95/98/ME SETUP + MEMORY MANAGERS" in MYTIPS95.TXT (part of W95-11D.ZIP)
  468. for more memory managers details.
  469.  
  470. Thus MS-DOS and MS Windows recognize the LIM 4.0 presence and allow various
  471. DOS devices/drivers/TSRs/programs/games to be allocated ("loaded") into LIM
  472. pages:
  473. - RAM (virtual) disks like MS RAMDRIVE.SYS (MicroSoft RAM DRIVE SYStem);
  474. - Disk caching routines like MS SMARTDRV.EXE (MicroSoft SMARTDRiVe);
  475. - CD-ROM/DVD drivers like MS MSCDEX.EXE (MicroSoft Compact Disk EXtensions);
  476. - EMS games/apps like Lucas Arts X-Wing, Autodesk CAD etc.
  477. Some such programs have the ability to be configured for using extended and/or
  478. expanded memory under the LIM 4.0 standards, as needed.
  479. See "BASIC *ESSENTIAL* MEMORY TIPS" in MEMORY.TXT (included) for a list of DOS
  480. applications, utilities and games that use EMS.
  481.  
  482.  
  483.  
  484.         II.  MS-DOS UPPER MEMORY REGIONS + MAPPING
  485.  
  486.  
  487.  
  488. Dale F. Ogden, computer programmer, was very kind to send me this detailed
  489. answer to my early questions concerning MS-DOS upper memory regions mapping:
  490.  
  491. "Greetings,
  492.  
  493. Beyond the first 640K of conventional memory (0000h - 9FFFh), in the Upper
  494. Memory Areas, there are various types of information stored in ROM BIOS that
  495. depend upon the type of installed hardware. There are also areas reserved by
  496. the system for specific purposes (all memory addresses are in hexadecimal
  497. notation):
  498. * A000 - AFFF: VGA graphics.
  499. * B000 - B7FF: monochrome text (this region is usually available for loading
  500. TSRs and drivers "high" into UMBs).
  501. * B800 - BFFF: VGA Text.
  502. * C000 - C7FF: accelerated video cards.
  503. * C800 - EFFF: much of this region is available to create the page frame for
  504. EMS memory or to load TSR programs and drivers. Somewhere in that region
  505. there is ROM for the hard drives and likely for other hardware, too.
  506. * F000 to FFFF: usually cluttered with ROM (the floppies use this area) and
  507. most is not available for loading stuff; however, some of this area may be
  508. available.
  509. * 10000 to 10FFF: the first 64K beyond 1MB is referred to as the High Memory
  510. Area (HMA) that is addressable within by DOS as a result of the segmented
  511. memory scheme used to allow a 16-bit processor to address more than 64
  512. KiloBytes of memory (2^16=64K). Starting with MS-DOS 5.0, a large portion of
  513. the MS-DOS resident module is stored in the HMA, including, in some cases,
  514. Microsoft mouse drivers.
  515. * Beyond that is extended memory which, since the '386, can be "mapped" to
  516. whatever you want it to be.
  517. Memory managers, like EMM386, QEMM386, RM386, use command line parameters to
  518. load TSRs and drivers into specific regions of upper memory. These regions
  519. are defined not by specific addresses, but by available contiguous regions.
  520. The region B000 to B7FF (32K) is the first available region or UMB (Upper
  521. Memory Block) on my system. From CB00 to DBFF (68K) is the second available
  522. region and the EMS page frame is stored from DC00 to EBFF (64K). Each system
  523. is likely to be somewhat different.
  524. HiMem.Sys is the most conservative of all the memory managers in that it uses
  525. only areas not needed by anything else. Third party memory managers usually
  526. are more aggressive (but almost infinitely configurable) and recover memory
  527. used by ROMs that might only be needed at BOOT. In addition, certain
  528. technologies developed by the vendors of 3rd party memory managers (QEMM's
  529. "Stealth" and NetRoom's "Cloaking"), allow the Upper Memory Area (UMA) to be
  530. used for multiple purposes, but of course, not at the same time. The memory
  531. manager controls which function has access to the memory at any particular
  532. time and swaps the other information to extended (XMS) or expanded (EMS)
  533. memory (if available).
  534. The regions are not defined by any particular addresses. When DOS loads
  535. something in upper memory, it looks for available UMBs. Without a switch
  536. (/L:n, where usually n=1-4), it would load it into the first available UMB.
  537. The /L:n switch causes it to load in the designated available UMB.
  538. The purpose of this is to efficiently use the memory. TSRs and Drivers usually
  539. must be loaded into contiguous blocks of memory, so you want to load larger
  540. TSRs into larger UMBs and smaller TSRs into smaller UMBs.
  541. The actual addresses of those upper memory regions depend upon your system.
  542. The utilities that come with QEMM (Manifest) and other 3rd party utilities are
  543. more useful than MSD and make it easier to analyze what is happening with
  544. memory.
  545. The documentation that comes with QEMM is as good as any textbook in
  546. describing what is going on with conventional and extended memory, UMBs, HMA,
  547. EMS, XMS, VCPI and DPMI. There are also articles about optimizing memory usage
  548. at MicroSoft Knowledge Base (MSKB):
  549. http://support.microsoft.com/
  550. If your goal is to maximize conventional memory (you now have 623K which seems
  551. adequate for almost any purpose, I've never seen anything to need more than
  552. 619K to run, and 634K is the maximum possible with a VGA video card), invest
  553. in QEMM, but that seems a high price to pay for potentially only 11K of RAM.
  554.  
  555. Hope I've been helpful.
  556.  
  557. Dale F. Ogden"
  558.  
  559.  
  560.  
  561.     III. AXCEL216's ADDENDUM ON UPPER MEMORY REGIONS MANAGEMENT
  562.  
  563.  
  564.  
  565. To exemplify the Upper Memory Regions (UMRs) on a PC/AT IBM (X86) compatible
  566. computer, I have pasted below my system's MSD (the DOS based MicroSoft
  567. Diagnostics tool) Upper Memory Area (UMA) chart:
  568.  
  569. ------------------------------- Memory -----------------------------
  570. Legend: Available "  "  RAM "##"  ROM "RR"  Possibly Available ".."
  571.     EMS Page Frame "PP"  Used UMBs "UU"  Free UMBs "FF"
  572.  
  573. 1024K FC00 RRRRRRRRRRRRRRRR FFFF  Conventional Memory
  574.       F800 RRRRRRRRRRRRRRRR FBFF         Total: 640K
  575.       F400 RRRRRRRRRRRRRRRR F7FF         Available: 625K
  576.  960K F000 RRRRRRRRRRRRRRRR F3FF            640864 bytes
  577.       EC00 FFFFFFFFFFFFFFFF EFFF
  578.       E800 UUUUUUUUUUUUUUFF EBFF  Extended Memory
  579.       E400 UUUUUUUUUUUUUUUU E7FF         Total: 64512K
  580.  896K E000 UUUUUUUUUUUUUUUU E3FF
  581.       DC00 UUUUUUUUUUUUUUUU DFFF  MS-DOS Upper Memory Blocks
  582.       D800 UUUUUUUUUUUUUUUU DBFF        Total UMBs: 122K
  583.       D400 PPPPPPPPPPPPPPPP D7FF       Total Free UMBs: 17K
  584.  832K D000 PPPPPPPPPPPPPPPP D3FF    Largest Free Block: 17K
  585.       CC00 PPPPPPPPPPPPPPPP CFFF
  586.       C800 PPPPPPPPPPPPPPPP CBFF  Expanded Memory (EMS)
  587.       C400 RRRRRRRRRRRRRRRR C7FF       LIM Version: 4.00
  588.  768K C000 RRRRRRRRRRRRRRRR C3FF    Page Frame Address: C800H
  589.       BC00 ################ BFFF         Total: 33152K
  590.       B800 ################ BBFF         Available: 32720K
  591.       B400 UUUUUUUUUUUUUUUF B7FF
  592.  704K B000 UUUUUUUUUUUUUUUU B3FF  XMS Information
  593.       AC00            AFFF       XMS Version: 3.00
  594.       A800            ABFF    Driver Version: 3.5f
  595.       A400            A7FF      A20 Address Line: Enabled
  596.  640K A000            A3FF      High Memory Area: In use
  597.                          Available: 65535K
  598.                     Largest Free Block: 65535K
  599.                     Available SXMS: 214976K
  600.                      Largest Free SXMS: 214976K
  601.  
  602.                   VCPI Information
  603.                      VCPI Detected: Yes
  604.                            Version: 1.00
  605.                       Available Memory: 32720K
  606.  
  607. To display this graphic on your system, run:
  608. MSD
  609. from a DOS prompt, and then press M.
  610. See MSD95.TXT (part of W95-11D.ZIP) or MSD62.TXT (part of W31-11D.ZIP) for MSD
  611. details.
  612.  
  613. The UMA is contained between memory addresses A000 - FFFF on all X86 Intel
  614. compatible PCs (see chart above).
  615. As you can see in this particular layout, the entire UMA is mapped into two
  616. regions of available Upper Memory Blocks (UMBs):
  617. - region 1: located between addresses B000 - B7FF, enabled by the I=B000-B7FF
  618. EMM386.EXE switch (see further below), and
  619. - region 2: located between addresses C800 - EFFF, enabled by the I=C800-EFFF
  620. EMM386.EXE switch (see further below).
  621. These two UMRs are available for loading devices, drivers and/or TSR
  622. (Terminate and Stay Resident) programs "high", using the CONFIG.SYS DEVICEHIGH
  623. and INSTALLHIGH, and the AUTOEXEC.BAT LOADHIGH (abbreviated as LH) commands.
  624. Such an UMA layout can be obtained ONLY by using an upper/extended/expanded
  625. memory manager in CONFIG.SYS, like the Microsoft HIMEM.SYS + EMM386.EXE
  626. "combo", or a similar 3rd party enhanced memory manager, such as Symantec
  627. (Quarterdeck) QEMM386.SYS, Network Associates (Helix) NetRoom RM386.EXE,
  628. Qualitas (IBM) 386MAX.SYS, Lineo (Caldera) DR-DOS EMM386.EXE, Uwe Sieber's
  629. UMBPCI.SYS etc, to map the UMA, and to provide UMBs that allow
  630. drivers/devices/TSRs to load "high" and programs to use it. Example:
  631.  
  632. DEVICE=drive:\path\HIMEM.SYS /TESTMEM:OFF
  633. DEVICE=drive:\path\EMM386.EXE RAM I=C800-EFFF I=B000-B7FF M3 AUTO
  634.  
  635. The above UMA layout corresponds to these two I=xxxx-yyyy EMM386.EXE switches.
  636. The Legend explains the meaning of the symbols. Areas marked with ## and RR
  637. canNOT be mapped by memory managers, because they are used by Extended, Hard
  638. Disk, Option and/or Video BIOS ROM and RAM. The 64K contiguous area marked
  639. with PP (between C800 - D7FF in this case) is occupied by the EMM386.EXE Page
  640. Frame, in expanded memory mode, enabled by the EMM386.EXE RAM parameter.
  641. Areas marked with UU (in region 1 and 2) are taken by devices, drivers and/or
  642. TSRs, ONLY if loaded with DEVICEHIGH/INSTALLHIGH in CONFIG.SYS, or LOADHIGH
  643. (LH for short) in AUTOEXEC.BAT. The FF areas represent free UMBs, and can be
  644. used by programs specifically written to make use of the UMA, like MS Windows.
  645.  
  646. NOTE:    The EMM386.EXE line MUST FOLLOW the HIMEM.SYS line in CONFIG.SYS!
  647.     ALL OTHER DEVICE(HIGH)/INSTALL(HIGH) CONFIG.SYS commands MUST FOLLOW
  648.     the HIMEM.SYS and EMM386.EXE lines!
  649.  
  650. The "n" variable (used by the "/L:n" switch) can have any integer value
  651. begining with 1 and up to the maximum number of UMRs available on your
  652. machine, as mapped by an upper/extended/expanded memory manager (EMM386.EXE,
  653. QEMM386.SYS, RM386.EXE, 386MAX.SYS, UMBPCI.SYS etc) loaded from CONFIG.SYS.
  654. You can fiddle with the "/L:1", "/L:2"... "/L:n" switches to determine your
  655. best UMA setup.
  656. Example of CONFIG.SYS DEVICEHIGH line that uses a specific /L:n switch to load
  657. a particular device/driver/TSR into a targeted UMR [CONFIG.SYS lines are
  658. processed before AUTOEXEC.BAT lines when your machine boots]:
  659.  
  660. DEVICEHIGH /L:1=C:\path\IFSHLP.SYS
  661.  
  662. This line loads MS IFSHLP.SYS (MicroSoft Installable File System HeLPer), the
  663. mandatory MS Windows 32-bit disk access compatibility (legacy) DOS mode
  664. support driver in the UMA region 1, located in this example between addresses
  665. B000 - B7FF.
  666. The B000 - B7FF UMR is NOT used by the standard PC/AT computer BIOS or
  667. Microsoft based OSes if you don't use two video controllers in the same PC, or
  668. an older black and white (monochrome) video adapter.
  669. Therefore you can gain an extra 32 KB of contiguous upper memory available to
  670. programs/TSRs, ONLY IF you add the I=B000-B7FF switch to your memory manager
  671. line in CONFIG.SYS (see the EMM386.EXE line above).
  672.  
  673. Same /L:n switches can also be used with the LOADHIGH (abbreviated as LH)
  674. command in AUTOEXEC.BAT, to load MS-DOS mode TSRs/drivers at bootup.
  675. An example is loading the DOS Mouse driver in UMA region 1 [AUTOEXEC.BAT lines
  676. are processed after CONFIG.SYS lines when your machine boots]:
  677.  
  678. LOADHIGH /L:1=C:\path\MOUSE <YOUR_MOUSE_DRIVER_PARAMETERS>
  679.  
  680. The order of loading devices/drivers/TSRs in upper memory is of UTMOST
  681. importance: larger FIRST, smaller LAST.
  682. Run:
  683. LOADHIGH /?
  684. from any DOS prompt for usage details.
  685. You need to experiment with multiple configurations until you reach your
  686. optimum memory setup, eventually loading ALL your devices/drivers/TSRs in
  687. UMA, and thus freeing MAXimum possible low DOS memory, which is better used by
  688. DOS based programs/games.
  689.  
  690. Have fun!