Dec 132017
 
Demo version of xpmalloc.lib - an expanded memory library for C programmers. Provides a simple memory mangement interface.
File XPMDEMO.ZIP from The Programmer’s Corner in
Category C Source Code
Demo version of xpmalloc.lib – an expanded memory library for C programmers. Provides a simple memory mangement interface.
File Name File Size Zip Size Zip Type
MAKEXPM.BAT 22 22 stored
XPMALLOC.H 3123 878 deflated
XPMALLOC.LIB 28727 10658 deflated
XPMANUAL.DOC 12664 3098 deflated
XPMDEMO.C 15419 2681 deflated
XPMDEMO.LL 55 44 deflated
XPMDEMO.NMK 241 129 deflated

Download File XPMDEMO.ZIP Here

Contents of the XPMANUAL.DOC file









XPMALLOC.LIB - USER GUIDE < DEMO VERSION >


SOFTWARE SOLUTIONS
4618 WESTHILL RD.
ELLICOTT CITY, MD. 21043
(301) 730-1676













































Copyright (c) David M. Yancich 1990. All rights reserved.








Expanded Memory (LIM v4.0)


The LIM standard for Expanded Memory has added new power to
DOS based applications and operating system enhancers.
With the release of version 4.0 - 32M bytes of extra memory
is available for use.

Expanded memory is accessed using a bank switching technique,
where a contiguous 64K (may be larger) window is mapped into
the expanded memory. The expanded memory is then available as
standard memory would be.

Many commercial packages are now using expanded memory in some
way. DOS enhancers such as MS Windows use expanded memory to
store program code. Applications such as Lotus 123 use expanded
memory to store data, which allows for much larger spreadsheets.

This package uses expanded memory to store data arrays. It takes
care of the overhead (page mapping) associated with using expanded
memory. The added overhead associated with the functions in this
library cause some performance penalty, but the tradeoff is the
ease of use.









Using the Library - MS 'C' v.6.x


This library is for use with Microsoft 'C' v6.x.
The program must be compiled using the large model.

There is a make file on the distribution diskette to assist
in compiling the DEMO program.

The functions in this library make calls to the Expanded Memory
device driver that is loaded with DOS. LIM version 4.0 or greater
of the device driver is required.

The latest version of the LIM standard device driver is available
from Intel if needed. There is a Intel BBS where the driver can be
downloaded.









xpmInit()



Prototype

int xpmInit(info)
struct typxpminfo *info; /* pointer to typXPMINFO structure */


Returns

0 - Successful
-1 - Cannot find Expanded Memory Driver
-4 - Wrong version of driver (requires 4.x)
-67 - Error in call to expanded memory driver or hardware

* If error occurs:
info->errText will contain description of error.


Description

This function must be called before any other function in
the library. It confirms the existence of expanded memory,
verifies that it is functioning properly, and fills the info
structure with the system characteristic information. The
typXPMINFO structure is defined in xpmalloc.h.









xpmalloc()



Prototype

struct typxpmalloc *xpmalloc(numOfItems, size, error)
unsigned long numOfItems; /* number of items */
unsigned long size; /* size of an item */
int error; /* pointer to error return value */


Returns

Valid typXPMALLOC pointer - Successful
(typXPMALLOC *)NULL pointer - Error

If Error - error parameter will contain:

-1 : xpmInit() not performed or returned error.
-2 : size < 0 or size > PAGESIZE(16K).
-3 : Error in call to EMS driver (Pages Available)
-4 : Requested pages not available.
-5 : Error in call to EMS driver (Allocate Pages)
-6 : Error in call to EMS driver (Get Page Frame)
-20 : DEMO version , memory limit exceeded (96K limit)


Description

This function is responsible for allocating expanded memory
pages. It will calculate the number of pages required from
numOfItems * size. The pages will be assigned, and information
about the memory will be stored in the typXPMALLOC structure. The
address (pointer to) the structure will be returned to the caller.
This pointer will then be used in calls to "PUT" and "GET" the
data.
If the number of pages needed is 1, and the total size of the
requested memory is less than PAGESIZE(16K), the remaining memory
in that page will be made available to future allocations.









xpmFree()



Prototype

int xpmFree(dataStruct)
typXPMALLOC *dataStruct; /* pointer to typXPMALLOC */


Returns

0 : Successful
-1 : NULL typXPMALLOC pointer (dataStruct not valid)
-67 : Error in call to Expanded Memory driver.


Description

This function is responsible for deallocating expanded memory
pages. If expanded memory has been allocated, it MUST be
deallocated before returning to DOS, otherwise it will be
inaccessible to future allocations.
If the expanded memory allocated is less than PAGESIZE(16K),
the page will not be deallocated unless there is no other memory
allocated in that page.









xpmFreeAll()



Prototype

int xpmFree(void)


Returns

0 : Successful
-67 : Error in call to Expanded Memory driver.


Description

This function is similar to xpmFree(). This function will release
ALL Expanded memory pages allocated in the application. It will
not release the System Page (LIM standard system page -> handle 0).
It will also not release any other pages such as RAM disks located
in Expanded memory. This function is most useful at the end of an
application to be sure that all Expanded memory is released.








xpmPutXXXX()



Prototype

int xpmPutXXXX(dataStruct, index, dataValue)
typXPMALLOC *dataStruct; /* pointer to typXPMALLOC */
unsigned long index; /* array index */
XXXX dataValue; /* data value */

where XXXX = Int, Long, Float, Double.


Returns

0 : Successful
-3 : Index out of range.
-67 : Error in call to Expanded Memory driver.


Description

This function will "put" data into Expanded memory. The memory
must have first been allocated using xpmalloc(). The index MUST
be of type Long or unpredictable results will occur. The index
can be type cast to long. Limit checking is performed on the index
value.









xpmGetXXXX()



Prototype

int xpmGetXXXX(dataStruct, index, dataValue)
typXPMALLOC *dataStruct; /* pointer to typXPMALLOC */
unsigned long index; /* array index */
XXXX *dataValue; /* pointer to data value */

where XXXX = Int, Long, Float, Double.


Returns

0 : Successful
-3 : Index out of range.
-67 : Error in call to Expanded Memory driver.


Description

This function will "get" data from Expanded memory. The memory
must have first been allocated using xpmalloc(). If nothing
was "put" to Expanded memory before this function is called,
unpredictable data will be received.
The index MUST be of type Long or unpredictable results will
occur. The index can be type cast to long. Limit checking is
performed on the index value.









saveScreen()



Prototype

int saveScreen(dataStruct)
typXPMALLOC *dataStruct; /* pointer to typXPMALLOC */


Returns

0 : Successful
-1 : (typXPMALLOC *)NULL pointer (dataStruct not valid)
-2 : Invalid video mode. TEXT only.
-4 : Allocated memory too small. (Minimum 4000 bytes needed)
-67 : Error in call to Expanded Memory driver.


Description

This function will save an entire text screen to Expanded memory.
The Expanded memory must have been allocated first using xpmalloc().
The function will automatically adjust for color or monochrome.









restoreScreen()



Prototype

int restoreScreen(dataStruct)
typXPMALLOC *dataStruct; /* pointer to typXPMALLOC */


Returns

0 : Successful
-1 : (typXPMALLOC *)NULL pointer (dataStruct not valid)
-2 : Invalid video mode. TEXT only.
-3 : No screen was saved.
-67 : Error in call to Expanded Memory driver.


Description

This function will restore a previously saved text screen.






** The following functions are included for completeness. **
** They are used in the DEMO source and are therefore included. **

clrScr()



Prototype

void clrScr(void)


Returns

Nothing


Description

This function will clear a text screen.








getCursor(), setCursor()



Prototype

void getCursor(row,col)
int *row; /* pointer to row value */
int *col; /* pointer to col value */

void setCursor(row,col)
int row; /* row value */
int col; /* col value */

Returns

Nothing


Description

Get current cursor position.
Set cursor to row,col position.









drawBorder()



Prototype

void drawBorder(ulrow, ulcol, lrrow, lrcol)
int ulrow; /* upper left row value */
int ulcol; /* upper left col value */
int lrrow; /* lower right row value */
int lrcol; /* lower right col value */


Returns

Nothing


Description

This function will draw a "shadowed" box on the screen. The size
of the box will be checked and reduced if too large to fit on
the screen. This is NOT a windowing function.









REGISTRATION !!!!


Send $45.00 to:
(Maryland residents add 5% tax)

David M. Yancich
Software Solutions
4618 Westhill Rd.
Ellicott City, Md. 21043
(301) 730-1676


NAME ____________________________________

ADDRESS ____________________________________

ADDRESS ____________________________________

CITY ST ZIP ____________________________________

PHONE ____________________________________


Qty Compiler (MSC,TURBO,LATTICE) Price
___ _______________________________ _____________

___ _______________________________ _____________

___ _______________________________ _____________

___ _______________________________ _____________

___ _______________________________ _____________

Total






 December 13, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)