[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Q: Hm. Still looks suspiciouly like assembler to me. What
do you have the I can USE?
A: As promised, I've provided several wrapper functions
that hide the Call_driver() function from you, so that you
don't have to worry about it if you don't want to. Let me
introduce them.
FUNCTION LOGICAL xms_installed
FUNCTION LONG xms_get_driver
FUNCTION UINT xms_get_version
FUNCTION INT xms_avail
FUNCTION LOGICAL xms_alloc
PROCEDURE xms_free
FUNCTION LOGICAL xms_copy
FUNCTION LONG xms_lock
FUNCTION INT xms_unlock
* Plus two wrapper functions around xms_copy()
FUNCTION LOGICAL xms_insert
FUNCTION LOGICAL xms_retrieve
There are four functions that you'll use heavily when working with
XMS in FORCE. They are xms_alloc(), xms_free(), xms_insert(),
and xms_retrieve(). The last two are just wrappers around the
xms_copy() function, and the first two you'll need to get and
free the XMS memory. The rest of the functions are used internally
by these four functions. For example, you don't need to worry
about the xms_get_driver() function, since it just returns the
address of the driver, and that's taken care of by all of the
functions in the XMS library.
Let's suppose you wanted a slick way to save entire screens to
some convenient place, and bring them back at will. You could
do something like this:
VARDEF
INT temp_handle
LONG video_mem = 0xb8000000
ENDDEF
PROCEDURE screen_to_xms
xms_alloc( temp_handle, 4 ) && screens are 4K
xms_copy( &NULL, video_mem, temp_handle, 0, 4000 )
ENDPRO
Then, when you want your screen back:
PROCEDURE xms_to_screen
xms_copy( temp_handle, 0, &NULL, video_mem, 4000 )
xms_free( temp_handle )
ENDPRO
Or, suppose that you wanted a way to read a "screen" from disk,
copy it into XMS, and then call it up whenever you want. You
could do something like this:
VARDEF
BYTE one_screen[4000]
INT help_handle
ENDDEF
PROCEDURE read_help_screen
PARAMETERS CONST CHAR filename
VARDEF
UINT file_handle
ENDDEF
fb_open( file_handle, filename, &B_READ )
fb_read( file_handle, one_screen, 4000 )
fb_close( file_handle )
xms_alloc( help_handle, 4 )
xms_insert( one_screen, help_handle, 0, 4000 )
ENDPRO
In fact, there's a sample program that shows you exactly how
you might want to implement this in the SAMPLE directory.
Well, that's all for now. I am of course, always available
on the BBS and CIS, so if you have any questions or comments,
feel free to contact me.
See Also:
xms_installed()
xms_avail()
xms_get_driver()
xms_get_version()
xms_alloc()
xms_free()
xms_copy()
xms_lock()
xms_unlock()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson