home *** CD-ROM | disk | FTP | other *** search
- XMS.COM
-
- XMS.COM allows you to exercise all the functions of the XMS specification
- at the DOS prompt.
-
- When you run XMS.COM with no parameters it reports the state of XMS.
-
- When you run XMS.COM with the "?" parameter it displays all its
- functions with their abbreviations.
-
- When you run XMS.COM with the HELP parameter it displays a usage
- message for all parameters.
-
- Here is an example of a status report XMS.COM returns with no
- parameters used:
-
- XMS Version Number: 3.00
- XMS Internal Version Number: 7.50
- The HMA exists.
- The HMA is not available.
- The A20 line is enabled.
- Total Free XMS: 6928K
- Largest free EMB: 6896K
- Highest ending address of any EMB: 0083:FFFF
- Total free XMS handles: 61
- Largest free UMB: 182.234K
- Address of largest free UMB: B5B9
- Amount of HMA DOS is not using: 18800 bytes
- The first available address in the HMA: FFFF:B690
-
- Here is an explanation of the above categories:
-
- XMS version number - The XMS specification has gone through three
- revisions. The number indicates the level of the XMS specification the
- XMM (XMS Memory Manager) supports.
-
- XMS internal version number - Indicates the version of the XMM,
- determined by its author.
-
- HMA - The first 64K (minus 16 bytes) of extended memory comprises the
- HMA (High Memory Area). In DOS segment-offset addressing the HMA begins
- at FFFF:0010 and ends at FFFF:FFFF. In flat 32-bit addresses, the HMA
- begins at 10:0000 and ends at 10:FFEF. For background on the HMA read
- the history section.
-
- A20 - IBM and compatible PCs originally used the 8088 processor
- which had only 20 address lines (A0 - A19). Beginning with the 80286
- PCs had additional address lines (necessary to address more than
- one megabyte of memory). To use extended memory (including the HMA)
- you must enable the 21st address line (A20); thus the XMS
- specification keeps track of the state of the A20 line. Read the
- history section for more information on the A20 line.
-
- Total free XMS - tells you how much extended memory (not including
- the HMA) you have available.
-
- Largest free EMB - tells you the largest Extended Memory Block (EMB)
- you can allocate. When you allocate extended memory through the XMS
- specification, the XMM gives you an EMB. The XMM can allocate only
- contiguous EMBs; you cannot allocate an EMB larger than Largest Free
- EMB no matter what Total Free XMS reports.
-
- Highest ending address of any EMB - reported if your XMM supports XMS 3
- or higher. This number, a 32-bit flat address, tells you the highest
- address of any extended memory.
-
- Total free XMS handles - returns the number of free XMS handles.
- When you allocate an EMB the XMM gives you a handle by which you refer
- to it. To quote the XMS specification:
-
- "Extended memory handles are scarce resources. Programs should
- try to allocate as few as possible at any one time. When all
- of a driver's handles are in use, any free extended memory is
- unavailable."
-
- Largest free UMB - returns the size of the largest available Upper
- Memory Block if your XMS manager provides UMBs (memory in the
- address space above the top of conventional memory and below the
- beginning of extended memory - typically between 640K and 1024K).
-
- Address of largest free UMB - returns the segment address of that
- largest UMB.
-
- Amount of HMA DOS is not using - tells you how much of the HMA is
- not in use if you are using DOS=HIGH
-
- The first available address in the HMA - tells you the
- first available address in the HMA.
-
-
-
- HMA FUNCTIONS
-
- XMS has two HMA functions: AllocateHMA (AH) and ReleaseHMA
- (RH).
-
- AllocateHMA xxxx allocates the HMA. If the HMA is already allocated,
- the call fails and tells you so. Because the XMS specification has no
- provision to share the HMA, it allows XMMs to require that the HMA
- requestor use a certain minimum amount of the HMA. (The XMS
- specification recommends that the XMM author let the user set this
- minimum size with the HMAMIN parameter.) Thus when you request the HMA
- you must specify a size. XMS.COM defaults to interpreting the size you
- specify as a number of bytes; add a K to the end of the number if you
- want it interpreted as a number of kilobytes. If you specify a size
- smaller than HMAMIN, the XMM will refuse the request. HMAMIN defaults
- to 1 unless it is set by a parameter to the XMM.
-
- ReleaseHMA releases the HMA. It takes no parameters.
-
-
-
- A20 FUNCTIONS
-
- XMS has four A20 functions: GlobalEnableA20 (GE), GlobalDisableA20
- (GD), LocalEnableA20 (LE), and LocalDisableA20 (LD). These four
- switches turn on/off the 21st address line, A20. When you turn A20
- off, you cannot access any odd megabytes of extended memory,
- including the HMA. The XMS specification states that the Global
- functions "should only be used by programs which have control of the
- HMA." Additionally, the Local functions "should only be used by a
- programs which need direct access to extended memory." Read the
- history section if you want background on these functions.
-
-
-
- EMB FUNCTIONS
-
- XMS has seven EMB functions (not counting its SuperEMB functions,
- described later): CreateEMB (CE), FreeEMB (FE), MoveEMB (ME), LockEMB
- (LKE), UnlockEMB (UE), QueryEMB (QE), and ResizeEMB (RE).
-
- CreateEMB xxxx allocates a EMB of size xxxxK and returns the number of
- the handle.
-
- FreeEMB xxxx frees the EMB handle xxxx.
-
- MoveEMB tttt uuuu vvvv:wwww xxxx yyyy:zzzz moves a block of data of
- length tttt (in bytes) from EMB handle uuuu beginning at address
- vvvv:wwww to EMB handle xxxx beginning at address yyyy:zzzz. (vvvv:wwww
- and yyyy:zzzz are 32-bit flat addresses that are offsets from the base
- address of their respective handles uuuu and xxxx).
-
- LockEMB xxxx locks EMB handle xxxx. You cannot free or resize a
- locked EMB. You can lock a handle up to 255 times.
-
- UnlockEMB xxxx unlocks EMB handle xxxx. Unlocking only removes one
- lock.
-
- QueryEMB xxxx returns the size and lock count of EMB handle xxxx.
-
- ResizeEMB xxxx yyyy resizes EMB handle xxxx to size yyyyK.
-
-
- UMB FUNCTIONS
-
- XMS has three UMB functions: CreateUMB (CU), FreeUMB (FU), and
- ResizeUMB (RU).
-
- CreateUMB xxxx creates a UMB of size xxxxP (P stands for paragraphs,
- which are 16-byte units) and returns the segment address of the UMB.
-
- FreeUMB xxxx frees the UMB at the segment xxxx.
-
- ResizeUMB xxxx yyyy resizes the UMB at segment xxxx to size yyyyP (p
- stands for paragraphs).
-
-
-
-
- SUPER FUNCTIONS
-
- Beginning with version 3, the XMS specification can handle EMBs of
- size up to 4,096 megabytes. This required adding new functions. If
- you have a version 3 manager and more than 64 megabytes of extended
- memory, you can use these functions. XMS has three SuperEMB
- functions: SuperCreateEMB (SCE), SuperQueryEMB (SQE),
- SuperResizeEMB (SRE).
-
- SuperCreateEMB xxxx creates an EMB of size xxxxM (megabytes).
-
- SuperQueryEMB xxxx returns the size (up to 4,096M) and lock count of
- EMB handle xxxx.
-
- SuperResizeEMB xxxx yyyy resizes EMB handle xxxx to size yyyyM
- (megabytes).
-
-
- ADDITIONAL XMS.COM FUNCTIONS
-
- In addition to the functions that allow you to exercise the XMS
- specification, XMS.COM has some additional functions:
-
- DIR lists all your EMBs by handle. It reports the length, starting
- address and lock count for each handle.
-
- OFF turns off all XMS functions.
-
- ON turns XMS functions back on again if turned off with XMS OFF.
-
- SAVE xxxx yyyyyyyy.zzz saves EMB handle xxxx as file yyyyyyyy.zzz
-
- LOAD yyyyyyyy.zzz allocates an EMB, loads file yyyyyyyy.zzz into
- this EMB, then reports the name of the handle into which it loaded
- it. Because an XMM can allocate EMBs only in increments of
- kilobytes, LOAD will round up to the next kilobyte to accommodate
- the file.
-
- HELP displays a usage message for all parameters.
-
- ? displays a list of all parameters and their abbreviations.
-
- Please note that there is absolutely no security in the XMS
- specification. If some program (even DOS) uses the HMA, the XMS
- specification does not prevent another program from deallocating the HMA
- and using it for its own purposes. This holds true for deallocating an
- EMB or a UMB. If you deallocate the HMA, a UMB or an EMB that another
- program is using and use that memory for another purpose, the first user
- of the HMA (or that UMB or EMB) will malfunction when it tries to use
- that memory, quite possibly causing a crash. XMS.COM has NO active
- security to prevent you from doing anything the XMS specification
- allows.
-
-
-
- HISTORY
-
- EXTENDED MEMORY
-
- The original IBM PC could address only one megabyte of address
- space. With the advent of the AT we had to figure out what to do
- with sixteen megabytes of address space. Had we shifted to an
- operating system written for the 80286, we would have had no problem.
- But we stuck with DOS. DOS could do nothing with the memory above
- one megabyte (or so we originally thought). Indeed, because of the way
- the 8088 worked, PC manufacturers had to disable the 21st address line
- (A20) on 80286s to prevent access to the memory above one megabyte. They
- did this by putting a electronic switch on A20 that could be flipped
- by sending an instruction to the keyboard controller chip
-
- Because we continued to use DOS with the 80286, we had to separate
- "normal" memory (beneath one megabyte) from the memory beginning at
- one megabyte. We called the latter extended memory. In the
- beginning, no one had a use for extended memory. Then IBM wrote a
- ram disk, VDISK, that worked by suspending the operation of DOS for a
- brief period of time, switching into protected mode (the mode
- necessary to use extended memory, and a mode in which DOS cannot run),
- moving the desired information to/from its target in "normal"
- memory, then switching back to real mode (the mode in which DOS
- runs). This may sound slow but it worked much faster than accessing
- even a fast hard disk. Later, some disk caches and print spoolers used
- extended memory and then some very large programs figured out how to run
- in protected mode but still use the services of DOS (DOS extenders).
-
- HMA
-
- To maintain compatibility with the 8080 (the 8-bit processor the
- 8088 replaced) the 8088 addresses memory by adding the contents of two
- numbers, a segment register, shifted left four times (i.e., multiplied
- by 16), plus an offset (supplied from another register, a memory
- location, or a processor instruction). This allows you to run CP/M on
- your 8088 (or even your 80486, for that matter). On an 8088, when these
- two numbers add up to a sum greater than one megabyte, the 8088 "wraps
- around" and accesses the bottom 64K of the address space instead of the
- non-existent address above one megabyte. On a processor like the 80286,
- the address greater than one megabyte can actually exist, so the CPU
- accesses it instead: unless you disable A20.
-
- Quarterdeck programmers saw that if you enabled A20, you could
- actually use the first 64K (minus 16 bytes) of extended memory without
- having to leave DOS's real mode. This strategy required a few tricks to
- make it work safely, but by 1987 DESQview put nearly 64K bytes of itself
- into this piece of the address space, decreasing its overhead in lower
- memory by about the same amount.
-
- Beginning with DOS version 5 Microsoft figured out how to put a
- piece of DOS into this portion of the address space. Microsoft
- calls this piece of memory the HMA.
-
- How do you understand the addressing quirk that makes the HMA possible?
- In hexadecimal, one megabyte = 100000. DOS only knows about 16-bit
- registers. You can only fit four hex digits into a 16-bit register
- limiting it to FFFF (64K minus 1). To access more than 64K, the 8088
- generates 20-bit addresses (five hexadecimal digits) by shifting the
- segment register left 4 times (or one place in hex) and adding another
- 4-digit number, which we call the offset. For example:
-
- 1000:1000 = 10000 + 1000 = 11000 = 68K
- 1100:0000 = 11000 + 0000 = 11000 = 68K
- 1010:0F00 = 10100 + 0F00 = 11000 = 68K
- 5678:1234 = 56780 + 1234 = 57A14 = 350K + 532 bytes
- FFFF:FFFF = FFFF0 + FFFF = 10FFEF = 1087K + 1007 bytes
-
- An 8088 would have no address lines to accommodate the most significant
- digit of this last sum, so it would access 0FFEF, 63K + 1007 bytes,
- instead. With the A20 line disabled, so would an 80286 (or 80386 or
- 80486 or Pentium...), thus maintaining compatibility with the 8088.
- With A20 enabled, segment-offset addressing thus extends almost 64K
- beyond the first megabyte.
-
-
- UMBs
-
- When IBM partitioned the one megabyte of address space that the 8088
- could address, it reserved the top 384K for ROMs and hardware.
- Almost everyone has a system BIOS ROM in the top 64K (F000-FFFF,
- 960K - 1024K). The VGA card puts graphics in A000-AFFF (640K -
- 704K) and color text in B800 - BFFF (736K - 768K) or monochrome text in
- B000 - B7FF (704K - 736K). Most VGA cards have a 32K ROM at
- C000-C7FF (768K - 800K). You may have a network card or disk
- controller or some other adapter card that uses a portion of the
- address space in this area for a ROM or RAM. Almost everyone has
- vacant address space in this region though--address space DOS
- programs can use if only usable RAM occupied it.
-
- The EMS (Expanded Memory Services) specification has provision for
- mapping memory into vacant addresses in this portion of the address
- space. Before the 386, computers with suitable EMS cards could map
- memory into this portion of the address space and use it with DOS
- programs. Quarterdeck's DESQview pioneered use of this address
- space. When the 386 came out, many programs could use EMS but few
- could use extended memory. 386 owners bought EMS emulators, such as
- QEMM, to turn their then not-so-useful extended memory into EMS.
- These EMS emulators could map memory into this portion of the
- address space. Programs that so chose could allocate this memory and
- have more conventional memory available.
-
- Then Quarterdeck wrote the LOADHI programs to load programs into this
- memory. The programs loaded by LOADHI knew nothing about the High RAM
- an EMM could create. Version 2 of the XMS specification added support
- for Upper Memory Blocks, which is the XMS term equivalent to the High
- RAM that QEMM puts between 640K and 1024K. Upper Memory Blocks have
- nothing to do with extended memory. Even today an XMS manager does not
- have to support any UMB functions (e.g., Microsoft's HIMEM.SYS).
- And computers without extended memory can still have UMBs (e.g., users
- of Quarterdeck's QRAM).
-
- XMS SPECIFICATION
-
- We had no rules for the use of extended memory when it first came
- into existence. IBM created a de facto specification with the way
- VDISK reserved extended memory. Some programs that used extended
- memory reserved all extended memory for themselves to ensure that no
- subsequent program tried to use their extended memory mistakenly.
-
- In 1988 Microsoft drew up a specification for the use of extended
- memory They called the 64K (minus 16 bytes) just above one megabyte
- the HMA. The specification allowed for the enabling and disabling
- of the A20 line and the allocation and deallocation of the HMA. It
- included separate enabling and disabling of the A20 line for HMA
- users and extended memory users. It had functions to allocate
- extended memory above the HMA in increments of one kilobyte up to
- 64MB (the amount you can specify with a 16-bit register). Version 2
- added support for UMBs (see UMBS section above). Version 3 of the
- XMS specification added support for resizing UMBs and for handling
- EMBs up to 4,096M in size.
-
- <<END OF FILE>>
-