home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
pascal
/
vdl020d.zip
/
VXMS.DOC
< prev
Wrap
Text File
|
1993-04-14
|
20KB
|
938 lines
{
════════════════════════════════════════════════════════════════════════════
Visionix Extended Memory Services Unit (VXMS)
Copyright 1991,92,93 Visionix
ALL RIGHTS RESERVED
────────────────────────────────────────────────────────────────────────────
Revision history in reverse chronological order:
Initials Date Comment
──────── ──────── ────────────────────────────────────────────────────────
mep 03/25/93 Merged with VMemLow XMS routines.
lpg 03/15/93 Added Source Documentation
mep 02/11/93 Cleaned up code for beta release
jrt 02/08/93 Sync with beta 0.12 release
lpg 12/27/92 Cleaned up Unit
jrt 12/07/92 Sync with beta 0.11 release
lpg 11/25/92 Debugged ASM Routines
jrt 11/21/92 Sync with beta 0.08
mep/lpg 11/18/92 First logged revision.
────────────────────────────────────────────────────────────────────────────
}
Unit
VXMS;
Uses
VTypes,
DOS;
{────────────────────────────────────────────────────────────────────────────}
Type
TXMSError = BYTE;
TXMBHandle = WORD;
TXMSHandleOfs = LONGINT;
TXMSHandle = WORD;
PXMSHandle = ^TXMSHandle;
TXMSMoveData = RECORD
Count : LONGINT; { 32-bit, num bytes to trans }
Source : TXMBHandle;
SourceOfs : TXMSHandleOfs;
Dest : TXMBHandle;
DestOfs : TXMSHandleOfs;
END;
PXMSMoveData = ^TXMSMoveData;
{────────────────────────────────────────────────────────────────────────────}
{----------}
{ XMS 2.0+ }
{----------}
Function VXMSErrorToStr( Status : BYTE ) : STRING;
Function VXMSInstalled : BOOLEAN;
Procedure VXMSGetHandleAddr;
Function VXMSGetVersion : WORD;
Function VXMMGetVersion : WORD;
Function VHMAPresent : BOOLEAN;
Function VHMANew : TXMSError;
Function VHMANewTSR( HMABytes : WORD ) : TXMSError;
Function VHMADispose : TXMSError;
Function VA20GlobalEnable : TXMSError;
Function VA20GlobalDisable : TXMSError;
Function VA20LocalEnable : TXMSError;
Function VA20LocalDisable : TXMSError;
Function VA20Query : TXMSError;
Function VXMSGetFreeStat( Var MaxBlock : WORD;
Var TotalK : WORD ) : TXMSError;
Function VXMSGetMaxBlock : WORD;
Function VXMSGetTotalFreeK : WORD;
Function VXMBNew( SizeInK : WORD;
Var Handle : TXMBHandle ) : TXMSError;
Function VXMBDispose( Handle : TXMBHandle ) : TXMSError;
Function VXMBMove( MoveData : PXMSMoveData) : TXMSError;
Function VXMBMoveBlock( Count : LONGINT;
Source : TXMBHandle;
SourceOfs : TXMSHandleOfs;
Dest : TXMBHandle;
DestOfs : TXMSHandleOfs ) : TXMSError;
Function VXMBMoveMainToXMB( Count : WORD;
FromPtr : POINTER;
ToHandle : TXMBHandle;
ToOfs : TXMSHandleOfs ) : TXMSError;
Function VXMBMoveXMBToMain( Count : WORD;
ToPtr : POINTER;
FromHandle : TXMBHandle;
FromHandleOfs: TXMSHandleOfs ) : TXMSError;
Function VXMBLock( Handle : TXMBHandle ) : TXMSError;
Function VXMBUnLock( Handle : TXMBHandle ) : TXMSError;
Function VXMBGetInfo( Handle : TXMBHandle;
Var LockCount : BYTE;
Var FreeHandles : BYTE;
Var SizeInK : WORD ) : TXMSError;
Function VXMBResize( NewSizeK : WORD;
Handle : TXMBHandle ) : TXMSError;
Function VUMBNew( SizeInPara : WORD;
Var SegOfUMB : WORD;
Var SizeAlloc : WORD;
Var MaxAvail : WORD ) : TXMSError;
Function VUMBDispose( SegOfUMB : WORD ) : TXMSError;
{────────────────────────────────────────────────────────────────────────────}
{---------}
{ XMS 3.0 }
{---------}
Function VUMBResize( SegOfUMB : WORD;
NewSize : WORD ) : TXMSError;
Function VXMSQueryFreeXM( Var MaxBlock : LONGINT;
Var HighByte : LONGINT;
Var TotalK : LONGINT ) : TXMSError;
Function VXMSNew( SizeInK : LONGINT;
Var Handle : TXMBHandle ) : TXMSError;
Function VXMSGetInfo( Handle : TXMBHandle;
Var LockCount : BYTE;
Var FreeHandles : WORD;
Var SizeInK : LONGINT ) : TXMSError;
Function VXMSReSize( Handle : TXMBHandle;
NewSizeK : LONGINT ) : TXMSError;
{────────────────────────────────────────────────────────────────────────────}
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMSErrorToStr( Status : BYTE ) : STRING;
[PARAMETERS]
Status XMS Status Code
[RETURNS]
XMS Text Error Message.
[DESCRIPTION]
Takes the XMS Error Code Value and converts it into a Text Message.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMSInstalled : BOOLEAN;
[PARAMETERS]
(None)
[RETURNS]
Whether XMS Services are Available (TRUE=Yes)
[DESCRIPTION]
Determines whether Extended Memory Services (XMS) are Available, and
if so Reports TRUE, else FALSE.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Procedure VXMSGetHandleAddr;
[PARAMETERS]
(None)
[RETURNS]
(None)
[DESCRIPTION]
This function Gets the Extended Memory Services Address Handle and Stores
it in a Unit Local Variable.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMSGetVersion : WORD;
[PARAMETERS]
(None)
[RETURNS]
The XMS Version Number
[DESCRIPTION]
Returns the Extended Memory Services (XMS) Version Number. The High-Byte
being the Major Version Number, and the Low-Byte being the Minor Version
Number.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMMGetVersion : WORD;
[PARAMETERS]
(None)
[RETURNS]
The XMM Version Number
[DESCRIPTION]
Returns the Extended Memory Manager (XMM) Version Number. The High-Byte
being the Major Version Number, and the Low-Byte being the Minor Version
Number.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VHMAPresent : BOOLEAN;
[PARAMETERS]
(None)
[RETURNS]
Whether HMA Support is Available (TRUE=Yes)
[DESCRIPTION]
Determines whether High Memory Address (HMA) Support is Available, and
if so Reports TRUE, otherwise FALSE.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VHMANew : TXMSError;
[PARAMETERS]
(None)
[RETURNS]
HMA Error Code (0=Success)
[DESCRIPTION]
This function allocates memory in High Memory Address (HMA).
This is a use Only for Non-TSR Programs. A TSR cannot use this Routine
to Allocate HMA Memory. It should use the VHMANewTSR Routine.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VHMANewTSR( HMABytes : WORD ) : TXMSError;
[PARAMETERS]
HMABytes Number of Bytes in HMA to Allocate
[RETURNS]
HMA Error Code (0=Success)
[DESCRIPTION]
This is a Special Routine Just to TSRs. A TSR cannot use the Normal HMA
Allocation Functions, and neither should a Normal Program use this Routine.
This function allocated Memory in High Memory Address (HMA).
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VHMADispose : TXMSError;
[PARAMETERS]
(None)
[RETURNS]
HMA Error Code (0=Success)
[DESCRIPTION]
Frees memory associate with the High Memory Address.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VA20GlobalEnable : TXMSError;
[PARAMETERS]
(None)
[RETURNS]
Whether the Global A20 Memory Line is Enabled.
[DESCRIPTION]
Determines and Reports whether the Global A20 Memory Line is Enabled.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VA20GlobalDisable : TXMSError;
[PARAMETERS]
(None)
[RETURNS]
Whether the Global A20 Memory Line is Disabled.
[DESCRIPTION]
Determines and Reports whether the Global A20 Memory Line is Disabled.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VA20LocalEnable : TXMSError;
[PARAMETERS]
(None)
[RETURNS]
Whether the Local A20 Memory Line is Enabled.
[DESCRIPTION]
Determines and Reports whether the Local A20 Memory Line is Enabled.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VA20LocalDisable : TXMSError;
[PARAMETERS]
(None)
[RETURNS]
Whether the Local A20 Memory Line is Disabled.
[DESCRIPTION]
Determines and Reports whether the Local A20 Memory Line is Disabled.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VA20Query : TXMSError;
[PARAMETERS]
(None)
[RETURNS]
Whether the A20 Memory Line Query is Enabled.
[DESCRIPTION]
Determines and Reports whether the A20 Memory Line Query is Enabled.
Note that a query action is only true if function returns no error -
this assumes line disabled if error.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMSGetFreeStat( Var MaxBlock : WORD;
Var TotalK : WORD ) : TXMSError;
[PARAMETERS]
MaxBlock VAR Returned Largest Available XMS Block
TotalK VAR Returned Total XMS Size in KiloBytes
[RETURNS]
Function : XMS Error Code (0=Success)
(VAR : [MaxBlock] Largest Available XMS Block)
(VAR : [TotalK] Total XMS Size in KiloBytes)
[DESCRIPTION]
Returns both the Largest Available Extended Memory Service (XMS) Block
but also the Total Size of the XMS in KiloBytes.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMSGetMaxBlock : WORD;
[PARAMETERS]
(None)
[RETURNS]
Largest XMS Block Available
[DESCRIPTION]
Returns the Largest Available Extended Memory Service (XMS) Block.
Value is in KiloBytes.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMSGetTotalFreeK : WORD;
[PARAMETERS]
(None)
[RETURNS]
Total Free K of XMS Memory
[DESCRIPTION]
Returns the Total Number of Free KiloBytes of Extended Memory Service (XMS)
Memory.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMBNew( SizeInK : WORD;
Var Handle : TXMBHandle ) : TXMSError;
[PARAMETERS]
SizeInK Desired XMB Memory Allocation in KiloBytes
Handle VAR Returned XMB Memory Handle
[RETURNS]
Function : XMB Error Code (0=Success)
(VAR : [Handle] XMB Memory Handle)
[DESCRIPTION]
Allocates memory to an XMB Memory Handle
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMBDispose( Handle : TXMBHandle ) : TXMSError;
[PARAMETERS]
Handle Handle to XMB Memory
[RETURNS]
XMB Error Code (0=Success)
[DESCRIPTION]
Frees memory associated with a previous allocated XMB Handle.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMBMove( MoveData : PXMSMoveData) : TXMSError;
[PARAMETERS]
MoveData Pointer to XMB Move Data Structure
[RETURNS]
XMB Error Code (0=Succes)
[DESCRIPTION]
Takes the XMB Move Data Structure and Moves the Data Accordingly.
Use XMBMoveBlock to Load the XMB Move Data Structure.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMBMoveBlock( Count : LONGINT;
Source : TXMBHandle;
SourceOfs : TXMSHandleOfs;
Dest : TXMBHandle;
DestOfs : TXMSHandleOfs ) : TXMSError;
[PARAMETERS]
Count Number of Bytes to Move
Source Source Address/Handle of Move Data
SourceOfs Source Address/Handle Offset of Move Data
Dest Destination Address/Handle of Move Data
DestOfs Destination Address/Handle Offset of Move Data
[RETURNS]
XMB Error Code (0=Success)
[DESCRIPTION]
Moves a Block of Memory from the Source Address/XMB Handle to the
Destination Address/XMB Handle. It is NOT Intended as a means of
Moving Main Memory Data to Main Memory but rather a means of moving
Data to/from XMB Memory.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMBMoveMainToXMB( Count : WORD;
FromPtr : POINTER;
ToHandle : TXMBHandle;
ToOfs : TXMSHandleOfs ) : TXMSError;
[PARAMETERS]
Count Number of Bytes to Move To XMB
FromPtr Pointer to Source of Moving Data
ToHandle Destination XMB Handle
ToHandleOfs Destination XMB Offset
[RETURNS]
XMB Error Code (0=Success)
[DESCRIPTION]
Moves a Block of Data from Main Memory (below 640K) to XMB Memory.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMBMoveXMBToMain( Count : WORD;
ToPtr : POINTER;
FromHandle : TXMBHandle;
FromHandleOfs : TXMSHandleOfs ) : TXMSError;
[PARAMETERS]
Count Number of Bytes to Move From XMB
ToPtr Pointer to Destination of Moved XMB Data
FromHandle Source XMB Handle
FromHandleOfs Source XMB Handle Offset
[RETURNS]
XMB Error Code
[DESCRIPTION]
Moves a Block of Data from XMB Memory to Main Memory (below 640K).
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMBLock( Handle : TXMBHandle ) : TXMSError;
[PARAMETERS]
Handle XMB Handle to Lock
[RETURNS]
XMB Error Code (0=Success)
[DESCRIPTION]
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMBUnLock( Handle : TXMBHandle ) : TXMSError;
[PARAMETERS]
Handle XMB Handle to UnLock
[RETURNS]
XMB Error Code (0=Success)
[DESCRIPTION]
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMBGetInfo( Handle : TXMBHandle;
Var LockCount : BYTE;
Var FreeHandles : BYTE;
Var SizeInK : WORD ) : TXMSError;
[PARAMETERS]
Handle XMB Handle
LockCount VAR Returned Number of XMB Locks
FreeHandles VAR Returned Number of Free XMB Handles
SizeInK VAR Returned XMB Handle Memory Allocation
[RETURNS]
Function : XMB Error Code
(VAR : [LockCount] Number of XMB Locks)
(VAR : [FreeHandles] Number of Free XMB Handles)
(VAR : [SizeInK] XMB Handle Memory Allocation)
[DESCRIPTION]
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VXMBReSize( NewSizeK : WORD;
Handle : TXMBHandle ) : TXMSError;
[PARAMETERS]
NewSizeK New XMB Allocation for XMB Handle
Handle Pre-Allocated Handle to XMB Memory
[RETURNS]
XMB Error Code (0=Success)
[DESCRIPTION]
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VUMBNew( SizeInPara : WORD;
Var SegOfUMB : WORD;
Var SizeAlloc : WORD;
Var MaxAvail : WORD ) : TXMSError;
[PARAMETERS]
SizeInPara Size of Desired UMB Allocation in Paragraphs
SegOfUMB VAR Returned Segment of UMB
SizeAlloc VAR Returned Size Allocation
MaxAvail VAR Returned Maximum UMB Space Available
[RETURNS]
Function : UMB Error Code (0=Success)
(VAR : [SegOfUMB] Segment of UMB)
(VAR : [SizeAlloc] Size Allocation)
(VAR : [MaxAvail] Maximum UMB Space Available)
[DESCRIPTION]
Allocates an Upper Memory Block (UMB) of a Specified Number of Paragraphs.
And Returns the Memory Allocation Information or an Error Code. Note that
MaxAvail is valid only if allocation error - if no error, it will be set
to $FFFF.
[SEE-ALSO]
[EXAMPLE]
──────────────────────────────────────────────────────────────────────────────
[FUNCTION]
Function VUMBDispose( SegOfUMB : WORD ) : TXMSError;
[PARAMETERS]
SegOfUMB Segment Address of UMB
[RETURNS]
UMB Error Code (0=Success)
[DESCRIPTION]
[SEE-ALSO]
[EXAMPLE]