]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_pm.c
NULL pageframe detection added for EMM386 memory manager failing to assign one and...
[16.git] / src / lib / 16_pm.c
index f4e150822cfcbd2de679684a4a82fa23705a2315..2983499bde32abf03708b97500403c006d2eec48 100755 (executable)
@@ -153,6 +153,9 @@ PML_MapEMS(word logical, byte physical, global_game_variables_t *gvar)
 //             If there's more than our minimum (2 pages) available, allocate it (up\r
 //                     to the maximum we need)\r
 //\r
+//     Please call MML_CheckForEMS() before calling this function.\r
+//     MML_CheckForEMS is not local despite the name wwww.\r
+//\r
 \r
 boolean\r
 PML_StartupEMS(global_game_variables_t *gvar)\r
@@ -164,7 +167,6 @@ PML_StartupEMS(global_game_variables_t *gvar)
        byte    err=0, str[64];\r
 \r
        boolean errorflag=false;\r
-       static char     emmname[] = "EMMXXXX0"; //fix by andrius4669\r
        unsigned        EMSVer;\r
        unsigned        totalEMSpages,freeEMSpages,EMSPageFrame,EMSHandle,EMSAvail;\r
        totalEMSpages = freeEMSpages = EMSPageFrame = EMSHandle = EMSAvail = EMSVer = 0;        // set all to 0~\r
@@ -172,31 +174,7 @@ PML_StartupEMS(global_game_variables_t *gvar)
        gvar->pm.emm.EMSAvail = gvar->mmi.EMSmem = 0;\r
 \r
        __asm {\r
-               mov     dx,OFFSET emmname       //fix by andrius4669\r
-               mov     ax,0x3d00\r
-               int     EMM_INT         // try to open EMMXXXX0 device\r
-               jc      error1\r
-\r
-               mov     bx,ax\r
-               mov     ax,0x4400\r
-\r
-               int     EMM_INT         // get device info\r
-               jc      error1\r
-\r
-               and     dx,0x80\r
-               jz      error1\r
-\r
-               mov     ax,0x4407\r
-\r
-               int     EMM_INT         // get status\r
-               jc      error1\r
-               or      al,al\r
-               jz      error1\r
-\r
-               mov     ah,0x3e\r
-               int     EMM_INT         // close handle\r
-               jc      error1\r
-\r
+               //MML_CheckForEMS() takes care of what the code did here\r
                mov     ah,EMS_STATUS\r
                int     EMS_INT\r
                jc      error1                  // make sure EMS hardware is present\r