From: sparky4 Date: Wed, 28 Sep 2016 19:42:57 +0000 (-0500) Subject: ====XMS MOSTLY translated but crashes EXMMTEST.EXE ==== X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=f140a355c36fae1da7e962c9828983e1fa131ad1;p=16.git ====XMS MOSTLY translated but crashes EXMMTEST.EXE ==== --- diff --git a/DEBUG.16W b/DEBUG.16W index 5aadb17d..0d535963 100755 --- a/DEBUG.16W +++ b/DEBUG.16W @@ -1,210 +1,210 @@ -Seg:0 Size:9818 Owner:0x0 +Seg:0 Size:9830 Owner:0x0 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++0 -Seg:265a Size:256 Owner:0x18a8 -++++ -Seg:27d7 Size:44 Owner:0x0 +Seg:2666 Size:256 Owner:0x18a8 ++++++ +Seg:27e2 Size:44 Owner:0x0 ++ -Seg:2803 Size:256 Owner:0x1696 +Seg:280e Size:256 Owner:0x1696 ++++ -Seg:2903 Size:256 Owner:0x1698 +Seg:290e Size:256 Owner:0x1698 ++++ -Seg:2a03 Size:256 Owner:0x169a +Seg:2a0e Size:256 Owner:0x169a ++++ -Seg:2b03 Size:256 Owner:0x169c +Seg:2b0e Size:256 Owner:0x169c ++++ -Seg:2c03 Size:256 Owner:0x169e +Seg:2c0e Size:256 Owner:0x169e +++++ -Seg:2d03 Size:256 Owner:0x16a0 +Seg:2d0e Size:256 Owner:0x16a0 ++++ -Seg:2e03 Size:256 Owner:0x16a2 +Seg:2e0e Size:256 Owner:0x16a2 ++++ -Seg:2f03 Size:256 Owner:0x16a4 +Seg:2f0e Size:256 Owner:0x16a4 ++++ -Seg:3003 Size:256 Owner:0x16a6 +Seg:300e Size:256 Owner:0x16a6 ++++ -Seg:3103 Size:256 Owner:0x16a8 +Seg:310e Size:256 Owner:0x16a8 +++++ -Seg:3203 Size:256 Owner:0x16aa +Seg:320e Size:256 Owner:0x16aa ++++ -Seg:3303 Size:256 Owner:0x16ac +Seg:330e Size:256 Owner:0x16ac ++++ -Seg:3403 Size:256 Owner:0x16ae +Seg:340e Size:256 Owner:0x16ae ++++ -Seg:3503 Size:256 Owner:0x16b0 +Seg:350e Size:256 Owner:0x16b0 ++++ -Seg:3603 Size:256 Owner:0x16b2 +Seg:360e Size:256 Owner:0x16b2 +++++ -Seg:3703 Size:256 Owner:0x16b4 +Seg:370e Size:256 Owner:0x16b4 ++++ -Seg:3803 Size:256 Owner:0x16b6 +Seg:380e Size:256 Owner:0x16b6 ++++ -Seg:3903 Size:256 Owner:0x16b8 +Seg:390e Size:256 Owner:0x16b8 ++++ -Seg:3a03 Size:256 Owner:0x16ba +Seg:3a0e Size:256 Owner:0x16ba ++++ -Seg:3b03 Size:256 Owner:0x16bc +Seg:3b0e Size:256 Owner:0x16bc +++++ -Seg:3c03 Size:256 Owner:0x16be +Seg:3c0e Size:256 Owner:0x16be ++++ -Seg:3d03 Size:256 Owner:0x16c0 +Seg:3d0e Size:256 Owner:0x16c0 ++++ -Seg:3e03 Size:256 Owner:0x16c2 +Seg:3e0e Size:256 Owner:0x16c2 ++++ -Seg:3f03 Size:256 Owner:0x16c4 +Seg:3f0e Size:256 Owner:0x16c4 ++++ -Seg:4003 Size:256 Owner:0x16c6 +Seg:400e Size:256 Owner:0x16c6 +++++ -Seg:4103 Size:256 Owner:0x16c8 +Seg:410e Size:256 Owner:0x16c8 ++++ -Seg:4203 Size:256 Owner:0x16ca +Seg:420e Size:256 Owner:0x16ca ++++ -Seg:4303 Size:256 Owner:0x16cc +Seg:430e Size:256 Owner:0x16cc ++++ -Seg:4403 Size:256 Owner:0x16ce +Seg:440e Size:256 Owner:0x16ce ++++ -Seg:4503 Size:256 Owner:0x16d0 +Seg:450e Size:256 Owner:0x16d0 +++++ -Seg:4603 Size:256 Owner:0x16d2 +Seg:460e Size:256 Owner:0x16d2 ++++ -Seg:4703 Size:256 Owner:0x16d4 +Seg:470e Size:256 Owner:0x16d4 ++++ -Seg:4803 Size:256 Owner:0x16d6 +Seg:480e Size:256 Owner:0x16d6 ++++ -Seg:4903 Size:256 Owner:0x16d8 +Seg:490e Size:256 Owner:0x16d8 ++++ -Seg:4a03 Size:256 Owner:0x16da +Seg:4a0e Size:256 Owner:0x16da +++++ -Seg:4b03 Size:256 Owner:0x16dc +Seg:4b0e Size:256 Owner:0x16dc ++++ -Seg:4c03 Size:256 Owner:0x16de +Seg:4c0e Size:256 Owner:0x16de ++++ -Seg:4d03 Size:256 Owner:0x16e0 +Seg:4d0e Size:256 Owner:0x16e0 ++++ -Seg:4e03 Size:256 Owner:0x16e2 +Seg:4e0e Size:256 Owner:0x16e2 ++++ -Seg:4f03 Size:256 Owner:0x16e4 +Seg:4f0e Size:256 Owner:0x16e4 +++++ -Seg:5003 Size:256 Owner:0x16e6 +Seg:500e Size:256 Owner:0x16e6 ++++ -Seg:5103 Size:256 Owner:0x16e8 +Seg:510e Size:256 Owner:0x16e8 ++++ -Seg:5203 Size:256 Owner:0x16ea +Seg:520e Size:256 Owner:0x16ea ++++ -Seg:5303 Size:256 Owner:0x16ec +Seg:530e Size:256 Owner:0x16ec ++++ -Seg:5403 Size:256 Owner:0x16ee +Seg:540e Size:256 Owner:0x16ee +++++ -Seg:5503 Size:256 Owner:0x16f0 +Seg:550e Size:256 Owner:0x16f0 ++++ -Seg:5603 Size:256 Owner:0x16f2 +Seg:560e Size:256 Owner:0x16f2 ++++ -Seg:5703 Size:256 Owner:0x16f4 +Seg:570e Size:256 Owner:0x16f4 ++++ -Seg:5803 Size:256 Owner:0x16f6 +Seg:580e Size:256 Owner:0x16f6 ++++ -Seg:5903 Size:256 Owner:0x16f8 +Seg:590e Size:256 Owner:0x16f8 +++++ -Seg:5a03 Size:256 Owner:0x16fa +Seg:5a0e Size:256 Owner:0x16fa ++++ -Seg:5b03 Size:256 Owner:0x16fc +Seg:5b0e Size:256 Owner:0x16fc ++++ -Seg:5c03 Size:256 Owner:0x16fe +Seg:5c0e Size:256 Owner:0x16fe ++++ -Seg:5d03 Size:256 Owner:0x1700 +Seg:5d0e Size:256 Owner:0x1700 ++++ -Seg:5e03 Size:256 Owner:0x1702 +Seg:5e0e Size:256 Owner:0x1702 +++++ -Seg:5f03 Size:256 Owner:0x1704 +Seg:5f0e Size:256 Owner:0x1704 ++++ -Seg:6003 Size:256 Owner:0x1706 +Seg:600e Size:256 Owner:0x1706 ++++ -Seg:6103 Size:256 Owner:0x1708 +Seg:610e Size:256 Owner:0x1708 ++++ -Seg:6203 Size:256 Owner:0x170a +Seg:620e Size:256 Owner:0x170a ++++ -Seg:6303 Size:256 Owner:0x170c +Seg:630e Size:256 Owner:0x170c +++++ -Seg:6403 Size:256 Owner:0x170e +Seg:640e Size:256 Owner:0x170e ++++ -Seg:6503 Size:256 Owner:0x1710 +Seg:650e Size:256 Owner:0x1710 ++++ -Seg:6603 Size:256 Owner:0x1712 +Seg:660e Size:256 Owner:0x1712 ++++ -Seg:6703 Size:256 Owner:0x1714 +Seg:670e Size:256 Owner:0x1714 ++++ -Seg:6803 Size:256 Owner:0x1716 +Seg:680e Size:256 Owner:0x1716 +++++ -Seg:6903 Size:256 Owner:0x1718 +Seg:690e Size:256 Owner:0x1718 ++++ -Seg:6a03 Size:256 Owner:0x171a +Seg:6a0e Size:256 Owner:0x171a ++++ -Seg:6b03 Size:256 Owner:0x171c +Seg:6b0e Size:256 Owner:0x171c ++++ -Seg:6c03 Size:256 Owner:0x171e +Seg:6c0e Size:256 Owner:0x171e ++++ -Seg:6d03 Size:256 Owner:0x1720 +Seg:6d0e Size:256 Owner:0x1720 +++++ -Seg:6e03 Size:256 Owner:0x1722 +Seg:6e0e Size:256 Owner:0x1722 ++++ -Seg:6f03 Size:256 Owner:0x1724 +Seg:6f0e Size:256 Owner:0x1724 ++++ -Seg:7003 Size:256 Owner:0x1726 +Seg:700e Size:256 Owner:0x1726 ++++ -Seg:7103 Size:256 Owner:0x1728 +Seg:710e Size:256 Owner:0x1728 ++++ -Seg:7203 Size:256 Owner:0x172a +Seg:720e Size:256 Owner:0x172a +++++ -Seg:7303 Size:256 Owner:0x172c +Seg:730e Size:256 Owner:0x172c ++++ -Seg:7403 Size:256 Owner:0x172e +Seg:740e Size:256 Owner:0x172e ++++ -Seg:7503 Size:256 Owner:0x1730 +Seg:750e Size:256 Owner:0x1730 ++++ -Seg:7603 Size:256 Owner:0x1732 +Seg:760e Size:256 Owner:0x1732 ++++ -Seg:7703 Size:256 Owner:0x1734 +Seg:770e Size:256 Owner:0x1734 +++++ -Seg:7803 Size:256 Owner:0x1736 +Seg:780e Size:256 Owner:0x1736 ++++ -Seg:7903 Size:256 Owner:0x1738 +Seg:790e Size:256 Owner:0x1738 ++++ -Seg:7a03 Size:256 Owner:0x173a +Seg:7a0e Size:256 Owner:0x173a ++++ -Seg:7b03 Size:256 Owner:0x173c +Seg:7b0e Size:256 Owner:0x173c ++++ -Seg:7c03 Size:256 Owner:0x173e +Seg:7c0e Size:256 Owner:0x173e +++++ -Seg:7d03 Size:256 Owner:0x1740 +Seg:7d0e Size:256 Owner:0x1740 ++++ -Seg:7e03 Size:256 Owner:0x1742 +Seg:7e0e Size:256 Owner:0x1742 ++++ -Seg:7f03 Size:256 Owner:0x1744 +Seg:7f0e Size:256 Owner:0x1744 ++++ -Seg:8003 Size:256 Owner:0x1746 +Seg:800e Size:256 Owner:0x1746 ++++ -Seg:8103 Size:256 Owner:0x1748 +Seg:810e Size:256 Owner:0x1748 +++++ -Seg:8203 Size:256 Owner:0x174a +Seg:820e Size:256 Owner:0x174a ++++ -Seg:8303 Size:256 Owner:0x174c +Seg:830e Size:256 Owner:0x174c ++++ -Seg:8403 Size:256 Owner:0x174e +Seg:840e Size:256 Owner:0x174e ++++ -Seg:8503 Size:256 Owner:0x1750 +Seg:850e Size:256 Owner:0x1750 ++++ -Seg:8603 Size:256 Owner:0x1752 +Seg:860e Size:256 Owner:0x1752 +++++ -Seg:8703 Size:256 Owner:0x1754 +Seg:870e Size:256 Owner:0x1754 ++++ -Seg:8803 Size:256 Owner:0x1756 +Seg:880e Size:256 Owner:0x1756 ++++ -Seg:8903 Size:256 Owner:0x1758 +Seg:890e Size:256 Owner:0x1758 ++++ -Seg:8a03 Size:256 Owner:0x175a +Seg:8a0e Size:256 Owner:0x175a ++++ -Seg:8b03 Size:256 Owner:0x175c +Seg:8b0e Size:256 Owner:0x175c +++++ -Seg:8c03 Size:273 Owner:0xe3f0 +Seg:8c0e Size:273 Owner:0xe400 ++++ -Seg:b803 Size:18428 Owner:0x0 +Seg:b80e Size:18417 Owner:0x0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \ No newline at end of file diff --git a/HEAP.16W b/HEAP.16W index 59a1b45b..536fe06c 100755 --- a/HEAP.16W +++ b/HEAP.16W @@ -1,47 +1,47 @@ == default == - USED block at 27f90016 of size 66 - USED block at 27f90058 of size 66 - FREE block at 27f9009a of size 18 - USED block at 27f900ac of size 136 - USED block at 27f90134 of size 20 - FREE block at 27f90148 of size 7860 + USED block at 28040016 of size 66 + USED block at 28040058 of size 66 + FREE block at 2804009a of size 18 + USED block at 280400ac of size 136 + USED block at 28040134 of size 20 + FREE block at 28040148 of size 7860 OK - end of heap == near == - USED block at 17f8e426 of size 12 - USED block at 17f8e432 of size 332 - USED block at 17f8e57e of size 52 - USED block at 17f8e5b2 of size 20 - USED block at 17f8e5c6 of size 20 - USED block at 17f8e5da of size 20 - USED block at 17f8e5ee of size 20 - USED block at 17f8e602 of size 20 - USED block at 17f8e616 of size 6630 + USED block at 1803e436 of size 12 + USED block at 1803e442 of size 332 + USED block at 1803e58e of size 52 + USED block at 1803e5c2 of size 20 + USED block at 1803e5d6 of size 20 + USED block at 1803e5ea of size 20 + USED block at 1803e5fe of size 20 + USED block at 1803e612 of size 20 + USED block at 1803e626 of size 6614 OK - end of heap == far == - USED block at 27f90016 of size 66 - USED block at 27f90058 of size 66 - USED block at 27f9009a of size 18 - USED block at 27f900ac of size 136 - USED block at 27f90134 of size 20 - USED block at 27f90148 of size 7860 + USED block at 28040016 of size 66 + USED block at 28040058 of size 66 + USED block at 2804009a of size 18 + USED block at 280400ac of size 136 + USED block at 28040134 of size 20 + USED block at 28040148 of size 7860 OK - end of heap Memory Type Total Used Free ---------------- -------- -------- -------- Default 8166 288 7878 -Near 7126 496 6630 +Near 7110 496 6614 Far 8166 0 7878 ---------------- -------- -------- -------- -coreleft = 6628 -farcoreleft = 30736 +coreleft = 6612 +farcoreleft = 30720 GetFreeSize = 24128 -GetNearFreeSize = 6630 +GetNearFreeSize = 6614 GetFarFreeSize = 24128 -memavl = 6628 +memavl = 6612 stackavail = 31588 diff --git a/MMDUMP.16W b/MMDUMP.16W index e231e3c7..cb01f5be 100755 Binary files a/MMDUMP.16W and b/MMDUMP.16W differ diff --git a/bcexmm.exe b/bcexmm.exe index ce9344aa..321b7912 100755 Binary files a/bcexmm.exe and b/bcexmm.exe differ diff --git a/bcexmm.prj b/bcexmm.prj index e49efa5b..f3336226 100755 Binary files a/bcexmm.prj and b/bcexmm.prj differ diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index c2a966b8..a8c07017 100755 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -1625,7 +1625,7 @@ void MM_Report_(global_game_variables_t *gvar) if(MML_CheckForXMS(gvar)) { printf(" XMS\n"); - printf(" XMSaddr: %X\n", *XMSaddr); + printf(" XMSDriver: %X\n", XMSDriver); } printf("nearheap: %lu ", gvar->mmi.nearheap); printf("farheap: %lu\n", gvar->mmi.farheap); if(MML_CheckForEMS()) printf("EMSmem: %lu ", gvar->mmi.EMSmem); if(MML_CheckForXMS(gvar)) printf("XMSmem: %lu", gvar->mmi.XMSmem); printf("\n"); diff --git a/src/lib/16_mm.h b/src/lib/16_mm.h index e816d885..59716d49 100755 --- a/src/lib/16_mm.h +++ b/src/lib/16_mm.h @@ -79,7 +79,7 @@ extern boolean dbg_debugpm; #define XMS_GDISABLEA20 0x04 #define XMS_LENABLEA20 0x05 #define XMS_LDISABLEA20 0x06 -#define XMS_QUERYA20 0x07 +#define XMS_QUERYA20 0x07 #define XMS_QUERYFREE 0x08 #define XMS_ALLOC 0x09 @@ -106,6 +106,7 @@ extern boolean dbg_debugpm; extern void (* beforesort) (void); extern void (* aftersort) (void); extern void (* XMSaddr) (void); // far pointer to XMS driver +extern dword XMSDriver; //========================================================================== diff --git a/src/lib/16_pm.c b/src/lib/16_pm.c index bb08180d..29156f92 100755 --- a/src/lib/16_pm.c +++ b/src/lib/16_pm.c @@ -48,7 +48,7 @@ boolean dbg_debugpm=0; // XMS specific variables //boolean XMSPresent; //word gvar->pm.xmm.XMSAvail,gvar->pm.xmm.XMSPagesAvail,gvar->pm.xmm.XMSHandle; - word XMSDriver; + dword XMSDriver; /* int gvar->pm.xmm.XMSProtectPage = -1; // File specific variables @@ -92,9 +92,9 @@ PML_MapEMS(word logical, byte physical, global_game_variables_t *gvar) __asm { mov ah,EMS_MAPPAGE - mov al,physical - mov bx,logical - mov dx,EMShandle + mov al,[physical] + mov bx,[logical] + mov dx,[EMShandle] int EMS_INT or ah,ah jnz error @@ -240,7 +240,7 @@ PML_StartupEMS(global_game_variables_t *gvar) */ __asm { mov ah,EMS_ALLOCPAGES - mov bx,[EMSAvail]; + mov bx,[EMSAvail] int EMS_INT or ah,ah jnz erroreuu @@ -359,7 +359,7 @@ PML_StartupXMS(global_game_variables_t *gvar) boolean errorflag; word XMSAvail, XMSHandle; errorflag=gvar->pm.xmm.XMSPresent = false; // Assume failure - XMSAvail = gvar->pm.xmm.XMSAvail = 0; + gvar->pm.xmm.XMSAvail = gvar->mmi.XMSmem = 0; __asm { mov ax,0x4300 @@ -374,7 +374,7 @@ PML_StartupXMS(global_game_variables_t *gvar) //XMS_CALL(XMS_QUERYFREE); // Find out how much XMS is available mov ah,XMS_QUERYFREE - call [WORD PTR XMSDriver] + call [DWORD PTR XMSDriver] mov [XMSAvail],ax or ax,ax // AJR: bugfix 10/8/92 jz errorxu @@ -396,9 +396,11 @@ PML_StartupXMS(global_game_variables_t *gvar) #ifdef __WATCOMC__ } #endif - gvar->pm.xmm.XMSAvail &= ~(PMPageSizeKB - 1); // Round off to nearest page size - if (gvar->pm.xmm.XMSAvail < (PMPageSizeKB * 2)) // Need at least 2 pages + XMSAvail &= ~(PMPageSizeKB - 1); // Round off to nearest page size + if (XMSAvail < (PMPageSizeKB * 2)){ // Need at least 2 pages + printf("PISS! %u\n", XMSAvail); goto error; + } __asm { mov dx,[XMSAvail] @@ -431,11 +433,13 @@ PML_StartupXMS(global_game_variables_t *gvar) if(errorflag==false) { gvar->pm.xmm.XMSAvail = XMSAvail; - gvar->mmi.XMSmem += gvar->pm.xmm.XMSAvail * 1024; + gvar->mmi.XMSmem += gvar->pm.xmm.XMSAvail * (dword)1024; gvar->pm.xmm.XMSHandle = XMSHandle; gvar->pm.xmm.XMSPresent = true; - } + printf(" %u %u %u\n", gvar->mmi.XMSmem, gvar->pm.xmm.XMSAvail, XMSAvail); + getch(); + }else printf(" errorflag\n"); error: return(gvar->pm.xmm.XMSPresent); } @@ -1470,17 +1474,13 @@ PM_Startup(global_game_variables_t *gvar) if (!noems) PML_StartupEMS(gvar); - /*if (!noxms) - { - //++++ - printf("PML_StartupXMS "); - PML_StartupXMS(gvar); //TODO: convert - printf("ok!\n"); - }*/ + if (!noxms) + PML_StartupXMS(gvar); if (!nomain && !gvar->pm.emm.EMSPresent) { - Quit("PM_Startup: No main or EMS\n"); + printf("PM_Startup: No main or EMS\n"); + exit(-5); //return; } PML_StartupMainMem(gvar);