[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
*-------------------------------------------------------------------------
* FORCE XMS interface routines for the FORCE FAQ
*-------------------------------------------------------------------------
#ifndef XMS_HDR
#define XMS_HDR

#include defs.hdr
#include alloc.hdr
*-------------------------------------------------------------------------
* The following prototypes are for the functions that deal
*      directly with the XMS driver.
*-------------------------------------------------------------------------
FUNCTION LOGICAL xms_installed PROTOTYPE

FUNCTION LONG xms_get_driver PROTOTYPE  && This is an address

FUNCTION UINT xms_get_version PROTOTYPE  && returned in BCD

FUNCTION INT xms_avail PROTOTYPE                && In K-bytes

FUNCTION LOGICAL xms_alloc PROTOTYPE
   PARAMETERS INT handle, VALUE INT k_bytes_requested

PROCEDURE xms_free PROTOTYPE
   PARAMETERS INT handle

FUNCTION LOGICAL xms_copy PROTOTYPE
   PARAMETERS VALUE INT s_handle, VALUE LONG s_offset, ;
              VALUE INT d_handle, VALUE LONG d_offset, ;
              VALUE LONG m_length      && In Bytes

FUNCTION &POINTER xms_lock PROTOTYPE
   PARAMETERS INT handle

FUNCTION INT xms_unlock PROTOTYPE
   PARAMETERS INT handle
*-------------------------------------------------------------------------
* Wrapper functions to make the xms_copy() function work a little more
* smoothly.  You can use these a little easier....
*-------------------------------------------------------------------------
FUNCTION LOGICAL xms_insert PROTOTYPE
   PARAMETERS UNTYPED    thing,     VALUE INT d_handle, ;
              VALUE LONG d_offset,  VALUE LONG m_length     && In Bytes

FUNCTION LOGICAL xms_retrieve PROTOTYPE
   PARAMETERS VALUE INT s_handle, VALUE LONG s_offset, ;
              UNTYPED   thing,    VALUE LONG m_length    && in Bytes
*-------------------------------------------------------------------------
* Prototypes for grabbing the High Memory Area (HMA).
*-------------------------------------------------------------------------
FUNCTION LOGICAL hma_alloc PROTOTYPE

PROCEDURE hma_free PROTOTYPE
*-------------------------------------------------------------------------
FUNCTION LOGICAL call_driver PROTOTYPE         && Returns .F. if the
  PARAMETERS VALUE LONG drv_address,;          && Carry bit is set when
                   UINT ax,         UINT bx,;  && the driver returns.
                   UINT cx,         UINT dx,;
                   UINT si,         UINT di,;
                   UINT bp,         UINT ds,;
                   UINT es
*-------------------------------------------------------------------------
* The following prototypes provide some error handling...
*-------------------------------------------------------------------------
PROCEDURE xms_set_error PROTOTYPE
   PARAMETERS VALUE UINT ax, VALUE UINT bx

FUNCTION UINT xms_get_error PROTOTYPE

*  FUNCTION CHAR xms_strerror PROTOTYPE      && Just an idea...
*    PARAMETERS VALUE UINT errno
*-------------------------------------------------------------------------
* Mneumonic definitions for XMS driver services
*-------------------------------------------------------------------------
#define XMS_GETDRIVER      0x4310
#define XMS_GETVERSION     0x0000
#define XMS_GET_HMA        0x0100
#define XMS_FREE_HMA       0x0200
#define XMS_QUERY_A20      0x0700
#define XMS_MEM_AVAIL      0x0800
#define XMS_ALLOC_MEM      0x0900
#define XMS_FREE_MEM       0x0A00
#define XMS_MOVE_MEM       0x0B00
#define XMS_LOCK_HND       0x0C00
#define XMS_UNLOCK_HND     0x0D00
#define XMS_HND_INFO       0x0E00
#define XMS_REALLOC_MEM    0x0F00
*-------------------------------------------------------------------------
* XMS driver Error codes -- reference through xms_get_error()
*-------------------------------------------------------------------------
#define X_NO_DRIVER        0x00   && Driver is not present
#define X_NOT_IMPLEMENTED  0x80   && the function is not implemented
#define X_VDISK            0x81   && a VDISK device is detected
#define X_A20_ERROR        0x82   && an A20 error occurs
#define X_GENERAL_ERROR    0x8E   && a general driver error occurs
#define X_UNREC_ERROR      0x8F   && an unrecoverable driver error occurs
#define X_NO_HMA           0x90   && the HMA does not exist
#define X_HMA_USED         0x91   && the HMA is already in use
#define X_HMAIN_ERR        0x92   && DX is less than the /HMAMIN= parameter
#define X_HMA_NOT_ALLOC    0x93   && the HMA is not allocated
#define X_A20_ENABLED      0x94   && the A20 line is still enabled
#define X_NO_XMS_MEM       0xA0   && all extended memory is allocated
#define X_NO_XMS_HANDLES   0xA1   && all available extended memory handles are in use
#define X_HANDLE_ERR       0xA2   && the handle is invalid
#define X_SRCHANDLE_ERR    0xA3   && the SourceHandle is invalid
#define X_SRCOFFSET_ERR    0xA4   && the SourceOffset is invalid
#define X_DESTHANDLE_ERR   0xA5   && the DestHandle is invalid
#define X_DESTOFFSET_ERR   0xA6   && the DestOffset is invalid
#define X_LENGTH_INVALID   0xA7   && the Length is invalid
#define X_OVERLAP_ERR      0xA8   && the move has an invalid overlap
#define X_PARITY_ERR       0xA9   && a parity error occurs
#define X_NO_LOCK          0xAA   && the block is not locked
#define X_LOCKED           0xAB   && the block is locked
#define X_LOCK_OVERFLOW    0xAC   && the block's lock count overflows
#define X_LOCK_ERR         0xAD   && the lock fails
#define X_SMALLER_UMB      0xB0   && a smaller UMB is available
#define X_NO_UMB           0xB1   && no UMBs are available
#define X_SEGMENT_ERR      0xB2   && the UMB segment number is invalid

#endif      && XMS_HDR


This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson