home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
GLEN
/
QLIB43.ZIP
/
EMS.DOC
< prev
next >
Wrap
Text File
|
1990-03-18
|
7KB
|
181 lines
Expanded Memory subroutines take advantage of expanded memory conforming
to the Lotus/Intel/Microsoft (LIM) Expanded Memory Specification (EMS).
Three primary versions of the EMS have been released: 3.0, 3.2 and 4.0.
QLIB's EMS subroutines will work with all EMS versions.
EMS memory is allocated in "pages" of 16k bytes (actually 16,384 bytes)
each.
Error codes returned by QLIB's EMS subroutines are:
0 = no error
&H80 = memory manager software error - non-recoverable
&H81 = expanded memory hardware error - non-recoverable
&H83 = invalid EMS handle
&H85 = no available EMS handles
&H87 = not enough memory pages
&H88 = not enough memory pages available
&H89 = you tried to allocate zero pages
Subroutine: EMS2DBL(handle%, value#, n%, oops%)
Subroutine: EMS2INT(handle%, value%, n%, oops%)
Subroutine: EMS2LNG(handle%, value&, n%, oops%)
Subroutine: EMS2SNG(handle%, value!, n%, oops%)
These subroutines copy value% (or #, &, !) from the nth element
of an array stored in expanded memory.
Example:
REM An integer array has been stored in expanded memory, but
REM I need to see what the 18th element of the array is.
REM The 18th element is n% = 17, since the first element is
REM n% = 0
n% = 17
CALL EMS2INT(handle%, value%, n%, oops%)
a$ = "The 18th element is" + STR$(value%)
PRINT a$
Subroutine: EMS2DBLArray(handle%, aSEG%, aPTR%, EMSptr%, n%, oops%)
Subroutine: EMS2INTArray(handle%, aSEG%, aPTR%, EMSptr%, n%, oops%)
Subroutine: EMS2LNGArray(handle%, aSEG%, aPTR%, EMSptr%, n%, oops%)
Subroutine: EMS2SNGArray(handle%, aSEG%, aPTR%, EMSptr%, n%, oops%)
These subroutines copy data from an EMS "file" to an array. See
INTArray2EMS for examples.
Subroutine: DBL2EMS(handle%, value#, n%, oops%)
Subroutine: INT2EMS(handle%, value%, n%, oops%)
Subroutine: LNG2EMS(handle%, value&, n%, oops%)
Subroutine: SNG2EMS(handle%, value!, n%, oops%)
Replaces the nth element of an array stored in expanded memory
with value% (or #, &, !). This subroutine is the complement of
EMS2INT (or DBL, LNG, SNG). See EMS2INT for examples.
Subroutine: DBLArray2EMS(handle%, aSEG%, aPTR%, EMSptr%, n%, oops%)
Subroutine: INTArray2EMS(handle%, aSEG%, aPTR%, EMSptr%, n%, oops%)
Subroutine: LNGArray2EMS(handle%, aSEG%, aPTR%, EMSptr%, n%, oops%)
Subroutine: SNGArray2EMS(handle%, aSEG%, aPTR%, EMSptr%, n%, oops%)
Copies an array to an EMS "file" opened by EMSopen. Handle% is
the "file" handle returned by EMSopen, aSEG% and aPTR% are segment
and offset pointers to the array, EMSptr% is the first array element
in the EMS file where copying begins, and n% is the number of array
elements to copy. Note that EMSptr% = 0 at the start of the EMS "file".
Example:
DIM a%(7999) ' a large integer array of 8000 elements
' this requires 16,000 bytes of EMS memory
' so only one EMS page is needed
n% = 8000
pages% = 1
CALL EMSopen(pages%, handle%, oops%)
IF oops% THEN ... ' branch to error handling stuff
EMSptr% = 0 ' start at the beginning of the memory block
aSEG% = VARSEG(a%(0)): aPTR% = VARPTR(a%(0))
CALL INTArray2EMS(handle%, aSEG%, aPTR%, EMSptr%, n%, oops%)
Subroutine: EMSclose(handle%, oops%)
Closes an EMS "file" opened by EMSopen and releases the
associated expanded memory. DOS will not release expanded memory
when the program ends, so you must use EMSclose for all open EMS
"files" before the program ends.
Example:
CALL EMSclose(handle%, oops%)
Subroutine: EMSReady(ready%)
Determines if EMS memory is installed in the computer. Returns
ready% = -1 if EMS is installed, ready% = 0 if not.
Example:
CALL EMSReady(ready%)
IF ready% THEN
PRINT "EMS is installed"
ELSE
PRINT "no EMS memory or driver not installed"
END IF
Subroutine: EMSVersion(maj%, min%)
Determines EMS version installed. Use EMSReady to determine if
EMS memory is installed.
Example:
CALL EMSVersion(maj%, min%)
Subroutine: EMSSize(total%, free%)
Determines the number of EMS memory pages available.
Example:
CALL EMSSize(total%, free%)
Subroutine: EMSopen(pages%, handle%, oops%)
"Opens" an EMS "file" for subsequent operations. You specify
how many EMS pages you want (16k bytes, each page), and EMSopen
returns a handle to use in read/write operations. DOS will not
release expanded memory when the program ends, so you must use
QLIB's EMSclose for all "open" EMS "files" before the program ends.
A maximum of 4 EMS pages (64k bytes) may be allocated to a handle.
Example:
CALL EMSopen(pages%, handle%,oops%)
Subroutine: EMSread(handle%, aseg%, aptr%, emsptr%, bytes%, oops%)
Copies data from an EMS file opened by EMSopen to an array.
aseg% and aptr% are segment and offset pointers to the array, bytes%
is the number of bytes to be copied, and handle% is the handle returned
by EMSopen. EMSptr% is the byte offset in the EMS "file" where you
want the read to start. Note that EMSptr% = 0 at the start of the
"file". This is a "generic" EMS read subroutine. Simplified subroutines
for copying to or from numeric arrays are also available (see EMS2Array
subroutines).
Example:
CALL EMSread(handle, aseg%, aptr, emsptr%, bytes%, oops%))
Subroutine: EMSwrite(handle%, aseg%, aptr%, emsptr%, bytes%, oops%)
Copies data from an array to an EMS file opened by EMSopen.
aseg% and aptr% are segment and offset pointers to the array, bytes%
is the number of bytes to be copied, and handle% is the handle returned
by EMSopen. EMSptr% is the byte offset in the EMS "file" where you
want the write to start. Note that EMSptr% = 0 at the start of the
"file". This is a "generic" EMS write subroutine. Simplified subroutines
for copying to or from numeric arrays are also available (see EMS2Array
subroutines).
Example:
CALL EMSwrite(handle, aseg%, aptr, emsptr%, bytes%, oops%))