boolean\r
PML_StartupXMS(global_game_variables_t *gvar)\r
{\r
+//TODO: translate the _REG into working assembly\r
//#define STARTUPXMSASM\r
byte err;\r
- #define BRACKETXMS\r
word XMSAvail, XMSHandle;\r
-#define XMSAVI XMSAvail\r
-#define XMSHAN XMSHandle\r
//++++ word XMSVer;\r
boolean errorflag=false;\r
word e=0;\r
gvar->pm.xmm.XMSPresent = false; // Assume failure\r
- XMSAVI = gvar->mmi.XMSmem = 0;\r
+ XMSAvail = gvar->mmi.XMSmem = 0;\r
\r
__asm {\r
mov ax,0x4300\r
#ifdef STARTUPXMSASM\r
mov ah,XMS_QUERYFREE // Find out how much XMS is available\r
call [DWORD PTR XMSDriver]//DWORD PTR\r
-#ifndef BRACKETXMS\r
- mov XMSAVI,ax\r
-#else\r
- mov [XMSAVI],ax\r
-#endif\r
+ mov XMSAvail,ax\r
or ax,ax // AJR: bugfix 10/8/92\r
jz error1\r
mov e,3\r
if(errorflag==true) goto error;\r
#ifndef STARTUPXMSASM\r
XMS_CALL(XMS_QUERYFREE); // Find out how much XMS is available\r
- XMSAVI = _AX;\r
+ XMSAvail = _AX;\r
if (!_AX) // AJR: bugfix 10/8/92\r
{\r
errorflag = true;\r
\r
#ifdef __DEBUG_PM__\r
//++++ printf("XMSVer=%02X ", XMSVer);\r
- printf("XMSAvail=%u\n", XMSAVI);\r
+ printf("XMSAvail=%u\n", XMSAvail);\r
#endif\r
- XMSAVI &= ~(PMPageSizeKB - 1); // Round off to nearest page size\r
- if (XMSAVI < (PMPageSizeKB * 2)) // Need at least 2 pages\r
+ XMSAvail &= ~(PMPageSizeKB - 1); // Round off to nearest page size\r
+ if (XMSAvail < (PMPageSizeKB * 2)) // Need at least 2 pages\r
{\r
errorflag=true;\r
goto error;\r
}\r
#ifdef STARTUPXMSASM\r
__asm {\r
-#ifndef BRACKETXMS\r
- mov dx,XMSAVI\r
-#else\r
- mov dx,[XMSAVI]\r
-#endif\r
+ mov dx,XMSAvail\r
mov ah,XMS_ALLOC // And do the allocation\r
call [DWORD PTR XMSDriver]//DWORD PTR\r
-#ifndef BRACKETXMS\r
- mov XMSHAN,dx\r
-#else\r
- mov [XMSHAN],dx\r
-#endif\r
+ mov XMSHandle,dx\r
or ax,ax // AJR: bugfix 10/8/92\r
jz error2\r
mov e,4\r
}\r
#endif\r
#else\r
- _DX = XMSAVI;\r
+ _DX = XMSAvail;\r
XMS_CALL(XMS_ALLOC); // And do the allocation\r
- XMSHAN = _DX;\r
+ XMSHandle = _DX;\r
if (!_AX) // AJR: bugfix 10/8/92\r
{\r
errorflag=true;\r
error:\r
if(errorflag==false)\r
{\r
- gvar->mmi.XMSmem = (dword)(XMSAVI) * 1024;\r
- gvar->pm.xmm.XMSAvail = XMSAVI;\r
- gvar->pm.xmm.XMSHandle = XMSHAN;\r
+ gvar->mmi.XMSmem = (dword)(XMSAvail) * 1024;\r
+ gvar->pm.xmm.XMSAvail = XMSAvail;\r
+ gvar->pm.xmm.XMSHandle = XMSHandle;\r
//++++ gvar->pm.xmm.XMSVer = XMSVer;\r
gvar->pm.xmm.XMSPresent = true;\r
#ifdef __DEBUG_PM__\r
- printf(" XMSmem=%lu XMSAvail=%u\n", gvar->mmi.XMSmem, XMSAVI);\r
+ printf(" XMSmem=%lu XMSAvail=%u\n", gvar->mmi.XMSmem, XMSAvail);\r
#endif\r
}\r
else\r
//printf(" 1=%u 2=%u 3=%u 4=%u\n", XMSHandle1, XMSHandle2, XMSHandle3, XMSHandle4);\r
//printf(" 2=%u ", XMSHandle);\r
//printf(" %u", gvar->pm.xmm.XMSHandle);\r
- printf("err=%02X e=%u\n", err, e);\r
+ printf(" err=%02X e=%u\n", err, e);\r
#endif\r
}\r
return(gvar->pm.xmm.XMSPresent);\r
if (!gvar->pm.PMStarted)\r
return;\r
\r
- PML_ClosePageFile(gvar);\r
+ //PML_ClosePageFile(gvar);\r
\r
PML_ShutdownMainMem(gvar);\r
}\r