From c1cfe5e037466d48ec26d559f6183d7ad095551d Mon Sep 17 00:00:00 2001 From: sparky4 Date: Tue, 4 Oct 2016 09:41:20 -0500 Subject: [PATCH] meh xms is hard wwww --- DEBUG.16W | 216 ++++++++++++++++++++++----------------------- HEAP.16W | 42 ++++----- src/lib/16_head.h | 2 +- src/lib/16_pm.c | 42 ++++----- src/lib/typdefst.h | 2 +- 5 files changed, 146 insertions(+), 158 deletions(-) diff --git a/DEBUG.16W b/DEBUG.16W index dee25a22..503c7fd2 100755 --- a/DEBUG.16W +++ b/DEBUG.16W @@ -1,210 +1,210 @@ -Seg:0 Size:9855 Owner:0x0 +Seg:0 Size:9874 Owner:0x0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++0 -Seg:267f Size:256 Owner:0x18a8 +Seg:2692 Size:256 Owner:0x18a8 ++++ -Seg:27fb Size:44 Owner:0x0 -++ -Seg:2827 Size:256 Owner:0x1696 +Seg:280e Size:44 Owner:0x0 ++ +Seg:283a Size:256 Owner:0x1696 ++++ -Seg:2927 Size:256 Owner:0x1698 -++++ -Seg:2a27 Size:256 Owner:0x169a +Seg:293a Size:256 Owner:0x1698 +++++ -Seg:2b27 Size:256 Owner:0x169c +Seg:2a3a Size:256 Owner:0x169a ++++ -Seg:2c27 Size:256 Owner:0x169e +Seg:2b3a Size:256 Owner:0x169c ++++ -Seg:2d27 Size:256 Owner:0x16a0 +Seg:2c3a Size:256 Owner:0x169e ++++ -Seg:2e27 Size:256 Owner:0x16a2 +Seg:2d3a Size:256 Owner:0x16a0 ++++ -Seg:2f27 Size:256 Owner:0x16a4 +Seg:2e3a Size:256 Owner:0x16a2 +++++ -Seg:3027 Size:256 Owner:0x16a6 +Seg:2f3a Size:256 Owner:0x16a4 ++++ -Seg:3127 Size:256 Owner:0x16a8 +Seg:303a Size:256 Owner:0x16a6 ++++ -Seg:3227 Size:256 Owner:0x16aa +Seg:313a Size:256 Owner:0x16a8 ++++ -Seg:3327 Size:256 Owner:0x16ac +Seg:323a Size:256 Owner:0x16aa ++++ -Seg:3427 Size:256 Owner:0x16ae +Seg:333a Size:256 Owner:0x16ac +++++ -Seg:3527 Size:256 Owner:0x16b0 +Seg:343a Size:256 Owner:0x16ae ++++ -Seg:3627 Size:256 Owner:0x16b2 +Seg:353a Size:256 Owner:0x16b0 ++++ -Seg:3727 Size:256 Owner:0x16b4 +Seg:363a Size:256 Owner:0x16b2 ++++ -Seg:3827 Size:256 Owner:0x16b6 +Seg:373a Size:256 Owner:0x16b4 ++++ -Seg:3927 Size:256 Owner:0x16b8 +Seg:383a Size:256 Owner:0x16b6 +++++ -Seg:3a27 Size:256 Owner:0x16ba +Seg:393a Size:256 Owner:0x16b8 ++++ -Seg:3b27 Size:256 Owner:0x16bc +Seg:3a3a Size:256 Owner:0x16ba ++++ -Seg:3c27 Size:256 Owner:0x16be +Seg:3b3a Size:256 Owner:0x16bc ++++ -Seg:3d27 Size:256 Owner:0x16c0 +Seg:3c3a Size:256 Owner:0x16be ++++ -Seg:3e27 Size:256 Owner:0x16c2 +Seg:3d3a Size:256 Owner:0x16c0 +++++ -Seg:3f27 Size:256 Owner:0x16c4 +Seg:3e3a Size:256 Owner:0x16c2 ++++ -Seg:4027 Size:256 Owner:0x16c6 +Seg:3f3a Size:256 Owner:0x16c4 ++++ -Seg:4127 Size:256 Owner:0x16c8 +Seg:403a Size:256 Owner:0x16c6 ++++ -Seg:4227 Size:256 Owner:0x16ca +Seg:413a Size:256 Owner:0x16c8 ++++ -Seg:4327 Size:256 Owner:0x16cc +Seg:423a Size:256 Owner:0x16ca +++++ -Seg:4427 Size:256 Owner:0x16ce +Seg:433a Size:256 Owner:0x16cc ++++ -Seg:4527 Size:256 Owner:0x16d0 +Seg:443a Size:256 Owner:0x16ce ++++ -Seg:4627 Size:256 Owner:0x16d2 +Seg:453a Size:256 Owner:0x16d0 ++++ -Seg:4727 Size:256 Owner:0x16d4 +Seg:463a Size:256 Owner:0x16d2 ++++ -Seg:4827 Size:256 Owner:0x16d6 +Seg:473a Size:256 Owner:0x16d4 +++++ -Seg:4927 Size:256 Owner:0x16d8 +Seg:483a Size:256 Owner:0x16d6 ++++ -Seg:4a27 Size:256 Owner:0x16da +Seg:493a Size:256 Owner:0x16d8 ++++ -Seg:4b27 Size:256 Owner:0x16dc +Seg:4a3a Size:256 Owner:0x16da ++++ -Seg:4c27 Size:256 Owner:0x16de +Seg:4b3a Size:256 Owner:0x16dc ++++ -Seg:4d27 Size:256 Owner:0x16e0 +Seg:4c3a Size:256 Owner:0x16de +++++ -Seg:4e27 Size:256 Owner:0x16e2 +Seg:4d3a Size:256 Owner:0x16e0 ++++ -Seg:4f27 Size:256 Owner:0x16e4 +Seg:4e3a Size:256 Owner:0x16e2 ++++ -Seg:5027 Size:256 Owner:0x16e6 +Seg:4f3a Size:256 Owner:0x16e4 ++++ -Seg:5127 Size:256 Owner:0x16e8 +Seg:503a Size:256 Owner:0x16e6 ++++ -Seg:5227 Size:256 Owner:0x16ea +Seg:513a Size:256 Owner:0x16e8 +++++ -Seg:5327 Size:256 Owner:0x16ec +Seg:523a Size:256 Owner:0x16ea ++++ -Seg:5427 Size:256 Owner:0x16ee +Seg:533a Size:256 Owner:0x16ec ++++ -Seg:5527 Size:256 Owner:0x16f0 +Seg:543a Size:256 Owner:0x16ee ++++ -Seg:5627 Size:256 Owner:0x16f2 +Seg:553a Size:256 Owner:0x16f0 ++++ -Seg:5727 Size:256 Owner:0x16f4 +Seg:563a Size:256 Owner:0x16f2 +++++ -Seg:5827 Size:256 Owner:0x16f6 +Seg:573a Size:256 Owner:0x16f4 ++++ -Seg:5927 Size:256 Owner:0x16f8 +Seg:583a Size:256 Owner:0x16f6 ++++ -Seg:5a27 Size:256 Owner:0x16fa +Seg:593a Size:256 Owner:0x16f8 ++++ -Seg:5b27 Size:256 Owner:0x16fc +Seg:5a3a Size:256 Owner:0x16fa ++++ -Seg:5c27 Size:256 Owner:0x16fe +Seg:5b3a Size:256 Owner:0x16fc +++++ -Seg:5d27 Size:256 Owner:0x1700 +Seg:5c3a Size:256 Owner:0x16fe ++++ -Seg:5e27 Size:256 Owner:0x1702 +Seg:5d3a Size:256 Owner:0x1700 ++++ -Seg:5f27 Size:256 Owner:0x1704 +Seg:5e3a Size:256 Owner:0x1702 ++++ -Seg:6027 Size:256 Owner:0x1706 +Seg:5f3a Size:256 Owner:0x1704 ++++ -Seg:6127 Size:256 Owner:0x1708 +Seg:603a Size:256 Owner:0x1706 +++++ -Seg:6227 Size:256 Owner:0x170a +Seg:613a Size:256 Owner:0x1708 ++++ -Seg:6327 Size:256 Owner:0x170c +Seg:623a Size:256 Owner:0x170a ++++ -Seg:6427 Size:256 Owner:0x170e +Seg:633a Size:256 Owner:0x170c ++++ -Seg:6527 Size:256 Owner:0x1710 +Seg:643a Size:256 Owner:0x170e ++++ -Seg:6627 Size:256 Owner:0x1712 +Seg:653a Size:256 Owner:0x1710 +++++ -Seg:6727 Size:256 Owner:0x1714 +Seg:663a Size:256 Owner:0x1712 ++++ -Seg:6827 Size:256 Owner:0x1716 +Seg:673a Size:256 Owner:0x1714 ++++ -Seg:6927 Size:256 Owner:0x1718 +Seg:683a Size:256 Owner:0x1716 ++++ -Seg:6a27 Size:256 Owner:0x171a +Seg:693a Size:256 Owner:0x1718 ++++ -Seg:6b27 Size:256 Owner:0x171c +Seg:6a3a Size:256 Owner:0x171a +++++ -Seg:6c27 Size:256 Owner:0x171e +Seg:6b3a Size:256 Owner:0x171c ++++ -Seg:6d27 Size:256 Owner:0x1720 +Seg:6c3a Size:256 Owner:0x171e ++++ -Seg:6e27 Size:256 Owner:0x1722 +Seg:6d3a Size:256 Owner:0x1720 ++++ -Seg:6f27 Size:256 Owner:0x1724 +Seg:6e3a Size:256 Owner:0x1722 ++++ -Seg:7027 Size:256 Owner:0x1726 +Seg:6f3a Size:256 Owner:0x1724 +++++ -Seg:7127 Size:256 Owner:0x1728 +Seg:703a Size:256 Owner:0x1726 ++++ -Seg:7227 Size:256 Owner:0x172a +Seg:713a Size:256 Owner:0x1728 ++++ -Seg:7327 Size:256 Owner:0x172c +Seg:723a Size:256 Owner:0x172a ++++ -Seg:7427 Size:256 Owner:0x172e +Seg:733a Size:256 Owner:0x172c ++++ -Seg:7527 Size:256 Owner:0x1730 +Seg:743a Size:256 Owner:0x172e +++++ -Seg:7627 Size:256 Owner:0x1732 +Seg:753a Size:256 Owner:0x1730 ++++ -Seg:7727 Size:256 Owner:0x1734 +Seg:763a Size:256 Owner:0x1732 ++++ -Seg:7827 Size:256 Owner:0x1736 +Seg:773a Size:256 Owner:0x1734 ++++ -Seg:7927 Size:256 Owner:0x1738 +Seg:783a Size:256 Owner:0x1736 ++++ -Seg:7a27 Size:256 Owner:0x173a +Seg:793a Size:256 Owner:0x1738 +++++ -Seg:7b27 Size:256 Owner:0x173c +Seg:7a3a Size:256 Owner:0x173a ++++ -Seg:7c27 Size:256 Owner:0x173e +Seg:7b3a Size:256 Owner:0x173c ++++ -Seg:7d27 Size:256 Owner:0x1740 +Seg:7c3a Size:256 Owner:0x173e ++++ -Seg:7e27 Size:256 Owner:0x1742 +Seg:7d3a Size:256 Owner:0x1740 ++++ -Seg:7f27 Size:256 Owner:0x1744 +Seg:7e3a Size:256 Owner:0x1742 +++++ -Seg:8027 Size:256 Owner:0x1746 +Seg:7f3a Size:256 Owner:0x1744 ++++ -Seg:8127 Size:256 Owner:0x1748 +Seg:803a Size:256 Owner:0x1746 ++++ -Seg:8227 Size:256 Owner:0x174a +Seg:813a Size:256 Owner:0x1748 ++++ -Seg:8327 Size:256 Owner:0x174c +Seg:823a Size:256 Owner:0x174a ++++ -Seg:8427 Size:256 Owner:0x174e +Seg:833a Size:256 Owner:0x174c +++++ -Seg:8527 Size:256 Owner:0x1750 +Seg:843a Size:256 Owner:0x174e ++++ -Seg:8627 Size:256 Owner:0x1752 +Seg:853a Size:256 Owner:0x1750 ++++ -Seg:8727 Size:256 Owner:0x1754 +Seg:863a Size:256 Owner:0x1752 ++++ -Seg:8827 Size:256 Owner:0x1756 +Seg:873a Size:256 Owner:0x1754 ++++ -Seg:8927 Size:256 Owner:0x1758 +Seg:883a Size:256 Owner:0x1756 +++++ -Seg:8a27 Size:256 Owner:0x175a +Seg:893a Size:256 Owner:0x1758 ++++ -Seg:8b27 Size:256 Owner:0x175c +Seg:8a3a Size:256 Owner:0x175a ++++ -Seg:8c27 Size:273 Owner:0xe400 -++++ -Seg:b827 Size:18392 Owner:0x0 +Seg:8b3a Size:256 Owner:0x175c +++++ +Seg:8c3a Size:273 Owner:0xe400 ++++++ +Seg:b83a Size:18373 Owner:0x0 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ \ No newline at end of file diff --git a/HEAP.16W b/HEAP.16W index bbcc2ad3..1c82fec5 100755 --- a/HEAP.16W +++ b/HEAP.16W @@ -1,35 +1,35 @@ == default == - 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 + USED block at 28300016 of size 66 + USED block at 28300058 of size 66 + FREE block at 2830009a of size 18 + USED block at 283000ac of size 136 + USED block at 28300134 of size 20 + FREE block at 28300148 of size 7860 OK - end of heap == near == - 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 + USED block at 182fe436 of size 12 + USED block at 182fe442 of size 332 + USED block at 182fe58e of size 52 + USED block at 182fe5c2 of size 20 + USED block at 182fe5d6 of size 20 + USED block at 182fe5ea of size 20 + USED block at 182fe5fe of size 20 + USED block at 182fe612 of size 20 + USED block at 182fe626 of size 6614 OK - end of heap == far == - 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 + USED block at 28300016 of size 66 + USED block at 28300058 of size 66 + USED block at 2830009a of size 18 + USED block at 283000ac of size 136 + USED block at 28300134 of size 20 + USED block at 28300148 of size 7860 OK - end of heap Memory Type Total Used Free diff --git a/src/lib/16_head.h b/src/lib/16_head.h index aab4c033..2d080d52 100755 --- a/src/lib/16_head.h +++ b/src/lib/16_head.h @@ -152,7 +152,7 @@ static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ extern int profilehandle,debughandle; //make it into game global #define __DEBUG__ -//#define __DEBUG_PM__ +#define __DEBUG_PM__ //#define __DEBUG_MM__ #define nil ((void *)0) diff --git a/src/lib/16_pm.c b/src/lib/16_pm.c index c7488a2a..3b19c0ae 100755 --- a/src/lib/16_pm.c +++ b/src/lib/16_pm.c @@ -356,15 +356,9 @@ PML_StartupXMS(global_game_variables_t *gvar) { //#define STARTUPXMSASM byte err; -#ifndef STARTUPXMSASM -#define XMSAVI gvar->pm.xmm.XMSAvail -#define XMSHAN gvar->pm.xmm.XMSHandle -#else - #define BRACKETXMS word XMSAvail, XMSHandle; #define XMSAVI XMSAvail #define XMSHAN XMSHandle -#endif //++++ word XMSVer; boolean errorflag=false; word e=0; @@ -389,14 +383,10 @@ PML_StartupXMS(global_game_variables_t *gvar) #ifdef STARTUPXMSASM mov ah,XMS_QUERYFREE // Find out how much XMS is available - call [DWORD PTR XMSDriver]//DWORD PTR -#ifndef BRACKETXMS + call [DWORD PTR XMSDriver] mov XMSAVI,ax -#else - mov [XMSAVI],ax -#endif - or ax,ax // AJR: bugfix 10/8/92 - jz error1 + cmp bl,0xa0 // AJR: bugfix 10/8/92 + je error1 mov e,3 #endif jmp End1 @@ -421,7 +411,7 @@ End1: #ifndef STARTUPXMSASM XMS_CALL(XMS_QUERYFREE); // Find out how much XMS is available XMSAVI = _AX; - if (!_AX) // AJR: bugfix 10/8/92 + if (_BL) // AJR: bugfix 10/8/92 { errorflag = true; err = _BL; @@ -432,7 +422,8 @@ End1: #ifdef __DEBUG_PM__ //++++ printf("XMSVer=%02X ", XMSVer); - printf("XMSAvail=%u\n", XMSAVI); + printf("XMSAvail=%u\n", (XMSAVI)); + getch(); #endif XMSAVI &= ~(PMPageSizeKB - 1); // Round off to nearest page size if (XMSAVI < (PMPageSizeKB * 2)) // Need at least 2 pages @@ -442,20 +433,16 @@ End1: } #ifdef STARTUPXMSASM __asm { -#ifndef BRACKETXMS mov dx,XMSAVI -#else - mov dx,[XMSAVI] -#endif mov ah,XMS_ALLOC // And do the allocation - call [DWORD PTR XMSDriver]//DWORD PTR + call [DWORD PTR XMSDriver] #ifndef BRACKETXMS mov XMSHAN,dx #else mov [XMSHAN],dx #endif - or ax,ax // AJR: bugfix 10/8/92 - jz error2 + cmp ax,0 // AJR: bugfix 10/8/92 + je error2 mov e,4 jmp End2 #ifdef __BORLANDC__ @@ -490,11 +477,9 @@ End2: error: if(errorflag==false) { - gvar->mmi.XMSmem = (dword)(XMSAVI) * 1024; -#ifdef STARTUPXMSASM - gvar->pm.xmm.XMSAvail = XMSAVI; + gvar->mmi.XMSmem = (XMSAVI) * 1024ul; + gvar->pm.xmm.XMSAvail = (word)XMSAVI; gvar->pm.xmm.XMSHandle = XMSHAN; -#endif //++++ gvar->pm.xmm.XMSVer = XMSVer; gvar->pm.xmm.XMSPresent = true; #ifdef __DEBUG_PM__ @@ -508,7 +493,10 @@ error: //printf(" 1=%u 2=%u 3=%u 4=%u\n", XMSHandle1, XMSHandle2, XMSHandle3, XMSHandle4); //printf(" 2=%u ", XMSHandle); //printf(" %u", gvar->pm.xmm.XMSHandle); - printf("err=%02X e=%u\n", err, e); + printf("XMSerr\n"); + printf(" %u, %lu\n", (word)XMSAVI, (dword)XMSAVI); + printf(" err=%02X e=%u\n", err, e); + getch(); #endif } return(gvar->pm.xmm.XMSPresent); diff --git a/src/lib/typdefst.h b/src/lib/typdefst.h index 6c5ca4e3..41c6b069 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -257,7 +257,7 @@ typedef struct typedef struct { boolean XMSPresent; - word XMSAvail,XMSPagesAvail,XMSHandle;//++++,XMSVer; + word XMSAvail,XMSPagesAvail,XMSHandle;//++++,XMSVer; dword XMSDriver; int XMSProtectPage;// = -1; } pm_xmmi_t; -- 2.39.5