home *** CD-ROM | disk | FTP | other *** search
/ Program Metropolis - Software Boutique 95 / SOFTWARECD.iso / qemm75 / qemm.qip / XMS.DOC < prev   
Encoding:
Text File  |  1994-09-17  |  15.5 KB  |  359 lines

  1.                                    XMS.COM
  2.  
  3. XMS.COM allows you to exercise all the functions of the XMS specification
  4. at the DOS prompt.
  5.  
  6. When you run XMS.COM with no parameters it reports the state of XMS.
  7.  
  8. When you run XMS.COM with the "?" parameter it displays all its
  9. functions with their abbreviations.
  10.  
  11. When you run XMS.COM with the HELP parameter it displays a usage
  12. message for all parameters.
  13.  
  14. Here is an example of a status report XMS.COM returns with no
  15. parameters used:
  16.  
  17. XMS Version Number:                      3.00
  18. XMS Internal Version Number:             7.50
  19. The HMA exists.
  20. The HMA is not available.
  21. The A20 line is enabled.
  22. Total Free XMS:                          6928K
  23. Largest free EMB:                        6896K
  24. Highest ending address of any EMB:       0083:FFFF
  25. Total free XMS handles:                  61
  26. Largest free UMB:                        182.234K
  27. Address of largest free UMB:             B5B9
  28. Amount of HMA DOS is not using:          18800 bytes 
  29. The first available address in the HMA:  FFFF:B690
  30.  
  31. Here is an explanation of the above categories:
  32.  
  33. XMS version number -  The XMS specification has gone through three
  34. revisions.  The number indicates the level of the XMS specification the
  35. XMM (XMS Memory Manager) supports.
  36.  
  37. XMS internal version number -  Indicates the version of the XMM,
  38. determined by its author.
  39.  
  40. HMA - The first 64K (minus 16 bytes) of extended memory comprises the
  41. HMA (High Memory Area). In DOS segment-offset addressing the HMA begins
  42. at FFFF:0010 and ends at FFFF:FFFF.  In flat 32-bit addresses, the HMA
  43. begins at 10:0000 and ends at 10:FFEF.  For background on the HMA read
  44. the history section.
  45.  
  46. A20 - IBM and compatible PCs originally used the 8088 processor
  47. which had only 20 address lines (A0 - A19). Beginning with the 80286
  48. PCs had additional address lines (necessary to address more than
  49. one megabyte of memory).  To use extended memory (including the HMA)
  50. you must enable the 21st address line (A20); thus the XMS
  51. specification keeps track of the state of the A20 line. Read the
  52. history section for more information on the A20 line.
  53.  
  54. Total free XMS - tells you how much extended memory (not including
  55. the HMA) you have available.
  56.  
  57. Largest free EMB - tells you the largest Extended Memory Block (EMB)
  58. you can allocate.  When you allocate extended memory through the XMS
  59. specification, the XMM gives you an EMB.  The XMM can allocate only
  60. contiguous EMBs; you cannot allocate an EMB larger than Largest Free
  61. EMB no matter what Total Free XMS reports.
  62.  
  63. Highest ending address of any EMB - reported if your XMM supports XMS 3
  64. or higher.  This number, a 32-bit flat address, tells you the highest
  65. address of any extended memory.
  66.  
  67. Total free XMS handles -  returns the number of free XMS handles.
  68. When you allocate an EMB the XMM gives you a handle by which you refer
  69. to it. To quote the XMS specification:
  70.  
  71.      "Extended memory handles are scarce resources.  Programs should
  72.      try to allocate as few as possible at any one time.  When all
  73.      of a driver's handles are in use, any free extended memory is
  74.      unavailable."
  75.  
  76. Largest free UMB - returns the size of the largest available Upper
  77. Memory Block if your XMS manager provides UMBs (memory in the
  78. address space above the top of conventional memory and below the
  79. beginning of extended memory - typically between 640K and 1024K).
  80.  
  81. Address of largest free UMB -  returns the segment address of that
  82. largest UMB.
  83.  
  84. Amount of HMA DOS is not using - tells you how much of the HMA is
  85. not in use if you are using DOS=HIGH
  86.  
  87. The first available address in the HMA -  tells you the
  88. first available address in the HMA.
  89.  
  90.  
  91.  
  92. HMA FUNCTIONS
  93.  
  94. XMS has two HMA functions:  AllocateHMA (AH) and ReleaseHMA
  95. (RH).
  96.  
  97. AllocateHMA xxxx allocates the HMA.  If the HMA is already allocated,
  98. the call fails and tells you so.  Because the XMS specification has no
  99. provision to share the HMA, it allows XMMs to require that the HMA
  100. requestor use a certain minimum amount of the HMA. (The XMS
  101. specification recommends that the XMM author let the user set this
  102. minimum size with the HMAMIN parameter.)  Thus when you request the HMA
  103. you must specify a size.  XMS.COM defaults to interpreting the size you
  104. specify as a number of bytes; add a K to the end of the number if you
  105. want it interpreted as a number of kilobytes. If you specify a size
  106. smaller than HMAMIN, the XMM will refuse the request.  HMAMIN defaults
  107. to 1 unless it is set by a parameter to the XMM.
  108.  
  109. ReleaseHMA releases the HMA.  It takes no parameters.
  110.  
  111.  
  112.  
  113. A20 FUNCTIONS
  114.      
  115. XMS has four A20 functions: GlobalEnableA20 (GE), GlobalDisableA20
  116. (GD), LocalEnableA20 (LE), and LocalDisableA20 (LD). These four
  117. switches turn on/off the 21st address line, A20.  When you turn A20
  118. off, you cannot access any odd megabytes of extended memory,
  119. including the HMA. The XMS specification states that the Global
  120. functions "should only be used by programs which have control of the
  121. HMA." Additionally, the Local functions "should only be used by a
  122. programs which need direct access to extended memory." Read the
  123. history section if you want background on these functions.
  124.  
  125.  
  126.  
  127. EMB FUNCTIONS
  128.  
  129. XMS has seven EMB functions (not counting its SuperEMB functions,
  130. described later):  CreateEMB (CE), FreeEMB (FE), MoveEMB (ME), LockEMB
  131. (LKE), UnlockEMB (UE), QueryEMB (QE), and ResizeEMB (RE).
  132.  
  133. CreateEMB xxxx allocates a EMB of size xxxxK and returns the number of
  134. the handle. 
  135.  
  136. FreeEMB xxxx frees the EMB handle xxxx.
  137.  
  138. MoveEMB tttt uuuu vvvv:wwww xxxx yyyy:zzzz moves a block of data of
  139. length tttt (in bytes) from EMB handle uuuu beginning at address
  140. vvvv:wwww to EMB handle xxxx beginning at address yyyy:zzzz. (vvvv:wwww
  141. and yyyy:zzzz are 32-bit flat addresses that are offsets from the base
  142. address of their respective handles uuuu and xxxx).
  143.  
  144. LockEMB xxxx locks EMB handle xxxx. You cannot free or resize a
  145. locked EMB. You can lock a handle up to 255 times.
  146.  
  147. UnlockEMB xxxx unlocks EMB handle xxxx.  Unlocking only removes one
  148. lock.
  149.  
  150. QueryEMB xxxx returns the size and lock count of EMB handle xxxx.
  151.  
  152. ResizeEMB xxxx yyyy resizes EMB handle xxxx to size yyyyK.
  153.  
  154.  
  155. UMB FUNCTIONS
  156.      
  157. XMS has three UMB functions:  CreateUMB (CU), FreeUMB (FU), and
  158. ResizeUMB (RU).
  159.  
  160. CreateUMB xxxx creates a UMB of size xxxxP (P stands for paragraphs,
  161. which are 16-byte units) and returns the segment address of the UMB.
  162.  
  163. FreeUMB xxxx frees the UMB at the segment xxxx.
  164.  
  165. ResizeUMB xxxx yyyy resizes the UMB at segment xxxx to size yyyyP (p
  166. stands for paragraphs).
  167.  
  168.  
  169.  
  170.  
  171. SUPER FUNCTIONS
  172.  
  173. Beginning with version 3, the XMS specification can handle EMBs of
  174. size up to 4,096 megabytes. This required adding new functions. If
  175. you have a version 3 manager and more than 64 megabytes of extended
  176. memory, you can use these functions. XMS has three SuperEMB
  177. functions:  SuperCreateEMB (SCE), SuperQueryEMB (SQE),
  178. SuperResizeEMB (SRE).
  179.  
  180. SuperCreateEMB xxxx creates an EMB of size xxxxM (megabytes).
  181.  
  182. SuperQueryEMB xxxx returns the size (up to 4,096M) and lock count of
  183. EMB handle xxxx.
  184.  
  185. SuperResizeEMB xxxx yyyy resizes EMB handle xxxx to size yyyyM
  186. (megabytes).
  187.  
  188.  
  189. ADDITIONAL XMS.COM FUNCTIONS
  190.  
  191. In addition to the functions that allow you to exercise the XMS
  192. specification, XMS.COM has some additional functions:
  193.  
  194. DIR lists all your EMBs by handle.  It reports the length, starting
  195. address and lock count for each handle.
  196.  
  197. OFF turns off all XMS functions.
  198.  
  199. ON turns XMS functions back on again if turned off with XMS OFF.
  200.  
  201. SAVE xxxx yyyyyyyy.zzz saves EMB handle xxxx as file yyyyyyyy.zzz
  202.  
  203. LOAD yyyyyyyy.zzz allocates an EMB, loads file yyyyyyyy.zzz into
  204. this EMB, then reports the name of the handle into which it loaded
  205. it. Because an XMM can allocate EMBs only in increments of
  206. kilobytes, LOAD will round up to the next kilobyte to accommodate
  207. the file.
  208.  
  209. HELP displays a usage message for all parameters.
  210.  
  211. ? displays a list of all parameters and their abbreviations.
  212.  
  213. Please note that there is absolutely no security in the XMS
  214. specification. If some program (even DOS) uses the HMA, the XMS
  215. specification does not prevent another program from deallocating the HMA
  216. and using it for its own purposes. This holds true for deallocating an
  217. EMB or a UMB. If you deallocate the HMA, a UMB or an EMB that another
  218. program is using and use that memory for another purpose, the first user
  219. of the HMA (or that UMB or EMB) will malfunction when it tries to use
  220. that memory, quite possibly causing a crash.  XMS.COM has NO active
  221. security to prevent you from doing anything the XMS specification
  222. allows.
  223.  
  224.  
  225.  
  226. HISTORY
  227.  
  228. EXTENDED MEMORY
  229.  
  230. The original IBM PC could address only one megabyte of address
  231. space. With the advent of the AT we had to figure out what to do
  232. with sixteen megabytes of address space. Had we shifted to an
  233. operating system written for the 80286, we would have had no problem.
  234. But we stuck with DOS. DOS could do nothing with the memory above
  235. one megabyte (or so we originally thought). Indeed, because of the way
  236. the 8088 worked, PC manufacturers had to disable the 21st address line
  237. (A20) on 80286s to prevent access to the memory above one megabyte. They
  238. did this by putting a electronic switch on A20 that could be flipped
  239. by sending an instruction to the keyboard controller chip
  240.  
  241. Because we continued to use DOS with the 80286, we had to separate
  242. "normal" memory (beneath one megabyte) from the memory beginning at
  243. one megabyte. We called the latter extended memory. In the
  244. beginning, no one had a use for extended memory.  Then IBM wrote a
  245. ram disk, VDISK, that worked by suspending the operation of DOS for a
  246. brief period of time, switching into protected mode (the mode
  247. necessary to use extended memory, and a mode in which DOS cannot run),
  248. moving the desired information to/from its target in "normal"
  249. memory, then switching back to real mode (the mode in which DOS
  250. runs).  This may sound slow but it worked much faster than accessing
  251. even a fast hard disk.  Later, some disk caches and print spoolers used
  252. extended memory and then some very large programs figured out how to run
  253. in protected mode but still use the services of DOS (DOS extenders).
  254.  
  255. HMA
  256.  
  257. To maintain compatibility with the 8080 (the 8-bit processor the
  258. 8088 replaced) the 8088 addresses memory by adding the contents of two
  259. numbers, a segment register, shifted left four times (i.e., multiplied
  260. by 16), plus an offset (supplied from another register, a memory
  261. location, or a processor instruction).  This allows you to run CP/M on
  262. your 8088 (or even your 80486, for that matter).  On an 8088, when these
  263. two numbers add up to a sum greater than one megabyte, the 8088 "wraps
  264. around" and accesses the bottom 64K of the address space instead of the
  265. non-existent address above one megabyte. On a processor like the 80286,
  266. the address greater than one megabyte can actually exist, so the CPU
  267. accesses it instead: unless you disable A20.
  268.  
  269. Quarterdeck programmers saw that if you enabled A20, you could
  270. actually use the first 64K (minus 16 bytes) of extended memory without
  271. having to leave DOS's real mode. This strategy required a few tricks to
  272. make it work safely, but by 1987 DESQview put nearly 64K bytes of itself
  273. into this piece of the address space, decreasing its overhead in lower
  274. memory by about the same amount.
  275.  
  276. Beginning with DOS version 5 Microsoft figured out how to put a
  277. piece of DOS into this portion of the address space. Microsoft
  278. calls this piece of memory the HMA.
  279.  
  280. How do you understand the addressing quirk that makes the HMA possible?
  281. In hexadecimal, one megabyte = 100000. DOS only knows about 16-bit
  282. registers.  You can only fit four hex digits into a 16-bit register
  283. limiting it to FFFF (64K minus 1).  To access more than 64K, the 8088
  284. generates 20-bit addresses (five hexadecimal digits) by shifting the
  285. segment register left 4 times (or one place in hex) and adding another
  286. 4-digit number, which we call the offset.   For example:
  287.  
  288.      1000:1000 = 10000 + 1000 =  11000  = 68K
  289.      1100:0000 = 11000 + 0000 =  11000  = 68K
  290.      1010:0F00 = 10100 + 0F00 =  11000  = 68K
  291.      5678:1234 = 56780 + 1234 =  57A14  = 350K + 532 bytes
  292.      FFFF:FFFF = FFFF0 + FFFF = 10FFEF  = 1087K + 1007 bytes
  293.      
  294. An 8088 would have no address lines to accommodate the most significant
  295. digit of this last sum, so it would access 0FFEF, 63K + 1007 bytes,
  296. instead. With the A20 line disabled, so would an 80286 (or 80386 or
  297. 80486 or Pentium...), thus maintaining compatibility with the 8088.
  298. With A20 enabled, segment-offset addressing thus extends almost 64K
  299. beyond the first megabyte.
  300.  
  301.  
  302. UMBs
  303.      
  304. When IBM partitioned the one megabyte of address space that the 8088
  305. could address, it reserved the top 384K for ROMs and hardware.
  306. Almost everyone has a system BIOS ROM in the top 64K (F000-FFFF,
  307. 960K - 1024K). The VGA card puts graphics in A000-AFFF (640K -
  308. 704K) and color text in B800 - BFFF (736K - 768K) or monochrome text in
  309. B000 - B7FF (704K - 736K).  Most VGA cards have a 32K ROM at
  310. C000-C7FF (768K - 800K).  You may have a network card or disk
  311. controller or some other adapter card that uses a portion of the
  312. address space in this area for a ROM or RAM. Almost everyone has
  313. vacant address space in this region though--address space DOS
  314. programs can use if only usable RAM occupied it.
  315.  
  316. The EMS (Expanded Memory Services) specification has provision for
  317. mapping memory into vacant addresses in this portion of the address
  318. space. Before the 386, computers with suitable EMS cards could map
  319. memory into this portion of the address space and use it with DOS
  320. programs. Quarterdeck's DESQview pioneered use of this address
  321. space. When the 386 came out, many programs could use EMS but few
  322. could use extended memory.  386 owners bought EMS emulators, such as
  323. QEMM, to turn their then not-so-useful extended memory into EMS.
  324. These EMS emulators could map memory into this portion of the
  325. address space. Programs that so chose could allocate this memory and
  326. have more conventional memory available.
  327.  
  328. Then Quarterdeck wrote the LOADHI programs to load programs into this
  329. memory.  The programs loaded by LOADHI knew nothing about the High RAM
  330. an EMM could create.  Version 2 of the XMS specification added support
  331. for Upper Memory Blocks, which is the XMS term equivalent to the High
  332. RAM that QEMM puts between 640K and 1024K.  Upper Memory Blocks have
  333. nothing to do with extended memory.  Even today an XMS manager does not
  334. have to support any UMB functions (e.g., Microsoft's HIMEM.SYS).
  335. And computers without extended memory can still have UMBs (e.g., users
  336. of Quarterdeck's QRAM).
  337.  
  338. XMS SPECIFICATION
  339.  
  340. We had no rules for the use of extended memory when it first came
  341. into existence. IBM created a de facto specification with the way
  342. VDISK reserved extended memory. Some programs that used extended
  343. memory reserved all extended memory for themselves to ensure that no
  344. subsequent program tried to use their extended memory mistakenly.
  345.  
  346. In 1988 Microsoft drew up a specification for the use of extended
  347. memory They called the 64K (minus 16 bytes) just above one megabyte
  348. the HMA.  The specification allowed for the enabling and disabling
  349. of the A20 line and the allocation and deallocation of the HMA.  It
  350. included separate enabling and disabling of the A20 line for HMA
  351. users and extended memory users. It had functions to allocate
  352. extended memory above the HMA in increments of one kilobyte up to
  353. 64MB (the amount you can specify with a 16-bit register). Version 2
  354. added support for UMBs (see UMBS section above). Version 3 of the
  355. XMS specification added support for resizing UMBs and for handling
  356. EMBs up to 4,096M in size.
  357.  
  358.                        <<END OF FILE>>
  359.