From 093c85d77838f681dee4a6cf13264a3e30b63d4f Mon Sep 17 00:00:00 2001 From: sparky4 Date: Thu, 29 Sep 2016 15:04:45 -0500 Subject: [PATCH] xms Works but it is quick and dirty and reliese on older C code with _REG defs and the Assembly translation is not smooth --- DEBUG.16W | 212 +++++++++++++++++++++++----------------------- HEAP.16W | 42 ++++----- src/exmmtest.c | 6 +- src/lib/16_mm.c | 21 +++-- src/lib/16_pm.c | 8 +- src/lib/16_tail.c | 2 +- 6 files changed, 145 insertions(+), 146 deletions(-) diff --git a/DEBUG.16W b/DEBUG.16W index 35c40cbf..dee25a22 100755 --- a/DEBUG.16W +++ b/DEBUG.16W @@ -1,210 +1,210 @@ -Seg:0 Size:9844 Owner:0x0 +Seg:0 Size:9855 Owner:0x0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++0 -Seg:2674 Size:256 Owner:0x18a8 +Seg:267f Size:256 Owner:0x18a8 ++++ -Seg:27f0 Size:44 Owner:0x0 +Seg:27fb Size:44 Owner:0x0 ++ -Seg:281c Size:256 Owner:0x1696 +Seg:2827 Size:256 Owner:0x1696 ++++ -Seg:291c Size:256 Owner:0x1698 +Seg:2927 Size:256 Owner:0x1698 ++++ -Seg:2a1c Size:256 Owner:0x169a -++++ -Seg:2b1c Size:256 Owner:0x169c +Seg:2a27 Size:256 Owner:0x169a +++++ -Seg:2c1c Size:256 Owner:0x169e +Seg:2b27 Size:256 Owner:0x169c ++++ -Seg:2d1c Size:256 Owner:0x16a0 +Seg:2c27 Size:256 Owner:0x169e ++++ -Seg:2e1c Size:256 Owner:0x16a2 +Seg:2d27 Size:256 Owner:0x16a0 ++++ -Seg:2f1c Size:256 Owner:0x16a4 +Seg:2e27 Size:256 Owner:0x16a2 ++++ -Seg:301c Size:256 Owner:0x16a6 +Seg:2f27 Size:256 Owner:0x16a4 +++++ -Seg:311c Size:256 Owner:0x16a8 +Seg:3027 Size:256 Owner:0x16a6 ++++ -Seg:321c Size:256 Owner:0x16aa +Seg:3127 Size:256 Owner:0x16a8 ++++ -Seg:331c Size:256 Owner:0x16ac +Seg:3227 Size:256 Owner:0x16aa ++++ -Seg:341c Size:256 Owner:0x16ae +Seg:3327 Size:256 Owner:0x16ac ++++ -Seg:351c Size:256 Owner:0x16b0 +Seg:3427 Size:256 Owner:0x16ae +++++ -Seg:361c Size:256 Owner:0x16b2 +Seg:3527 Size:256 Owner:0x16b0 ++++ -Seg:371c Size:256 Owner:0x16b4 +Seg:3627 Size:256 Owner:0x16b2 ++++ -Seg:381c Size:256 Owner:0x16b6 +Seg:3727 Size:256 Owner:0x16b4 ++++ -Seg:391c Size:256 Owner:0x16b8 +Seg:3827 Size:256 Owner:0x16b6 ++++ -Seg:3a1c Size:256 Owner:0x16ba +Seg:3927 Size:256 Owner:0x16b8 +++++ -Seg:3b1c Size:256 Owner:0x16bc +Seg:3a27 Size:256 Owner:0x16ba ++++ -Seg:3c1c Size:256 Owner:0x16be +Seg:3b27 Size:256 Owner:0x16bc ++++ -Seg:3d1c Size:256 Owner:0x16c0 +Seg:3c27 Size:256 Owner:0x16be ++++ -Seg:3e1c Size:256 Owner:0x16c2 +Seg:3d27 Size:256 Owner:0x16c0 ++++ -Seg:3f1c Size:256 Owner:0x16c4 +Seg:3e27 Size:256 Owner:0x16c2 +++++ -Seg:401c Size:256 Owner:0x16c6 +Seg:3f27 Size:256 Owner:0x16c4 ++++ -Seg:411c Size:256 Owner:0x16c8 +Seg:4027 Size:256 Owner:0x16c6 ++++ -Seg:421c Size:256 Owner:0x16ca +Seg:4127 Size:256 Owner:0x16c8 ++++ -Seg:431c Size:256 Owner:0x16cc +Seg:4227 Size:256 Owner:0x16ca ++++ -Seg:441c Size:256 Owner:0x16ce +Seg:4327 Size:256 Owner:0x16cc +++++ -Seg:451c Size:256 Owner:0x16d0 +Seg:4427 Size:256 Owner:0x16ce ++++ -Seg:461c Size:256 Owner:0x16d2 +Seg:4527 Size:256 Owner:0x16d0 ++++ -Seg:471c Size:256 Owner:0x16d4 +Seg:4627 Size:256 Owner:0x16d2 ++++ -Seg:481c Size:256 Owner:0x16d6 +Seg:4727 Size:256 Owner:0x16d4 ++++ -Seg:491c Size:256 Owner:0x16d8 +Seg:4827 Size:256 Owner:0x16d6 +++++ -Seg:4a1c Size:256 Owner:0x16da +Seg:4927 Size:256 Owner:0x16d8 ++++ -Seg:4b1c Size:256 Owner:0x16dc +Seg:4a27 Size:256 Owner:0x16da ++++ -Seg:4c1c Size:256 Owner:0x16de +Seg:4b27 Size:256 Owner:0x16dc ++++ -Seg:4d1c Size:256 Owner:0x16e0 +Seg:4c27 Size:256 Owner:0x16de ++++ -Seg:4e1c Size:256 Owner:0x16e2 +Seg:4d27 Size:256 Owner:0x16e0 +++++ -Seg:4f1c Size:256 Owner:0x16e4 +Seg:4e27 Size:256 Owner:0x16e2 ++++ -Seg:501c Size:256 Owner:0x16e6 +Seg:4f27 Size:256 Owner:0x16e4 ++++ -Seg:511c Size:256 Owner:0x16e8 +Seg:5027 Size:256 Owner:0x16e6 ++++ -Seg:521c Size:256 Owner:0x16ea +Seg:5127 Size:256 Owner:0x16e8 ++++ -Seg:531c Size:256 Owner:0x16ec +Seg:5227 Size:256 Owner:0x16ea +++++ -Seg:541c Size:256 Owner:0x16ee +Seg:5327 Size:256 Owner:0x16ec ++++ -Seg:551c Size:256 Owner:0x16f0 +Seg:5427 Size:256 Owner:0x16ee ++++ -Seg:561c Size:256 Owner:0x16f2 +Seg:5527 Size:256 Owner:0x16f0 ++++ -Seg:571c Size:256 Owner:0x16f4 +Seg:5627 Size:256 Owner:0x16f2 ++++ -Seg:581c Size:256 Owner:0x16f6 +Seg:5727 Size:256 Owner:0x16f4 +++++ -Seg:591c Size:256 Owner:0x16f8 +Seg:5827 Size:256 Owner:0x16f6 ++++ -Seg:5a1c Size:256 Owner:0x16fa +Seg:5927 Size:256 Owner:0x16f8 ++++ -Seg:5b1c Size:256 Owner:0x16fc +Seg:5a27 Size:256 Owner:0x16fa ++++ -Seg:5c1c Size:256 Owner:0x16fe +Seg:5b27 Size:256 Owner:0x16fc ++++ -Seg:5d1c Size:256 Owner:0x1700 +Seg:5c27 Size:256 Owner:0x16fe +++++ -Seg:5e1c Size:256 Owner:0x1702 +Seg:5d27 Size:256 Owner:0x1700 ++++ -Seg:5f1c Size:256 Owner:0x1704 +Seg:5e27 Size:256 Owner:0x1702 ++++ -Seg:601c Size:256 Owner:0x1706 +Seg:5f27 Size:256 Owner:0x1704 ++++ -Seg:611c Size:256 Owner:0x1708 +Seg:6027 Size:256 Owner:0x1706 ++++ -Seg:621c Size:256 Owner:0x170a +Seg:6127 Size:256 Owner:0x1708 +++++ -Seg:631c Size:256 Owner:0x170c +Seg:6227 Size:256 Owner:0x170a ++++ -Seg:641c Size:256 Owner:0x170e +Seg:6327 Size:256 Owner:0x170c ++++ -Seg:651c Size:256 Owner:0x1710 +Seg:6427 Size:256 Owner:0x170e ++++ -Seg:661c Size:256 Owner:0x1712 +Seg:6527 Size:256 Owner:0x1710 ++++ -Seg:671c Size:256 Owner:0x1714 +Seg:6627 Size:256 Owner:0x1712 +++++ -Seg:681c Size:256 Owner:0x1716 +Seg:6727 Size:256 Owner:0x1714 ++++ -Seg:691c Size:256 Owner:0x1718 +Seg:6827 Size:256 Owner:0x1716 ++++ -Seg:6a1c Size:256 Owner:0x171a +Seg:6927 Size:256 Owner:0x1718 ++++ -Seg:6b1c Size:256 Owner:0x171c +Seg:6a27 Size:256 Owner:0x171a ++++ -Seg:6c1c Size:256 Owner:0x171e +Seg:6b27 Size:256 Owner:0x171c +++++ -Seg:6d1c Size:256 Owner:0x1720 +Seg:6c27 Size:256 Owner:0x171e ++++ -Seg:6e1c Size:256 Owner:0x1722 +Seg:6d27 Size:256 Owner:0x1720 ++++ -Seg:6f1c Size:256 Owner:0x1724 +Seg:6e27 Size:256 Owner:0x1722 ++++ -Seg:701c Size:256 Owner:0x1726 +Seg:6f27 Size:256 Owner:0x1724 ++++ -Seg:711c Size:256 Owner:0x1728 +Seg:7027 Size:256 Owner:0x1726 +++++ -Seg:721c Size:256 Owner:0x172a +Seg:7127 Size:256 Owner:0x1728 ++++ -Seg:731c Size:256 Owner:0x172c +Seg:7227 Size:256 Owner:0x172a ++++ -Seg:741c Size:256 Owner:0x172e +Seg:7327 Size:256 Owner:0x172c ++++ -Seg:751c Size:256 Owner:0x1730 +Seg:7427 Size:256 Owner:0x172e ++++ -Seg:761c Size:256 Owner:0x1732 +Seg:7527 Size:256 Owner:0x1730 +++++ -Seg:771c Size:256 Owner:0x1734 +Seg:7627 Size:256 Owner:0x1732 ++++ -Seg:781c Size:256 Owner:0x1736 +Seg:7727 Size:256 Owner:0x1734 ++++ -Seg:791c Size:256 Owner:0x1738 +Seg:7827 Size:256 Owner:0x1736 ++++ -Seg:7a1c Size:256 Owner:0x173a +Seg:7927 Size:256 Owner:0x1738 ++++ -Seg:7b1c Size:256 Owner:0x173c +Seg:7a27 Size:256 Owner:0x173a +++++ -Seg:7c1c Size:256 Owner:0x173e +Seg:7b27 Size:256 Owner:0x173c ++++ -Seg:7d1c Size:256 Owner:0x1740 +Seg:7c27 Size:256 Owner:0x173e ++++ -Seg:7e1c Size:256 Owner:0x1742 +Seg:7d27 Size:256 Owner:0x1740 ++++ -Seg:7f1c Size:256 Owner:0x1744 +Seg:7e27 Size:256 Owner:0x1742 ++++ -Seg:801c Size:256 Owner:0x1746 +Seg:7f27 Size:256 Owner:0x1744 +++++ -Seg:811c Size:256 Owner:0x1748 +Seg:8027 Size:256 Owner:0x1746 ++++ -Seg:821c Size:256 Owner:0x174a +Seg:8127 Size:256 Owner:0x1748 ++++ -Seg:831c Size:256 Owner:0x174c +Seg:8227 Size:256 Owner:0x174a ++++ -Seg:841c Size:256 Owner:0x174e +Seg:8327 Size:256 Owner:0x174c ++++ -Seg:851c Size:256 Owner:0x1750 +Seg:8427 Size:256 Owner:0x174e +++++ -Seg:861c Size:256 Owner:0x1752 +Seg:8527 Size:256 Owner:0x1750 ++++ -Seg:871c Size:256 Owner:0x1754 +Seg:8627 Size:256 Owner:0x1752 ++++ -Seg:881c Size:256 Owner:0x1756 +Seg:8727 Size:256 Owner:0x1754 ++++ -Seg:891c Size:256 Owner:0x1758 +Seg:8827 Size:256 Owner:0x1756 ++++ -Seg:8a1c Size:256 Owner:0x175a +Seg:8927 Size:256 Owner:0x1758 +++++ -Seg:8b1c Size:256 Owner:0x175c +Seg:8a27 Size:256 Owner:0x175a +++++ +Seg:8b27 Size:256 Owner:0x175c ++++ -Seg:8c1c Size:273 Owner:0xe400 +Seg:8c27 Size:273 Owner:0xe400 ++++ -Seg:b81c Size:18403 Owner:0x0 +Seg:b827 Size:18392 Owner:0x0 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \ No newline at end of file diff --git a/HEAP.16W b/HEAP.16W index df0e710e..bbcc2ad3 100755 --- a/HEAP.16W +++ b/HEAP.16W @@ -1,35 +1,35 @@ == default == - USED block at 28120016 of size 66 - USED block at 28120058 of size 66 - FREE block at 2812009a of size 18 - USED block at 281200ac of size 136 - USED block at 28120134 of size 20 - FREE block at 28120148 of size 7860 + USED block at 281d0016 of size 66 + USED block at 281d0058 of size 66 + FREE block at 281d009a of size 18 + USED block at 281d00ac of size 136 + USED block at 281d0134 of size 20 + FREE block at 281d0148 of size 7860 OK - end of heap == near == - USED block at 1811e436 of size 12 - USED block at 1811e442 of size 332 - USED block at 1811e58e of size 52 - USED block at 1811e5c2 of size 20 - USED block at 1811e5d6 of size 20 - USED block at 1811e5ea of size 20 - USED block at 1811e5fe of size 20 - USED block at 1811e612 of size 20 - USED block at 1811e626 of size 6614 + USED block at 181ce436 of size 12 + USED block at 181ce442 of size 332 + USED block at 181ce58e of size 52 + USED block at 181ce5c2 of size 20 + USED block at 181ce5d6 of size 20 + USED block at 181ce5ea of size 20 + USED block at 181ce5fe of size 20 + USED block at 181ce612 of size 20 + USED block at 181ce626 of size 6614 OK - end of heap == far == - USED block at 28120016 of size 66 - USED block at 28120058 of size 66 - USED block at 2812009a of size 18 - USED block at 281200ac of size 136 - USED block at 28120134 of size 20 - USED block at 28120148 of size 7860 + USED block at 281d0016 of size 66 + USED block at 281d0058 of size 66 + USED block at 281d009a of size 18 + USED block at 281d00ac of size 136 + USED block at 281d0134 of size 20 + USED block at 281d0148 of size 7860 OK - end of heap Memory Type Total Used Free diff --git a/src/exmmtest.c b/src/exmmtest.c index 6d6e9a85..f68d148e 100755 --- a/src/exmmtest.c +++ b/src/exmmtest.c @@ -177,12 +177,12 @@ for(w=0;w<2;w++) printf("&bigb=%Fp ", &bigbuffer); //printf("&bigb=%04x", &bigbuffer); printf("\n"); -#endif printf("========================================\n"); +#endif #ifdef __WATCOMC__ //this is far printf("Total free: %lu\n", (dword)(GetFreeSize())); - printf("Total near free: %lu\n", (dword)(GetNearFreeSize())); - printf("Total far free: %lu\n", (dword)(GetFarFreeSize())); + printf("Total near free: %lub\n", (dword)(GetNearFreeSize())); + printf("Total far free: %lub\n", (dword)(GetFarFreeSize())); heapdump(&gvar); segatesuto(); #endif diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 51b4925a..282814bd 100755 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -1616,25 +1616,24 @@ void MM_Report_(global_game_variables_t *gvar) printf("========================================\n"); if(MML_CheckForEMS()) { - printf(" LIMEMS\n"); - printf(" EMM v%x.%x available\n", gvar->pm.emm.EMSVer>>4,gvar->pm.emm.EMSVer&0x0F); - printf(" totalEMSpages: %u ", gvar->pm.emm.totalEMSpages); printf("freeEMSpages: %u\n", gvar->pm.emm.freeEMSpages); - printf(" EMSPageFrame: %04x\n", gvar->pm.emm.EMSPageFrame); + printf(" %cLIMEMS %u\n", 0xC9, gvar->pm.emm.EMSPresent); + printf(" %c%cEMM v%x.%x available\n", 0xC7, 0xC4, gvar->pm.emm.EMSVer>>4,gvar->pm.emm.EMSVer&0x0F); + printf(" %c%ctotalEMSpages: %u ", 0xC7, 0xC4, gvar->pm.emm.totalEMSpages); printf("freeEMSpages: %u\n", gvar->pm.emm.freeEMSpages); + printf(" %c%cEMSPageFrame: %04x\n", 0xD3, 0xC4, gvar->pm.emm.EMSPageFrame); } if(MML_CheckForXMS()) { - printf(" XMS\n"); + printf(" %cXMS %u\n", 0xC9, gvar->pm.xmm.XMSPresent); //++++ printf(" XMS v%x.%x available\n", gvar->pm.xmm.XMSVer>>4,gvar->pm.xmm.XMSVer&0x0F); - printf(" XMSDriver: %Fp\n", XMSDriver); - printf(" XMSHandle: %04x\n", gvar->pm.xmm.XMSHandle); + printf(" %c%cXMSDriver: %Fp\n", 0xC7, 0xC4, XMSDriver); + printf(" %c%cXMSHandle: %04x\n", 0xD3, 0xC4, gvar->pm.xmm.XMSHandle); } - 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()) printf("XMSmem: %lu", gvar->mmi.XMSmem); printf("\n"); - printf("convmem:\n"); DebugMemory_(gvar, 0); + printf(" %cConv. %u\n", 0xC9, gvar->pm.mm.MainPresent); DebugMemory_(gvar, 0); //printf("mainmem: %lu\n", gvar->mmi.mainmem); //printf("Total convmem: %lu ", gvar->mmi.mainmem); printf("TotalFree: %lu ", MM_TotalFree(gvar)+gvar->mmi.EMSmem+gvar->mmi.XMSmem+gvar->mmi.XMSmem); printf("TotalUsed: %lu\n", gvar->mmi.mainmem); //printf(" UnusedMemory: %lu\n", MM_UnusedMemory(gvar)); - + 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()) printf("XMSmem: %lu", gvar->mmi.XMSmem); printf("\n"); } //========================================================================== diff --git a/src/lib/16_pm.c b/src/lib/16_pm.c index 191061f0..c7488a2a 100755 --- a/src/lib/16_pm.c +++ b/src/lib/16_pm.c @@ -1546,14 +1546,14 @@ PM_Startup(global_game_variables_t *gvar) PML_StartupEMS(gvar); if (!noxms && MML_CheckForXMS()) PML_StartupXMS(gvar); + if(!nomain) + PML_StartupMainMem(gvar); - if (!nomain && !gvar->pm.emm.EMSPresent) + if (!gvar->pm.mm.MainPresent && !gvar->pm.emm.EMSPresent && !gvar->pm.xmm.XMSPresent) { - printf("PM_Startup: No main or EMS\n"); - exit(-5); + Quit("PM_Startup: No main or EMS\n"); //return; } - PML_StartupMainMem(gvar); PM_Reset(gvar); diff --git a/src/lib/16_tail.c b/src/lib/16_tail.c index f9f6fb56..8ebc0c35 100755 --- a/src/lib/16_tail.c +++ b/src/lib/16_tail.c @@ -55,7 +55,7 @@ void DebugMemory_(global_game_variables_t *gvar, boolean q) printf(" DebugMemory_\n"); printf("========================================\n");} if(q) { printf("Memory Usage\n"); - printf("------------\n"); }else printf(" "); + printf("------------\n"); }else printf(" %c%c", 0xD3, 0xC4); printf("Total: "); if(q) printf(" "); printf("%uk", gvar->mmi.mainmem/1024); if(q) printf("\n"); else printf(" "); printf("Free: "); if(q) printf(" "); printf("%uk", MM_UnusedMemory(gvar)/1024); -- 2.39.5