All XMM-functions

last update: 06/2003

List of XMM-functions See descriptions down on this page.

function 00h: XMS-version

Get the drivers versionnumber.
Input:
AH = 00h
Output:
AX = version
BX = intern number
DX = HMA status (0-access not available; 1-access available)


function 01h: allocate the HMA

Allocates parts of the HMA.
Input:
AH = 01h
DX = required size in byte

Output:
AX = 0001h - okay (sorry, I don't know where's the adress)
AX = 0000h - error, BL contains errorcode

BL = 80h= unknown function  
     81h= VDISK-RAMDISK found  
     82h= A20 error  
     8Eh= drivererror  
     8Fh= error (not clearable!)  
     90h= HMA is not there  
     91h= HMA is already given away  
     92h= reqiured size is too less  
     93h= HMA not allocated (from your program)  
     94h= A20 still enabled  
     A0h= no extended memory free  
     A1h= no handle free  
     A2h= wrong handle  
     A3h= wrong source handle  
     A4h= wrong source offset  
     A5h= wrong destination handle  
     A6h= wrong destination offset  
     A7h= wrong length for MOVE-function  
     A8h= forbidden overlapping in MOVE-funtion  
     A9h= parity error  
     AAh= UMB is not locked  
     ABh= UMB is still locked  
     ACh= UMB counter overflow  
     ADh= UMB can't be locked  
     B0h= only smaller UMB available  
     B1h= no more UMB available  
     B2h= wrong UMB segment adress  

function 02h: free HMA

Gives the HMA free. If the calling program no TSR you really should do this!
Input:
AH = 02h
Output:
AX = 0001h - okay
AX = 0000h - error, BL contains errorcode


function 03h: activate A20 global

Give A20 free global. It is now also for free in real mode.
Input:
AH = 03h
Output:
AX = 0001h - okay
AX = 0000h - error, BL contains errorcode


function 04h: close A20 global

Close the A20.
Input:
AH = 04h
Output:
AX = 0001h - okay
AX = 0000h - error, BL contains errorcode


function 05h: activate A20 local

Input:
AH = 05h
Output:
AX = 0001h - okay
AX = 0000h - error, BL contains errorcode


function 06h: close A20 local

Opposite to function 05h. A20 will be closed. Every opening and closing will be counted. A20 is only really close, when openings and closings are equal.
Input:
AH = 06h
Output:
AX = 0001h - okay
AX = 0000h - error, BL contains errorcode


function 07h: get A20 status

A20 already free?
Input:
AH = 07h
Output:
AX = 0001h - A20 is free
AX = 0000h - A20 is not free. activating is necessary


function 08h: find out amount of free extended memory

Gives you the free extended memory at all and the largest free block. HMA is not counted!
Input:
AH = 08h
Output:
AX = size of largest block in kb
DX = free extended memory in kb


function 09h: allocate extended memory block (EMB)

Allocate an EMB. Always remember the handle, it's the only connection. If it is lost you can free the EMB only by reset.
Theres are only some free handles, so allocate always large areas to prevent a lack of handles.
Give the EMB free after closing the application.
Input:
AH = 09h
DX = required size in kb

Output:
AX = 0001h - okay (0000h - errorcode in BL)
DX = handle (only if it had success ;) )


function 0Ah: give EMB free

Handle and memory will be free after.
Input:
AH = 0Ah
DX = Handle

Output:
AX = 0001h - okay
AX = 0000h - error, BL contains errorcode


function 0Bh: copy RAM-area

Copies from konventional RAM to extended memory and the other way and also inside both kinds.
If the source or destination are konventional RAM the handle has to be 0 and the offset has to be the adress (OFF:SEG).
On an AT the adresses should be dividable by 2 and from a 386 on by 4.
If the areas overlap the source has to be before the destination!
Input:
AH = 0Bh
DS:SI = pointer on extended-memory-move-structure


extended-memory-move-structure
offset description type
+00h length of the block (in byte and even) 1 DWORD
+04h sourcehandle 1 WORD
+06h startoffset into sourceblock (copystart) 1 DWORD
+0Ah destinationhandle 1 WORD
+0Ch startoffset into destinationblock (copystart) 1 DWORD

Output:
AX = 0001h - okay
AX = 0000h - error, BL contains errorcode


function 0Ch: prevent EMB of moving

The memorymanager moves EMBs to provide best memoryusing.
Is a block locked you get the actual adress. An EMB can be locked more than once, but an internal counter gives the EMB only free, if the lock's and free's are equal.
Input:
AH = 0Ch
DX = handle

Output:
AX = 0001h - okay (0000h - errorcode in BL)
DX:BX = EMBs adress in linear 32-bit-form (no Seg:Off or anything)


function 0Dh: unlock EMB

Opposite to function 0Ch.
Input:
AH = 0Dh
DX = handle

Output:
AX = 0001h - okay
AX = 0000h - error, BL contains errorcode


function 0Eh: information about EMBs

Get several information including the internal counter which gives the EMB only free, when it is 0.
Input:
AH = 0Eh
DX = handle

Output:
AX = 0001h - okay (0000h - errorcode in BL)
BH = internal counter
BL = number of free handles
DX = EMB-length in kb


function 0Fh: change EMB-size

The EMB has to be unlocked.
Input:
AH = 0Fh
BX = new size in kb
DX = handle

Output:
AX = 0001h - okay
AX = 0000h - error, BL contains errorcode


function 10h: allocate UMB

Allocate an UMB in konventional RAM. This function is not available on every XMM and not on every hardware. Pay attention on errorcode!
If length is FFFFh you get the largest free UMB.
Do not overflow the boundaries of the UMB (given by segment adress and required size).
Input:
AH = 10h
DX = required size in paragraphs (16 byte)

Output:
AX = 0001h - okay
BX = segment adress
AX = 0000h - error (BL contains errorcode)
DX = maximum size for an UMB (in paragraphs)

function 11h: give UMB free
Input:
AH = 11h
DX = UMBs segmentadress

Output:
AX = 0001h - okay
AX = 0000h - error, BL contains errorcode


Thats all for the functions of the extended memory standard (XMS).