home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / program / c / XMS_200.ZIP / XMS_200.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-17  |  8.8 KB  |  268 lines

  1. /*****************************************************************************\
  2.  
  3.                TriHex XMS Extended Memory ToolBox - Version 2.00
  4.  
  5.                   Copyright (c) 1991 TriHex Universal Systems.
  6.                               All rights reserved.
  7.  
  8.  
  9.         Class       : XMS Extended Memory Managment (Version 2.00)
  10.  
  11.         Author      : Fernando Manuel InĂ¡cio Carreiro
  12.  
  13.         File        : XMS_200.H (for XMS_200.C)
  14.  
  15.         Description : Header file for XMS Extended Memory Toolbox.
  16.  
  17.         Portability : ANSI Standard C
  18.  
  19.         Dependency  : Borland Turbo C++ (Version 1.00)
  20.                       Borland Turbo Assembler (Version 2.0)
  21.                       XMS Memory Handler (Version 2.00 or later)
  22.                       IBM PC-DOS Version 3.3 or later
  23.                       IBM PC/XT/AT Hardware Environment
  24.  
  25. \*****************************************************************************/
  26.  
  27. /* Check if Header file has been included allready */
  28.  
  29.    #ifndef __XMS_200
  30.  
  31.       #define __XMS_200
  32.  
  33.       /* Include Files */
  34.  
  35.          #include <TypeDefs.H> // Special Type Definitions
  36.  
  37.  
  38.       /* Define XMS Data Types */
  39.  
  40.          typedef uword  XMS_Handle;  // XMS Handle
  41.          typedef ubyte  XMS_Status;  // XMS Error Status
  42.          typedef udword XMS_Address; // 32-Bit Linear Address
  43.          typedef uword  XMS_UMB_Seg; // XMS Upper Memory Block Segment
  44.  
  45.          typedef
  46.            union
  47.              {
  48.                udword    Offset;  // 32-bit Offset into XMS Block
  49.                void far *Pointer; // Seg:Ofs Pointer into Standard Memory
  50.              }
  51.            XMS_Pointer;
  52.  
  53.          typedef
  54.            struct
  55.              {
  56.                uword       Handle;   // XMS Handle / 0000h - Standard Memory
  57.                XMS_Pointer Position; // Offset or Pointer
  58.              }
  59.            XMS_Position;
  60.  
  61.          typedef
  62.            struct
  63.              {
  64.                udword       Size;        // Number of bytes to transfer
  65.                XMS_Position Source,      // Source Position
  66.                             Destination; // Destination Position
  67.              }
  68.            XMS_Transfer; // XMS Copy Transfer Information Structure
  69.  
  70.  
  71.  
  72.       /* Define XMS Constants */
  73.  
  74.          #define XMS_All_Memory        0xFFFF // Request all memory
  75.  
  76.  
  77.       /* Define XMS Version 2.00 Status & Errors */
  78.  
  79.          #define XMS_Ok                0x00 // Succesful
  80.  
  81.          #define XMS_Not_Implemented   0x80 // Function not implemented
  82.          #define XMS_VDisk_Detected    0x81 // VDisk was detected
  83.          #define XMS_A20_Error         0x82 // An A20 error occurred
  84.          #define XMS_General_Error     0x8E // A general driver error
  85.          #define XMS_Unrecoverable     0x8F // Unrecoverable driver error
  86.          #define XMS_No_HMA            0x90 // HMA does not exist
  87.          #define XMS_HMA_In_Use        0x91 // HMA is already in use
  88.          #define XMS_DX_Less_HMAMin    0x92 // DX is less than /HMAMin=
  89.          #define XMS_HMA_Not_Alloc     0x93 // HMA is not allocated
  90.          #define XMS_A20_Active        0x94 // A20 line is still enabled
  91.          #define XMS_Memory_Allocated  0xA0 // All Extended memory allocated
  92.          #define XMS_Handles_Allocated 0xA1 // All Handles allocated
  93.          #define XMS_Invalid_Handle    0xA2 // Invalid Handle
  94.          #define XMS_Src_Hdl_Invalid   0xA3 // Source      Handle Invalid
  95.          #define XMS_Src_Ofs_Invalid   0xA4 // Source      Offset Invalid
  96.          #define XMS_Dst_Hdl_Invalid   0xA5 // Destination Handle Invalid
  97.          #define XMS_Dst_Ofs_Invalid   0xA6 // Destination Offset Invalid
  98.          #define XMS_Length_Invalid    0xA7 // Length Invalid
  99.          #define XMS_Overlap_Invalid   0xA8 // Move has an Invalid Overlap
  100.          #define XMS_Parity_Error      0xA9 // Parity Error Occured
  101.          #define XMS_Block_Not_Locked  0xAA // Block is not locked
  102.          #define XMS_Block_Locked      0xAB // Block is Locked
  103.          #define XMS_Lock_Overflow     0xAC // Block Lock count Overflowed
  104.          #define XMS_Lock_Failed       0xAD // Block Lock Failed
  105.          #define XMS_Only_Smaller_UMB  0xB0 // Only smaller UMB available
  106.          #define XMS_No_UMB_Available  0xB1 // No UMB Available
  107.          #define XMS_UMB_Invalid       0xB2 // UMB Segment number invalid
  108.  
  109.  
  110.       /* Define XMS A20 Line Types */
  111.  
  112.          #define XMS_A20_Global        0x03 // A20 Global Enable/Disable
  113.          #define XMS_A20_Local         0x05 // A20 Local  Enable/Disable
  114.  
  115.  
  116.       /* Define XMS Access Functions */
  117.  
  118.          /* Check if XMS Exists */
  119.  
  120.             boolean pascal _XMS_Check(void);
  121.  
  122.               // Must be called, before using other functions
  123.               // Returns TRUE if XMS exists, FALSE otherwise
  124.  
  125.  
  126.          /* Get XMS Version */
  127.  
  128.             udword pascal _XMS_Version(void);
  129.  
  130.               // Returns Double Word, LSW = Revision(BCD), USW = Version(BCD)
  131.  
  132.  
  133.          /* Check if HMA Exists */
  134.  
  135.             boolean pascal _XMS_Check_HMA(void);
  136.  
  137.               // Returns TRUE if HMA exists, FALSE otherwise
  138.  
  139.  
  140.          /* Request HMA */
  141.  
  142.             XMS_Status pascal _XMS_Request_HMA(uword Size);
  143.  
  144.               // Size = XMS_All_Memory if Application Request
  145.               // Returns the XMS Status
  146.  
  147.  
  148.          /* Release HMA */
  149.  
  150.             XMS_Status pascal _XMS_Release_HMA(void);
  151.  
  152.               // Returns the XMS Status
  153.  
  154.  
  155.          /* Enable/Disable A20 Line */
  156.  
  157.             XMS_Status pascal _XMS_A20_Line(ubyte Type, toggle State);
  158.  
  159.               // Type = XMS_Global or XMS_Local
  160.               // State = ON or OFF
  161.               // Returns the XMS Status
  162.  
  163.  
  164.          /* Query State of A20 Line */
  165.  
  166.             XMS_Status pascal _XMS_A20_State(toggle *State);
  167.  
  168.               // Returns State = ON or OFF
  169.               // Returns the XMS Status
  170.  
  171.  
  172.          /* Query State of XMS Total & Largest Available Block Memory */
  173.  
  174.             XMS_Status pascal _XMS_Memory_State(uword *Total, uword *Largest);
  175.  
  176.               // Returns Total = Total Amount of Free XMS in KBytes
  177.               // Returns Largets = Largest Free XMS Block in KBytes
  178.               // Returns the XMS Status
  179.  
  180.  
  181.          /* Allocate XMS Memory */
  182.  
  183.             XMS_Status pascal _XMS_Allocate(uword Size, XMS_Handle *Handle);
  184.  
  185.               // Size = Amount of XMS to Allocate in KBytes
  186.               // Returns Handle = XMS Block Handle
  187.               // Returns the XMS Status
  188.  
  189.  
  190.          /* ReAllocate XMS Memory */
  191.  
  192.             XMS_Status pascal _XMS_ReAllocate(uword Size, XMS_Handle Handle);
  193.  
  194.               // Size   = Amount of XMS to ReAllocate in KBytes
  195.               // Handle = XMS Block Handle to Adjust Size
  196.               // Returns the XMS Status
  197.  
  198.  
  199.          /* Release XMS Memory */
  200.  
  201.             XMS_Status pascal _XMS_Release(XMS_Handle Handle);
  202.  
  203.               // Handle = XMS Block Handle to Release
  204.               // Returns the XMS Status
  205.  
  206.  
  207.          /* Copy XMS Memory */
  208.  
  209.             XMS_Status pascal _XMS_Copy(XMS_Transfer *Copy_Info);
  210.  
  211.               // Copy_Info = XMS_Transfer Structure Information for Copy
  212.               // Returns the XMS Status
  213.  
  214.  
  215.          /* Lock XMS Memory */
  216.  
  217.             XMS_Status pascal _XMS_Lock
  218.               (XMS_Handle Handle, XMS_Address *Address);
  219.  
  220.               // Handle = XMS Block Handle to Lock
  221.               // Returns Address = 32-Bit Linear Address of Block
  222.               // Returns the XMS Status
  223.  
  224.  
  225.          /* UnLock XMS Memory */
  226.  
  227.             XMS_Status pascal _XMS_UnLock(XMS_Handle Handle);
  228.  
  229.               // Handle = XMS Block Handle to UnLock
  230.               // Returns the XMS Status
  231.  
  232.  
  233.          /* Get XMS Handle Information */
  234.  
  235.             XMS_Status pascal _XMS_Handle_Info
  236.               ( XMS_Handle  Handle, uword *Size, ubyte *Lock_Count,
  237.                                            ubyte *Available_Handles );
  238.  
  239.               // Handle = XMS Block Handle to get Information
  240.               // Returns Size = Size of XMS Block in KBytes
  241.               // Returns Lock_Count = Count of Locks on Handle
  242.               // Returns Available_Handles = Number of Free Handles
  243.               // Returns the XMS Status
  244.  
  245.  
  246.          /* Request Upper Memory Block */
  247.  
  248.             XMS_Status pascal _XMS_Request_UMB
  249.               (uword *Size, XMS_UMB_Seg *Segment);
  250.  
  251.               // Size = Size Required for UMB
  252.               // Returns Size = Actual Largest Available Size
  253.               // Returns Segment = Segment of UMB or 0 if Error
  254.               // Returns the XMS Status
  255.  
  256.  
  257.          /* Release Upper Memory Block */
  258.  
  259.             XMS_Status pascal _XMS_Release_UMB(XMS_UMB_Seg Segment);
  260.  
  261.               // Segment = Segment of UMB
  262.               // Returns the XMS Status
  263.  
  264.  
  265.    #endif
  266.  
  267.  
  268. /*****************************************************************************/