From: sparky4 Date: Wed, 1 Mar 2017 03:27:15 +0000 (-0600) Subject: NULL pageframe detection added for EMM386 memory manager failing to assign one and... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=d06af3204c0067dd85f1524b4622a65f944c97fd;p=16.git NULL pageframe detection added for EMM386 memory manager failing to assign one and removed duplicate code --- diff --git a/DEBUG.16W b/DEBUG.16W index ce787d07..b95cd967 100755 --- a/DEBUG.16W +++ b/DEBUG.16W @@ -1,210 +1,210 @@ -Seg:0 Size:9022 Owner:0x0 +Seg:0 Size:9027 Owner:0x0 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++0000 -Seg:242e Size:39 Owner:0x0 +Seg:2434 Size:39 Owner:0x0 ++ -Seg:2455 Size:256 Owner:0x1dc4 +Seg:245b Size:256 Owner:0x1db4 ++++ -Seg:2555 Size:256 Owner:0x1bb6 +Seg:255b Size:256 Owner:0x1ba6 ++++ -Seg:2655 Size:256 Owner:0x1bb8 +Seg:265b Size:256 Owner:0x1ba8 ++++ -Seg:2755 Size:256 Owner:0x1bba +Seg:275b Size:256 Owner:0x1baa +++++ -Seg:2855 Size:256 Owner:0x1bbc +Seg:285b Size:256 Owner:0x1bac ++++ -Seg:2955 Size:256 Owner:0x1bbe +Seg:295b Size:256 Owner:0x1bae ++++ -Seg:2a55 Size:256 Owner:0x1bc0 +Seg:2a5b Size:256 Owner:0x1bb0 ++++ -Seg:2b55 Size:256 Owner:0x1bc2 +Seg:2b5b Size:256 Owner:0x1bb2 ++++ -Seg:2c55 Size:256 Owner:0x1bc4 +Seg:2c5b Size:256 Owner:0x1bb4 +++++ -Seg:2d55 Size:256 Owner:0x1bc6 +Seg:2d5b Size:256 Owner:0x1bb6 ++++ -Seg:2e55 Size:256 Owner:0x1bc8 +Seg:2e5b Size:256 Owner:0x1bb8 ++++ -Seg:2f55 Size:256 Owner:0x1bca +Seg:2f5b Size:256 Owner:0x1bba ++++ -Seg:3055 Size:256 Owner:0x1bcc +Seg:305b Size:256 Owner:0x1bbc ++++ -Seg:3155 Size:256 Owner:0x1bce +Seg:315b Size:256 Owner:0x1bbe +++++ -Seg:3255 Size:256 Owner:0x1bd0 +Seg:325b Size:256 Owner:0x1bc0 ++++ -Seg:3355 Size:256 Owner:0x1bd2 +Seg:335b Size:256 Owner:0x1bc2 ++++ -Seg:3455 Size:256 Owner:0x1bd4 +Seg:345b Size:256 Owner:0x1bc4 ++++ -Seg:3555 Size:256 Owner:0x1bd6 +Seg:355b Size:256 Owner:0x1bc6 ++++ -Seg:3655 Size:256 Owner:0x1bd8 +Seg:365b Size:256 Owner:0x1bc8 +++++ -Seg:3755 Size:256 Owner:0x1bda +Seg:375b Size:256 Owner:0x1bca ++++ -Seg:3855 Size:256 Owner:0x1bdc +Seg:385b Size:256 Owner:0x1bcc ++++ -Seg:3955 Size:256 Owner:0x1bde +Seg:395b Size:256 Owner:0x1bce ++++ -Seg:3a55 Size:256 Owner:0x1be0 +Seg:3a5b Size:256 Owner:0x1bd0 ++++ -Seg:3b55 Size:256 Owner:0x1be2 +Seg:3b5b Size:256 Owner:0x1bd2 +++++ -Seg:3c55 Size:256 Owner:0x1be4 +Seg:3c5b Size:256 Owner:0x1bd4 ++++ -Seg:3d55 Size:256 Owner:0x1be6 +Seg:3d5b Size:256 Owner:0x1bd6 ++++ -Seg:3e55 Size:256 Owner:0x1be8 +Seg:3e5b Size:256 Owner:0x1bd8 ++++ -Seg:3f55 Size:256 Owner:0x1bea +Seg:3f5b Size:256 Owner:0x1bda ++++ -Seg:4055 Size:256 Owner:0x1bec +Seg:405b Size:256 Owner:0x1bdc +++++ -Seg:4155 Size:256 Owner:0x1bee +Seg:415b Size:256 Owner:0x1bde ++++ -Seg:4255 Size:256 Owner:0x1bf0 +Seg:425b Size:256 Owner:0x1be0 ++++ -Seg:4355 Size:256 Owner:0x1bf2 +Seg:435b Size:256 Owner:0x1be2 ++++ -Seg:4455 Size:256 Owner:0x1bf4 +Seg:445b Size:256 Owner:0x1be4 ++++ -Seg:4555 Size:256 Owner:0x1bf6 +Seg:455b Size:256 Owner:0x1be6 +++++ -Seg:4655 Size:256 Owner:0x1bf8 +Seg:465b Size:256 Owner:0x1be8 ++++ -Seg:4755 Size:256 Owner:0x1bfa +Seg:475b Size:256 Owner:0x1bea ++++ -Seg:4855 Size:256 Owner:0x1bfc +Seg:485b Size:256 Owner:0x1bec ++++ -Seg:4955 Size:256 Owner:0x1bfe +Seg:495b Size:256 Owner:0x1bee ++++ -Seg:4a55 Size:256 Owner:0x1c00 +Seg:4a5b Size:256 Owner:0x1bf0 +++++ -Seg:4b55 Size:256 Owner:0x1c02 +Seg:4b5b Size:256 Owner:0x1bf2 ++++ -Seg:4c55 Size:256 Owner:0x1c04 +Seg:4c5b Size:256 Owner:0x1bf4 ++++ -Seg:4d55 Size:256 Owner:0x1c06 +Seg:4d5b Size:256 Owner:0x1bf6 ++++ -Seg:4e55 Size:256 Owner:0x1c08 +Seg:4e5b Size:256 Owner:0x1bf8 ++++ -Seg:4f55 Size:256 Owner:0x1c0a +Seg:4f5b Size:256 Owner:0x1bfa +++++ -Seg:5055 Size:256 Owner:0x1c0c +Seg:505b Size:256 Owner:0x1bfc ++++ -Seg:5155 Size:256 Owner:0x1c0e +Seg:515b Size:256 Owner:0x1bfe ++++ -Seg:5255 Size:256 Owner:0x1c10 +Seg:525b Size:256 Owner:0x1c00 ++++ -Seg:5355 Size:256 Owner:0x1c12 +Seg:535b Size:256 Owner:0x1c02 ++++ -Seg:5455 Size:256 Owner:0x1c14 +Seg:545b Size:256 Owner:0x1c04 +++++ -Seg:5555 Size:256 Owner:0x1c16 +Seg:555b Size:256 Owner:0x1c06 ++++ -Seg:5655 Size:256 Owner:0x1c18 +Seg:565b Size:256 Owner:0x1c08 ++++ -Seg:5755 Size:256 Owner:0x1c1a +Seg:575b Size:256 Owner:0x1c0a ++++ -Seg:5855 Size:256 Owner:0x1c1c +Seg:585b Size:256 Owner:0x1c0c ++++ -Seg:5955 Size:256 Owner:0x1c1e +Seg:595b Size:256 Owner:0x1c0e +++++ -Seg:5a55 Size:256 Owner:0x1c20 +Seg:5a5b Size:256 Owner:0x1c10 ++++ -Seg:5b55 Size:256 Owner:0x1c22 +Seg:5b5b Size:256 Owner:0x1c12 ++++ -Seg:5c55 Size:256 Owner:0x1c24 +Seg:5c5b Size:256 Owner:0x1c14 ++++ -Seg:5d55 Size:256 Owner:0x1c26 +Seg:5d5b Size:256 Owner:0x1c16 ++++ -Seg:5e55 Size:256 Owner:0x1c28 +Seg:5e5b Size:256 Owner:0x1c18 +++++ -Seg:5f55 Size:256 Owner:0x1c2a +Seg:5f5b Size:256 Owner:0x1c1a ++++ -Seg:6055 Size:256 Owner:0x1c2c +Seg:605b Size:256 Owner:0x1c1c ++++ -Seg:6155 Size:256 Owner:0x1c2e +Seg:615b Size:256 Owner:0x1c1e ++++ -Seg:6255 Size:256 Owner:0x1c30 +Seg:625b Size:256 Owner:0x1c20 ++++ -Seg:6355 Size:256 Owner:0x1c32 +Seg:635b Size:256 Owner:0x1c22 +++++ -Seg:6455 Size:256 Owner:0x1c34 +Seg:645b Size:256 Owner:0x1c24 ++++ -Seg:6555 Size:256 Owner:0x1c36 +Seg:655b Size:256 Owner:0x1c26 ++++ -Seg:6655 Size:256 Owner:0x1c38 +Seg:665b Size:256 Owner:0x1c28 ++++ -Seg:6755 Size:256 Owner:0x1c3a +Seg:675b Size:256 Owner:0x1c2a ++++ -Seg:6855 Size:256 Owner:0x1c3c +Seg:685b Size:256 Owner:0x1c2c +++++ -Seg:6955 Size:256 Owner:0x1c3e +Seg:695b Size:256 Owner:0x1c2e ++++ -Seg:6a55 Size:256 Owner:0x1c40 +Seg:6a5b Size:256 Owner:0x1c30 ++++ -Seg:6b55 Size:256 Owner:0x1c42 +Seg:6b5b Size:256 Owner:0x1c32 ++++ -Seg:6c55 Size:256 Owner:0x1c44 +Seg:6c5b Size:256 Owner:0x1c34 ++++ -Seg:6d55 Size:256 Owner:0x1c46 +Seg:6d5b Size:256 Owner:0x1c36 +++++ -Seg:6e55 Size:256 Owner:0x1c48 +Seg:6e5b Size:256 Owner:0x1c38 ++++ -Seg:6f55 Size:256 Owner:0x1c4a +Seg:6f5b Size:256 Owner:0x1c3a ++++ -Seg:7055 Size:256 Owner:0x1c4c +Seg:705b Size:256 Owner:0x1c3c ++++ -Seg:7155 Size:256 Owner:0x1c4e +Seg:715b Size:256 Owner:0x1c3e ++++ -Seg:7255 Size:256 Owner:0x1c50 +Seg:725b Size:256 Owner:0x1c40 +++++ -Seg:7355 Size:256 Owner:0x1c52 +Seg:735b Size:256 Owner:0x1c42 ++++ -Seg:7455 Size:256 Owner:0x1c54 +Seg:745b Size:256 Owner:0x1c44 ++++ -Seg:7555 Size:256 Owner:0x1c56 +Seg:755b Size:256 Owner:0x1c46 ++++ -Seg:7655 Size:256 Owner:0x1c58 +Seg:765b Size:256 Owner:0x1c48 ++++ -Seg:7755 Size:256 Owner:0x1c5a +Seg:775b Size:256 Owner:0x1c4a +++++ -Seg:7855 Size:256 Owner:0x1c5c +Seg:785b Size:256 Owner:0x1c4c ++++ -Seg:7955 Size:256 Owner:0x1c5e +Seg:795b Size:256 Owner:0x1c4e ++++ -Seg:7a55 Size:256 Owner:0x1c60 +Seg:7a5b Size:256 Owner:0x1c50 ++++ -Seg:7b55 Size:256 Owner:0x1c62 +Seg:7b5b Size:256 Owner:0x1c52 ++++ -Seg:7c55 Size:256 Owner:0x1c64 +Seg:7c5b Size:256 Owner:0x1c54 +++++ -Seg:7d55 Size:256 Owner:0x1c66 +Seg:7d5b Size:256 Owner:0x1c56 ++++ -Seg:7e55 Size:256 Owner:0x1c68 +Seg:7e5b Size:256 Owner:0x1c58 ++++ -Seg:7f55 Size:256 Owner:0x1c6a +Seg:7f5b Size:256 Owner:0x1c5a ++++ -Seg:8055 Size:256 Owner:0x1c6c +Seg:805b Size:256 Owner:0x1c5c ++++ -Seg:8155 Size:256 Owner:0x1c6e +Seg:815b Size:256 Owner:0x1c5e +++++ -Seg:8255 Size:256 Owner:0x1c70 +Seg:825b Size:256 Owner:0x1c60 ++++ -Seg:8355 Size:256 Owner:0x1c72 +Seg:835b Size:256 Owner:0x1c62 ++++ -Seg:8455 Size:256 Owner:0x1c74 +Seg:845b Size:256 Owner:0x1c64 ++++ -Seg:8555 Size:256 Owner:0x1c76 +Seg:855b Size:256 Owner:0x1c66 ++++ -Seg:8655 Size:256 Owner:0x1c78 +Seg:865b Size:256 Owner:0x1c68 +++++ -Seg:8755 Size:256 Owner:0x1c7a +Seg:875b Size:256 Owner:0x1c6a ++++ -Seg:8855 Size:256 Owner:0x1c7c +Seg:885b Size:256 Owner:0x1c6c ++++ -Seg:8955 Size:273 Owner:0x1b88 +Seg:895b Size:273 Owner:0x1b78 ++++ -Seg:9d94 Size:25195 Owner:0x0 +Seg:9d9a Size:25189 Owner:0x0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \ No newline at end of file diff --git a/HEAP.16W b/HEAP.16W index 6f9a21a6..e80b7862 100755 --- a/HEAP.16W +++ b/HEAP.16W @@ -1,47 +1,45 @@ == default == - USED block at 24500016 of size 26 - USED block at 24500030 of size 26 - FREE block at 2450004a of size 38914 - USED block at 2450984c of size 136 - USED block at 245098d4 of size 20 - FREE block at 245098e8 of size 7972 + USED block at 24560016 of size 26 + USED block at 24560030 of size 26 + FREE block at 2456004a of size 38914 + USED block at 2456984c of size 136 + USED block at 245698d4 of size 20 + FREE block at 245698e8 of size 7972 OK - end of heap == near == - USED block at 144fecf6 of size 12 - USED block at 144fed02 of size 332 - USED block at 144fee4e of size 52 - USED block at 144fee82 of size 20 - USED block at 144fee96 of size 20 - USED block at 144feeaa of size 20 - USED block at 144feebe of size 20 - USED block at 144feed2 of size 20 - USED block at 144feee6 of size 4374 + USED block at 1455ece6 of size 12 + USED block at 1455ecf2 of size 332 + USED block at 1455ee3e of size 52 + USED block at 1455ee72 of size 20 + USED block at 1455ee86 of size 20 + USED block at 1455ee9a of size 20 + USED block at 1455eeae of size 20 + USED block at 1455eec2 of size 20 + USED block at 1455eed6 of size 4390 OK - end of heap == far == - USED block at 24500016 of size 26 - USED block at 24500030 of size 26 - USED block at 2450004a of size 38914 - USED block at 2450984c of size 136 - USED block at 245098d4 of size 20 - USED block at 245098e8 of size 7972 + USED block at 24560016 of size 26 + USED block at 24560030 of size 26 + USED block at 2456004a of size 38914 + USED block at 2456984c of size 136 + USED block at 245698d4 of size 20 + USED block at 245698e8 of size 7972 OK - end of heap Memory Type Total Used Free ---------------- -------- -------- -------- -Default 47094 208 46886 -Near 4870 496 4374 -Far 47094 208 46886 ----------------- -------- -------- -------- -HC_coreleft = 4372 +Default 47094Near 4886 496 4390 +Far 47094---------------- -------- -------- -------- +HC_coreleft = 4388 HC_farcoreleft = 458752 HC_GetFreeSize = 46886 -HC_GetNearFreeSize = 4374 +HC_GetNearFreeSize = 4390 HC_GetFarFreeSize = 46886 -memavl = 4372 +memavl = 4388 stackavail = 31606 diff --git a/MMDUMP.16W b/MMDUMP.16W index 5b3efb03..58be92ad 100755 Binary files a/MMDUMP.16W and b/MMDUMP.16W differ diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 67059b39..64533549 100755 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -90,17 +90,18 @@ boolean MML_CheckForEMS(void) { boolean emmcfems = false; word EMSPageFrame = 0; + byte err=0, str[64]; static char emmname[] = "EMMXXXX0"; //fix by andrius4669 __asm { mov dx,OFFSET emmname //fix by andrius4669 mov ax,0x3d00 - int 0x21 // try to open EMMXXXX0 device + int EMM_INT // try to open EMMXXXX0 device jc error mov bx,ax mov ax,0x4400 - int 0x21 // get device info + int EMM_INT // get device info jc error and dx,0x80 @@ -108,13 +109,13 @@ boolean MML_CheckForEMS(void) mov ax,0x4407 - int 0x21 // get status + int EMM_INT // get status jc error or al,al jz error mov ah,0x3e - int 0x21 // close handle + int EMM_INT // close handle jc error // @@ -141,6 +142,7 @@ boolean MML_CheckForEMS(void) // // EMS is bad // + mov err,ah mov emmcfems,0 #ifdef __BORLANDC__ } @@ -159,7 +161,13 @@ boolean MML_CheckForEMS(void) #if defined(__DEBUG_PM__) || defined(__DEBUG_MM__) printf("MML_CheckForEMS: EMS error No Pageframe!\nAddress detected to be %04x\n", EMSPageFrame); #endif + }else if(!emmcfems)// if there is an error and page frame is not 0000 + { + strcpy(str,"MML_CheckForEMS: EMS error "); + MM_EMSerr(str, err); + printf("%s\n",str); } + return(emmcfems); } diff --git a/src/lib/16_pm.c b/src/lib/16_pm.c index f4e15082..2983499b 100755 --- a/src/lib/16_pm.c +++ b/src/lib/16_pm.c @@ -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 // to the maximum we need) // +// Please call MML_CheckForEMS() before calling this function. +// MML_CheckForEMS is not local despite the name wwww. +// boolean PML_StartupEMS(global_game_variables_t *gvar) @@ -164,7 +167,6 @@ PML_StartupEMS(global_game_variables_t *gvar) byte err=0, str[64]; boolean errorflag=false; - static char emmname[] = "EMMXXXX0"; //fix by andrius4669 unsigned EMSVer; unsigned totalEMSpages,freeEMSpages,EMSPageFrame,EMSHandle,EMSAvail; totalEMSpages = freeEMSpages = EMSPageFrame = EMSHandle = EMSAvail = EMSVer = 0; // set all to 0~ @@ -172,31 +174,7 @@ PML_StartupEMS(global_game_variables_t *gvar) gvar->pm.emm.EMSAvail = gvar->mmi.EMSmem = 0; __asm { - mov dx,OFFSET emmname //fix by andrius4669 - mov ax,0x3d00 - int EMM_INT // try to open EMMXXXX0 device - jc error1 - - mov bx,ax - mov ax,0x4400 - - int EMM_INT // get device info - jc error1 - - and dx,0x80 - jz error1 - - mov ax,0x4407 - - int EMM_INT // get status - jc error1 - or al,al - jz error1 - - mov ah,0x3e - int EMM_INT // close handle - jc error1 - + //MML_CheckForEMS() takes care of what the code did here mov ah,EMS_STATUS int EMS_INT jc error1 // make sure EMS hardware is present