Application Examples
/* ------------------------------------------------------------------ */
/* Routine to release all expanded memory pages allocated by an EMM
*/
/* handle.
*/
/* ------------------------------------------------------------------ */
char deallocate_expanded_memory_pages (emm_handle)
unsigned int
emm_handle;
{
input_regs.h.ah = DEALLOCATE_PAGES;
input_regs.x.dx = emm_handle;
int86 (EMM_INT, &input_regs, &output_regs);
if (output_regs.h.ah == 0)
return (TRUE);
else
return (FALSE);
}
main() {
unsigned int emm_handle;
char *pf_addr;
int pages_needed;
int physical_page;
int logical_page;
int
index;
/* -------------------------------------------------------- */
/* Determine if EMM is installed.
*/
/* -------------------------------------------------------- */
if (!emm_installed())
exit (1);
/* -------------------------------------------------------- */
/* Determine if enough expanded memory pages exist for
*/
/* application.
*/
/* -------------------------------------------------------- */
pages_needed = 1;
if (!enough_unallocated_pages (pages_needed))
exit (1);
/* -------------------------------------------------------- */
/* Allocate expanded memory pages.
*/
/* -------------------------------------------------------- */
if (!allocate_expanded_memory_pages (pages_needed, &emm_handle))
exit (1);
/* -------------------------------------------------------- */
/* Map in the required pages.
*/
/* -------------------------------------------------------- */
physical_page = 0;
logical_page = 0;
if (!map_expanded_memory_pages (emm_handle, physical_page,
logical_page))
exit (1);
4-10
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com