int MainPagesAvail;\r
\r
// EMS specific variables\r
- boolean EMSPresent;\r
- word EMSAvail,EMSPagesAvail,EMSHandle,\r
- EMSPageFrame,EMSPhysicalPage;\r
+ boolean gvar->pm.emm.EMSPresent;\r
+ word gvar->pm.emm.EMSAvail,gvar->pm.emm.EMSPagesAvail,gvar->pm.emm.EMSHandle,\r
+ gvar->pm.emm.EMSPageFrame,gvar->pm.emm.EMSPhysicalPage;\r
EMSListStruct EMSList[EMSFrameCount];\r
\r
// XMS specific variables\r
- boolean XMSPresent;\r
- word XMSAvail,XMSPagesAvail,XMSHandle;\r
+ boolean gvar->pm.xmm.XMSPresent;\r
+ word gvar->pm.xmm.XMSAvail,gvar->pm.xmm.XMSPagesAvail,gvar->pm.xmm.XMSHandle;\r
dword XMSDriver;\r
- int XMSProtectPage = -1;\r
+ int gvar->pm.xmm.XMSProtectPage = -1;\r
\r
// File specific variables\r
char PageFileName[13] = {"VSWAP."};\r
int PageFile = -1;\r
- word ChunksInFile;\r
+ word gvar->pm.fi.ChunksInFile;\r
word PMSpriteStart,PMSoundStart;\r
\r
// General usage variables\r
boolean PMStarted,\r
PMPanicMode,\r
PMThrashing;\r
- word XMSPagesUsed,\r
- EMSPagesUsed,\r
+ word gvar->pm.xmm.XMSPagesUsed,\r
+ gvar->pm.emm.EMSPagesUsed,\r
MainPagesUsed,\r
PMNumBlocks;\r
long PMFrameCount;\r
// PML_MapEMS() - Maps a logical page to a physical page\r
//\r
void\r
-PML_MapEMS(word logical,word physical)\r
+PML_MapEMS(word logical, word physical, global_game_variables_t *gvar)\r
{\r
union REGS CPURegs;\r
CPURegs.h.al = physical;\r
CPURegs.x.bx = logical;\r
- CPURegs.x.dx = EMSHandle;\r
+ CPURegs.x.dx = gvar->pm.emm.EMSHandle;\r
CPURegs.h.ah = EMS_MAPPAGE;\r
__asm\r
{\r
char EMMDriverName[9] = "EMMXXXX0";\r
\r
boolean\r
-PML_StartupEMS(void)\r
+PML_StartupEMS(global_game_variables_t *gvar)\r
{\r
+ boolean emmcfems;\r
union REGS CPURegs;\r
+\r
int i;\r
long size;\r
\r
- EMSPresent = false; // Assume that we'll fail\r
- EMSAvail = 0;\r
-\r
- CPURegs.x.dx = (word)EMMDriverName;\r
- CPURegs.x.ax = 0x3d00;\r
- geninterrupt(0x21); // try to open EMMXXXX0 device\r
-__asm jnc gothandle\r
- goto error;\r
+ gvar->pm.emm.EMSPresent = false; // Assume that we'll fail\r
+ gvar->pm.emm.EMSAvail = 0;\r
+ emmcfems=0;\r
+\r
+ __asm {\r
+ //CPURegs.x.dx = (word)EMMDriverName;\r
+ //CPURegs.x.ax = 0x3d00;\r
+ //geninterrupt(0x21); // try to open EMMXXXX0 device\r
+ mov dx,OFFSET EMMDriverName\r
+ mov ax,0x3d00\r
+ int 0x21 // try to open EMMXXXX0 device\r
+ jnc gothandle\r
+ //fail\r
+ mov emmcfems,1\r
+ jmp Aend\r
+#ifdef __BORLANDC__\r
+ }\r
+#endif\r
\r
gothandle:\r
- CPURegs.x.bx = CPURegs.x.ax;\r
- CPURegs.x.ax = 0x4400;\r
- geninterrupt(0x21); // get device info\r
-asm jnc gotinfo;\r
- goto error;\r
-\r
+#ifdef __BORLANDC__\r
+ __asm {\r
+#endif\r
+ //CPURegs.x.bx = CPURegs.x.ax;\r
+ //CPURegs.x.ax = 0x4400;\r
+ //geninterrupt(0x21); // get device info\r
+ mov bx,ax\r
+ mov ax,0x4400\r
+ int 0x21 // get device info\r
+ jnc gotinfo\r
+ //fail\r
+ mov emmcfems,1\r
+ jmp Aend\r
+#ifdef __BORLANDC__\r
+ }\r
+#endif\r
+Aend:\r
gotinfo:\r
-asm and dx,0x80\r
+#ifndef __BORLANDC__\r
+ }\r
+#endif\r
+ if(emmcfems!=0) goto error;\r
+ __asm and dx,0x80\r
if (!CPURegs.x.dx)\r
goto error;\r
\r
CPURegs.x.ax = 0x4407;\r
geninterrupt(0x21); // get status\r
-asm jc error\r
- if (!CPURegs.l.al)\r
+ __asm mov emmcfems,1\r
+ if(emmcfems!=0) goto error;\r
+\r
+ if (!CPURegs.h.al)\r
goto error;\r
\r
CPURegs.h.ah = 0x3e;\r
\r
CPURegs.h.ah = EMS_VERSION;\r
geninterrupt(EMS_INT);\r
- if (CPURegs.h.ah || (CPURegs.l.al < 0x32)) // only work on EMS 3.2 or greater (silly, but...)\r
+ if (CPURegs.h.ah || (CPURegs.h.al < 0x32)) // only work on EMS 3.2 or greater (silly, but...)\r
goto error;\r
\r
CPURegs.h.ah = EMS_GETFRAME;\r
geninterrupt(EMS_INT);\r
if (CPURegs.h.ah)\r
goto error; // find the page frame address\r
- EMSPageFrame = CPURegs.x.bx;\r
+ gvar->pm.emm.EMSPageFrame = CPURegs.x.bx;\r
\r
CPURegs.h.ah = EMS_GETPAGES;\r
geninterrupt(EMS_INT);\r
goto error;\r
if (CPURegs.x.bx < 2)\r
goto error; // Require at least 2 pages (32k)\r
- EMSAvail = CPURegs.x.bx;\r
+ gvar->pm.emm.EMSAvail = CPURegs.x.bx;\r
\r
// Don't hog all available EMS\r
- size = EMSAvail * (long)EMSPageSize;\r
- if (size - (EMSPageSize * 2) > (ChunksInFile * (long)PMPageSize))\r
+ size = gvar->pm.emm.EMSAvail * (long)EMSPageSize;\r
+ if (size - (EMSPageSize * 2) > (gvar->pm.fi.ChunksInFile * (long)PMPageSize))\r
{\r
- size = (ChunksInFile * (long)PMPageSize) + EMSPageSize;\r
- EMSAvail = size / EMSPageSize;\r
+ size = (gvar->pm.fi.ChunksInFile * (long)PMPageSize) + EMSPageSize;\r
+ gvar->pm.emm.EMSAvail = size / EMSPageSize;\r
}\r
\r
- CPURegs.h.ah = EMSCPURegs.l.alLOCPAGES;\r
- CPURegs.x.bx = EMSAvail;\r
+ CPURegs.h.ah = EMS_ALLOCPAGES;\r
+ CPURegs.x.bx = gvar->pm.emm.EMSAvail;\r
geninterrupt(EMS_INT);\r
if (CPURegs.h.ah)\r
goto error;\r
- EMSHandle = CPURegs.x.dx;\r
+ gvar->pm.emm.EMSHandle = CPURegs.x.dx;\r
\r
- mminfo.EMSmem += EMSAvail * (long)EMSPageSize;\r
+ gvar->mmi.EMSmem += gvar->pm.emm.EMSAvail * (long)EMSPageSize;\r
\r
// Initialize EMS mapping cache\r
for (i = 0;i < EMSFrameCount;i++)\r
- EMSList[i].baseEMSPage = -1;\r
+ gvar->pm.emm.EMSList[i].baseEMSPage = -1;\r
\r
- EMSPresent = true; // We have EMS\r
+ gvar->pm.emm.EMSPresent = true; // We have EMS\r
\r
error:\r
- return(EMSPresent);\r
+ return(gvar->pm.emm.EMSPresent);\r
}\r
\r
//\r
// PML_ShutdownEMS() - If EMS was used, deallocate it\r
//\r
void\r
-PML_ShutdownEMS(void)\r
+PML_ShutdownEMS(global_game_variables_t *gvar)\r
{\r
- if (EMSPresent)\r
+ union REGS CPURegs;\r
+\r
+ if (gvar->pm.emm.EMSPresent)\r
{\r
- __asm {\r
- mov ah,EMS_FREEPAGES\r
- mov dx,[EMSHandle]\r
- int EMS_INT\r
- }\r
+ CPURegs.h.ah=EMS_FREEPAGES;\r
+ CPURegs.x.ax=gvar->pm.emm.EMSHandle;\r
+ geninterrupt(EMS_INT);\r
if (CPURegs.h.ah)\r
{\r
Quit("PML_ShutdownEMS: Error freeing EMS\n");\r
// Allocates any remaining XMS (rounded down to the nearest page size)\r
//\r
boolean\r
-PML_StartupXMS(void)\r
+PML_StartupXMS(global_game_variables_t *gvar)\r
{\r
- XMSPresent = false; // Assume failure\r
- XMSAvail = 0;\r
+ union REGS CPURegs;\r
\r
-asm mov ax,0x4300\r
-asm int XMS_INT // Check for presence of XMS driver\r
- if (CPURegs.l.al != 0x80)\r
+ XMSD;\r
+ gvar->pm.xmm.XMSPresent = false; // Assume failure\r
+ gvar->pm.xmm.XMSAvail = 0;\r
+\r
+ CPURegs.x.ax=0x4300;\r
+ geninterrupt(XMS_INT); // Check for presence of XMS driver\r
+ if (CPURegs.h.al != 0x80)\r
goto error;\r
\r
\r
-asm mov ax,0x4310\r
-asm int XMS_INT // Get address of XMS driver\r
-asm mov [WORD PTR XMSDriver],bx\r
-asm mov [WORD PTR XMSDriver+2],es // function pointer to XMS driver\r
+ __asm {\r
+ mov ax,0x4310\r
+ int XMS_INT // Get address of XMS driver\r
+ mov [WORD PTR XMSDriver],bx\r
+ mov [WORD PTR XMSDriver+2],es // function pointer to XMS driver\r
+ }\r
\r
XMS_CALL(XMS_QUERYFREE); // Find out how much XMS is available\r
- XMSAvail = CPURegs.x.ax;\r
+ gvar->pm.xmm.XMSAvail = CPURegs.x.ax;\r
if (!CPURegs.x.ax) // AJR: bugfix 10/8/92\r
goto error;\r
\r
- XMSAvail &= ~(PMPageSizeKB - 1); // Round off to nearest page size\r
- if (XMSAvail < (PMPageSizeKB * 2)) // Need at least 2 pages\r
+ gvar->pm.xmm.XMSAvail &= ~(PMPageSizeKB - 1); // Round off to nearest page size\r
+ if (gvar->pm.xmm.XMSAvail < (PMPageSizeKB * 2)) // Need at least 2 pages\r
goto error;\r
\r
- CPURegs.x.dx = XMSAvail;\r
- XMS_CALL(XMSCPURegs.l.alLOC); // And do the allocation\r
- XMSHandle = CPURegs.x.dx;\r
+ CPURegs.x.dx = gvar->pm.xmm.XMSAvail;\r
+ XMS_CALL(XMS_ALLOC); // And do the allocation\r
+ gvar->pm.xmm.XMSHandle = CPURegs.x.dx;\r
\r
if (!CPURegs.x.ax) // AJR: bugfix 10/8/92\r
{\r
- XMSAvail = 0;\r
+ gvar->pm.xmm.XMSAvail = 0;\r
goto error;\r
}\r
\r
- mminfo.XMSmem += XMSAvail * 1024;\r
+ gvar->mmi.XMSmem += gvar->pm.xmm.XMSAvail * 1024;\r
\r
- XMSPresent = true;\r
+ gvar->pm.xmm.XMSPresent = true;\r
error:\r
- return(XMSPresent);\r
+ return(gvar->pm.xmm.XMSPresent);\r
}\r
\r
//\r
// Will round an odd-length request up to the next even value\r
//\r
void\r
-PML_XMSCopy(boolean toxms,byte far *addr,word xmspage,word length)\r
+PML_XMSCopy(boolean toxms,byte far *addr,word xmspage,word length, global_game_variables_t *gvar)\r
{\r
+ XMSD;\r
dword xoffset;\r
struct\r
{\r
xoffset = (dword)xmspage * PMPageSize;\r
\r
copy.length = (length + 1) & ~1;\r
- copy.source_handle = toxms? 0 : XMSHandle;\r
+ copy.source_handle = toxms? 0 : gvar->pm.xmm.XMSHandle;\r
copy.source_offset = toxms? (long)addr : xoffset;\r
- copy.target_handle = toxms? XMSHandle : 0;\r
+ copy.target_handle = toxms? gvar->pm.xmm.XMSHandle : 0;\r
copy.target_offset = toxms? xoffset : (long)addr;\r
\r
-asm push si\r
- CPURegs.i.si = (word)©\r
+ __asm {\r
+ push si\r
+ }\r
+ CPURegs.x.si = (word)©\r
XMS_CALL(XMS_MOVE);\r
-asm pop si\r
+ __asm {\r
+ pop si\r
+ }\r
if (!CPURegs.x.ax)\r
{\r
Quit("PML_XMSCopy: Error on copy");\r
// PML_ShutdownXMS()\r
//\r
void\r
-PML_ShutdownXMS(void)\r
+PML_ShutdownXMS(global_game_variables_t *gvar)\r
{\r
- if (XMSPresent)\r
+ XMSD;\r
+ if (gvar->pm.xmm.XMSPresent)\r
{\r
- CPURegs.x.dx = XMSHandle;\r
+ CPURegs.x.dx = gvar->pm.xmm.XMSHandle;\r
XMS_CALL(XMS_FREE);\r
- if (CPURegs.l.bl)\r
+ if (CPURegs.h.bl)\r
{\r
Quit("PML_ShutdownXMS: Error freeing XMS");\r
//return;\r
// PM_UnlockMainMem() macros should be used instead.\r
//\r
void\r
-PM_SetMainMemPurge(int level)\r
+PM_SetMainMemPurge(int level, global_game_variables_t *gvar)\r
{\r
int i;\r
\r
for (i = 0;i < PMMaxMainMem;i++)\r
- if (MainMemPages[i])\r
- MM_SetPurge(&MainMemPages[i],level);\r
+ if (gvar->pm.mm.MainMemPages[i])\r
+ MM_SetPurge(&gvar->pm.mm.MainMemPages[i],level);\r
+ return 0;//TODO FIX\r
}\r
\r
//\r
if (!MainPresent)\r
return;\r
\r
- for (i = 0,page = PMPages;i < ChunksInFile;i++,page++)\r
+ for (i = 0,page = PMPages;i < gvar->pm.fi.ChunksInFile;i++,page++)\r
{\r
n = page->mainPage;\r
if (n != -1) // Is the page using main memory?\r
}\r
\r
// Read in header variables\r
- read(PageFile,&ChunksInFile,sizeof(ChunksInFile));\r
+ read(PageFile,&gvar->pm.fi.ChunksInFile,sizeof(gvar->pm.fi.ChunksInFile));\r
read(PageFile,&PMSpriteStart,sizeof(PMSpriteStart));\r
read(PageFile,&PMSoundStart,sizeof(PMSoundStart));\r
\r
// Allocate and clear the page list\r
- PMNumBlocks = ChunksInFile;\r
+ PMNumBlocks = gvar->pm.fi.ChunksInFile;\r
MM_GetPtr(&(memptr)PMSegPages,sizeof(PageListStruct) * PMNumBlocks);\r
MM_SetLock(&(memptr)PMSegPages,true);\r
PMPages = (PageListStruct far *)PMSegPages;\r
_fmemset(PMPages,0,sizeof(PageListStruct) * PMNumBlocks);\r
\r
// Read in the chunk offsets\r
- size = sizeof(dword) * ChunksInFile;\r
+ size = sizeof(dword) * gvar->pm.fi.ChunksInFile;\r
MM_GetPtr(&buf,size);\r
if (!CA_FarRead(PageFile,(byte far *)buf,size))\r
{\r
//return;\r
}\r
offsetptr = (dword far *)buf;\r
- for (i = 0,page = PMPages;i < ChunksInFile;i++,page++)\r
+ for (i = 0,page = PMPages;i < gvar->pm.fi.ChunksInFile;i++,page++)\r
page->offset = *offsetptr++;\r
MM_FreePtr(&buf);\r
\r
// Read in the chunk lengths\r
- size = sizeof(word) * ChunksInFile;\r
+ size = sizeof(word) * gvar->pm.fi.ChunksInFile;\r
MM_GetPtr(&buf,size);\r
if (!CA_FarRead(PageFile,(byte far *)buf,size))\r
{\r
//return;\r
}\r
lengthptr = (word far *)buf;\r
- for (i = 0,page = PMPages;i < ChunksInFile;i++,page++)\r
+ for (i = 0,page = PMPages;i < gvar->pm.fi.ChunksInFile;i++,page++)\r
page->length = *lengthptr++;\r
MM_FreePtr(&buf);\r
}\r
/////////////////////////////////////////////////////////////////////////////\r
\r
//\r
-// PML_GetEMSAddress()\r
+// PML_Getgvar->pm.emm.EMSAddress()\r
//\r
// Page is in EMS, so figure out which EMS physical page should be used\r
// to map our page in. If normal page, use EMS physical page 3, else\r
#ifdef __DEBUG__\r
#pragma argsused // DEBUG - remove lock parameter\r
memptr\r
-PML_GetEMSAddress(int page,PMLockType lock)\r
+PML_Getgvar->pm.emm.EMSAddress(int page,PMLockType lock)\r
{\r
int i,emspage;\r
word emsoff,emsbase,offset;\r
// See if this page is already mapped in\r
for (i = 0;i < EMSFrameCount;i++)\r
{\r
- if (EMSList[i].baseEMSPage == emsbase)\r
+ if (EMSList[i].basegvar->pm.emm.EMSPage == emsbase)\r
{\r
emspage = i; // Yep - don't do a redundant remapping\r
break;\r
}\r
}\r
\r
- EMSList[emspage].baseEMSPage = emsbase;\r
+ EMSList[emspage].basegvar->pm.emm.EMSPage = emsbase;\r
PML_MapEMS(page / PMEMSSubPage,emspage);\r
}\r
\r
if (emspage == -1)\r
- Quit("PML_GetEMSAddress: EMS find failed");\r
+ Quit("PML_Getgvar->pm.emm.EMSAddress: EMS find failed");\r
\r
EMSList[emspage].lastHit = PMFrameCount;\r
offset = emspage * EMSPageSizeSeg;\r
offset += emsoff * PMPageSizeSeg;\r
- return((memptr)(EMSPageFrame + offset));\r
+ return((memptr)(gvar->pm.emm.EMSPageFrame + offset));\r
}\r
#else\r
memptr\r
-PML_GetEMSAddress(int page,PMLockType lock)\r
+PML_Getgvar->pm.emm.EMSAddress(int page,PMLockType lock)\r
{\r
word emspage;\r
\r
\r
PML_MapEMS(page / PMEMSSubPage,emspage);\r
\r
- return((memptr)(EMSPageFrame + (emspage * EMSPageSizeSeg)\r
+ return((memptr)(gvar->pm.emm.EMSPageFrame + (emspage * EMSPageSizeSeg)\r
+ ((page & (PMEMSSubPage - 1)) * PMPageSizeSeg)));\r
}\r
#endif\r
if (page->mainPage != -1)\r
return(MainMemPages[page->mainPage]);\r
else if (page->emsPage != -1)\r
- return(PML_GetEMSAddress(page->emsPage,page->locked));\r
+ return(PML_Getgvar->pm.emm.EMSAddress(page->emsPage,page->locked));\r
else\r
return(nil);\r
}\r
long last;\r
PageListStruct far *page;\r
\r
- for (i = 0,page = PMPages,lru = -1,last = MAXLONG;i < ChunksInFile;i++,page++)\r
+ for (i = 0,page = PMPages,lru = -1,last = MAXLONG;i < gvar->pm.fi.ChunksInFile;i++,page++)\r
{\r
if\r
(\r
}\r
\r
//\r
-// PML_GiveLRUXMSPage() - Returns the page # of the least recently used\r
+// PML_GiveLRUgvar->pm.xmm.XMSPage() - Returns the page # of the least recently used\r
// (and present) XMS page.\r
-// This routine won't return the XMS page protected (by XMSProtectPage)\r
+// This routine won't return the XMS page protected (by gvar->pm.xmm.XMSProtectPage)\r
//\r
int\r
-PML_GiveLRUXMSPage(void)\r
+PML_GiveLRUgvar->pm.xmm.XMSPage(void)\r
{\r
int i,lru;\r
long last;\r
PageListStruct far *page;\r
\r
- for (i = 0,page = PMPages,lru = -1,last = MAXLONG;i < ChunksInFile;i++,page++)\r
+ for (i = 0,page = PMPages,lru = -1,last = MAXLONG;i < gvar->pm.fi.ChunksInFile;i++,page++)\r
{\r
if\r
(\r
(page->xmsPage != -1)\r
&& (page->lastHit < last)\r
- && (i != XMSProtectPage)\r
+ && (i != gvar->pm.xmm.XMSProtectPage)\r
)\r
{\r
last = page->lastHit;\r
int usexms;\r
PageListStruct far *page;\r
\r
- if (!XMSPresent)\r
+ if (!gvar->pm.xmm.XMSPresent)\r
return;\r
\r
page = &PMPages[pagenum];\r
if (page->xmsPage != -1)\r
return; // Already in XMS\r
\r
- if (XMSPagesUsed < XMSPagesAvail)\r
- page->xmsPage = XMSPagesUsed++;\r
+ if (gvar->pm.xmm.XMSPagesUsed < gvar->pm.xmm.XMSPagesAvail)\r
+ page->xmsPage = gvar->pm.xmm.XMSPagesUsed++;\r
else\r
{\r
- usexms = PML_GiveLRUXMSPage();\r
+ usexms = PML_GiveLRUgvar->pm.xmm.XMSPage();\r
if (usexms == -1)\r
Quit("PML_PutPageInXMS: No XMS LRU");\r
page->xmsPage = PMPages[usexms].xmsPage;\r
PageListStruct far *page;\r
\r
page = &PMPages[pagenum];\r
- if ((EMSPagesUsed < EMSPagesAvail) && !mainonly)\r
+ if ((gvar->pm.emm.EMSPagesUsed < gvar->pm.emm.EMSPagesAvail) && !mainonly)\r
{\r
// There's remaining EMS - use it\r
- page->emsPage = EMSPagesUsed++;\r
- addr = PML_GetEMSAddress(page->emsPage,page->locked);\r
+ page->emsPage = gvar->pm.emm.EMSPagesUsed++;\r
+ addr = PML_Getgvar->pm.emm.EMSAddress(page->emsPage,page->locked);\r
}\r
else if (MainPagesUsed < MainPagesAvail)\r
{\r
// PML_GetPageFromXMS() - If page is in XMS, find LRU main/EMS page and\r
// replace it with the page from XMS. If mainonly is true, will only\r
// search for LRU main page.\r
-// XMSProtectPage is set to the page to be retrieved from XMS, so that if\r
+// gvar->pm.xmm.XMSProtectPage is set to the page to be retrieved from XMS, so that if\r
// the page from which we're stealing the main/EMS from isn't in XMS,\r
// it won't copy over the page that we're trying to get from XMS.\r
// (pages that are being purged are copied into XMS, if possible)\r
PageListStruct far *page;\r
\r
page = &PMPages[pagenum];\r
- if (XMSPresent && (page->xmsPage != -1))\r
+ if (gvar->pm.xmm.XMSPresent && (page->xmsPage != -1))\r
{\r
- XMSProtectPage = pagenum;\r
+ gvar->pm.xmm.XMSProtectPage = pagenum;\r
checkaddr = PML_GetAPageBuffer(pagenum,mainonly);\r
if (FP_OFF(checkaddr))\r
Quit("PML_GetPageFromXMS: Non segment pointer");\r
addr = (memptr)FP_SEG(checkaddr);\r
PML_CopyFromXMS(addr,page->xmsPage,page->length);\r
- XMSProtectPage = -1;\r
+ gvar->pm.xmm.XMSProtectPage = -1;\r
}\r
\r
return(addr);\r
{\r
memptr result;\r
\r
- if (pagenum >= ChunksInFile)\r
+ if (pagenum >= gvar->pm.fi.ChunksInFile)\r
Quit("PM_GetPage: Invalid page request");\r
\r
-#if 0 // for debugging\r
-asm mov dx,STATUS_REGISTER_1\r
-asm in al,dx\r
-asm mov dx,ATR_INDEX\r
-asm mov al,ATR_OVERSCAN\r
-asm out dx,al\r
-asm mov al,10 // bright green\r
-asm out dx,al\r
+#if __DEBUG__ // for debugging\r
+ __asm {\r
+ mov dx,STATUS_REGISTER_1\r
+ in al,dx\r
+ mov dx,ATR_INDEX\r
+ mov al,ATR_OVERSCAN\r
+ out dx,al\r
+ mov al,10 // bright green\r
+ out dx,al\r
+ }\r
#endif\r
\r
if (!(result = PM_GetPageAddress(pagenum)))\r
}\r
PMPages[pagenum].lastHit = PMFrameCount;\r
\r
-#if 0 // for debugging\r
-asm mov dx,STATUS_REGISTER_1\r
-asm in al,dx\r
-asm mov dx,ATR_INDEX\r
-asm mov al,ATR_OVERSCAN\r
-asm out dx,al\r
-asm mov al,3 // blue\r
-asm out dx,al\r
-asm mov al,0x20 // normal\r
-asm out dx,al\r
+#if __DEBUG__ // for debugging\r
+ __asm{\r
+ mov dx,STATUS_REGISTER_1\r
+ in al,dx\r
+ mov dx,ATR_INDEX\r
+ mov al,ATR_OVERSCAN\r
+ out dx,al\r
+ mov al,3 // blue\r
+ out dx,al\r
+ mov al,0x20 // normal\r
+ out dx,al\r
#endif\r
\r
return(result);\r
memptr addr;\r
PageListStruct far *p;\r
\r
- mainfree = (MainPagesAvail - MainPagesUsed) + (EMSPagesAvail - EMSPagesUsed);\r
- xmsfree = (XMSPagesAvail - XMSPagesUsed);\r
+ mainfree = (MainPagesAvail - MainPagesUsed) + (gvar->pm.emm.EMSPagesAvail - gvar->pm.emm.EMSPagesUsed);\r
+ xmsfree = (gvar->pm.xmm.XMSPagesAvail - gvar->pm.xmm.XMSPagesUsed);\r
\r
xmstotal = maintotal = 0;\r
\r
- for (i = 0;i < ChunksInFile;i++)\r
+ for (i = 0;i < gvar->pm.fi.ChunksInFile;i++)\r
{\r
if (!PMPages[i].offset)\r
continue; // sparse\r
|| PMPages[page].emsPage != -1 )\r
page++;\r
\r
- if (page >= ChunksInFile)\r
- Quit ("PM_Preload: Pages>=ChunksInFile");\r
+ if (page >= gvar->pm.fi.ChunksInFile)\r
+ Quit ("PM_Preload: Pages>=gvar->pm.fi.ChunksInFile");\r
\r
PM_GetPage(page);\r
\r
while ( !PMPages[page].offset || PMPages[page].xmsPage != -1 )\r
page++;\r
\r
- if (page >= ChunksInFile)\r
- Quit ("PM_Preload: Pages>=ChunksInFile");\r
+ if (page >= gvar->pm.fi.ChunksInFile)\r
+ Quit ("PM_Preload: Pages>=gvar->pm.fi.ChunksInFile");\r
\r
p = &PMPages[page];\r
\r
- p->xmsPage = XMSPagesUsed++;\r
- if (XMSPagesUsed > XMSPagesAvail)\r
+ p->xmsPage = gvar->pm.xmm.XMSPagesUsed++;\r
+ if (gvar->pm.xmm.XMSPagesUsed > gvar->pm.xmm.XMSPagesAvail)\r
Quit("PM_Preload: Exceeded XMS pages");\r
if (p->length > PMPageSize)\r
Quit("PM_Preload: Page too long");\r
int i;\r
PageListStruct far *page;\r
\r
- XMSPagesAvail = XMSAvail / PMPageSizeKB;\r
+ gvar->pm.xmm.XMSPagesAvail = gvar->pm.xmm.XMSAvail / PMPageSizeKB;\r
\r
- EMSPagesAvail = EMSAvail * (EMSPageSizeKB / PMPageSizeKB);\r
- EMSPhysicalPage = 0;\r
+ gvar->pm.emm.EMSPagesAvail = gvar->pm.emm.EMSAvail * (EMSPageSizeKB / PMPageSizeKB);\r
+ gvar->pm.emm.EMSPhysicalPage = 0;\r
\r
- MainPagesUsed = EMSPagesUsed = XMSPagesUsed = 0;\r
+ MainPagesUsed = gvar->pm.emm.EMSPagesUsed = gvar->pm.xmm.XMSPagesUsed = 0;\r
\r
PMPanicMode = false;\r
\r
if (!noxms)\r
PML_StartupXMS();\r
\r
- if (nomain && !EMSPresent)\r
+ if (nomain && !gvar->pm.emm.EMSPresent)\r
{\r
Quit("PM_Startup: No main or EMS\n");\r
//return;\r