From: sparky4 Date: Sun, 4 Sep 2016 01:26:49 +0000 (-0500) Subject: ^^ yay! i polished exmmtest and the memory reporter X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=fe893e7cb209b6a69b67d662f85953a28dacf24e;p=16.git ^^ yay! i polished exmmtest and the memory reporter --- diff --git a/DEBUG.16W b/DEBUG.16W index 2b5d8553..e5d8c2f6 100755 --- a/DEBUG.16W +++ b/DEBUG.16W @@ -1,17 +1,17 @@ -Seg:0 Size:9878 Owner:0x0 -++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++_ +Seg:0 Size:7705 Owner:0x0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++_ 0 -Seg:2696 Size:256 Owner:0x47b4 +Seg:1e19 Size:256 Owner:0x527c ++++_  -Seg:2796 Size:273 Owner:0x92cc -+++++_ +Seg:1f19 Size:273 Owner:0x92d4 +++++_  -Seg:2d25 Size:40 Owner:0x0 +Seg:24a8 Size:40 Owner:0x0 +_ -000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -Seg:bd4d Size:8883 Owner:0x0 -++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++_ +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +Seg:b4d0 Size:11056 Owner:0x0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++_  Seg:e000 Size:8191 Owner:0x0 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++_ \ No newline at end of file diff --git a/HEAP.16W b/HEAP.16W index 030058f7..5abdbe31 100755 --- a/HEAP.16W +++ b/HEAP.16W @@ -1,71 +1,45 @@ == default == - FREE block at 2b0b0016 of size 18 - USED block at 2b0b0028 of size 136 - USED block at 2b0b00b0 of size 50 - USED block at 2b0b00e2 of size 50 - USED block at 2b0b0114 of size 50 - USED block at 2b0b0146 of size 50 - USED block at 2b0b0178 of size 50 - USED block at 2b0b01aa of size 50 - USED block at 2b0b01dc of size 50 - USED block at 2b0b020e of size 50 - USED block at 2b0b0240 of size 50 - USED block at 2b0b0272 of size 50 - USED block at 2b0b02a4 of size 50 - USED block at 2b0b02d6 of size 50 - USED block at 2b0b0308 of size 50 - FREE block at 2b0b033a of size 14 - USED block at 2b0b0348 of size 20 - FREE block at 2b0b035c of size 7328 + USED block at 24ca0016 of size 66 + FREE block at 24ca0058 of size 18 + USED block at 24ca006a of size 136 + USED block at 24ca00f2 of size 20 + FREE block at 24ca0106 of size 7926 OK - end of heap == near == - USED block at 1b0aa346 of size 12 - USED block at 1b0aa352 of size 326 - USED block at 1b0aa498 of size 52 - USED block at 1b0aa4cc of size 20 - USED block at 1b0aa4e0 of size 20 - USED block at 1b0aa4f4 of size 20 - USED block at 1b0aa508 of size 20 - USED block at 1b0aa51c of size 20 - USED block at 1b0aa530 of size 23244 + USED block at 14c99306 of size 12 + USED block at 14c99312 of size 328 + USED block at 14c9945a of size 52 + USED block at 14c9948e of size 20 + USED block at 14c994a2 of size 20 + USED block at 14c994b6 of size 20 + USED block at 14c994ca of size 20 + USED block at 14c994de of size 20 + USED block at 14c994f2 of size 27402 OK - end of heap == far == - USED block at 2b0b0016 of size 18 - USED block at 2b0b0028 of size 136 - USED block at 2b0b00b0 of size 50 - USED block at 2b0b00e2 of size 50 - USED block at 2b0b0114 of size 50 - USED block at 2b0b0146 of size 50 - USED block at 2b0b0178 of size 50 - USED block at 2b0b01aa of size 50 - USED block at 2b0b01dc of size 50 - USED block at 2b0b020e of size 50 - USED block at 2b0b0240 of size 50 - USED block at 2b0b0272 of size 50 - USED block at 2b0b02a4 of size 50 - USED block at 2b0b02d6 of size 50 - USED block at 2b0b0308 of size 50 - USED block at 2b0b033a of size 14 - USED block at 2b0b0348 of size 20 - USED block at 2b0b035c of size 7328 + USED block at 24ca0016 of size 66 + USED block at 24ca0058 of size 18 + USED block at 24ca006a of size 136 + USED block at 24ca00f2 of size 20 + USED block at 24ca0106 of size 7926 OK - end of heap Memory Type Total Used Free ---------------- -------- -------- -------- -Default 8166 806 7360 -Near 23734 490 23244 -Far 8166 806 7360 +Default 8166 222 7944 +Near 27894 492 27402 +Far 8166 222 7944 ---------------- -------- -------- -------- -coreleft = 23242 -farcoreleft = 38624 -GetFreeSize = 15402 -GetNearFreeSize = 23244 -GetFarFreeSize = 15402 -memavl = 23242 -stackavail = 11767 +coreleft = 27400 +farcoreleft = 2422 +GetFreeSize = 40578 +GetNearFreeSize = 27402 +GetFarFreeSize = 40578 +memavl = 27400 +stackavail = 11848 diff --git a/PROFILE.16B b/MEMINFO.16W similarity index 100% rename from PROFILE.16B rename to MEMINFO.16W diff --git a/MMDUMP.16W b/MMDUMP.16W index 28faf5bb..a8b4d9e7 100755 Binary files a/MMDUMP.16W and b/MMDUMP.16W differ diff --git a/PROFILE.16W b/PROFILE.16W deleted file mode 100755 index e69de29b..00000000 diff --git a/src/exmmtest.c b/src/exmmtest.c index d1db67c6..d7eee8de 100755 --- a/src/exmmtest.c +++ b/src/exmmtest.c @@ -22,9 +22,6 @@ /* exmm test */ -//#include -//#include - #include "src/lib/16_head.h" #include "src/lib/16_ca.h" #include "src/lib/16_mm.h" @@ -39,11 +36,12 @@ #define FILERL //#define FILEREAD -global_game_variables_t gvar; +#define PRINTBB { printf("&main()= %Fp\n", argv[0]);printf("bigbuffer= %Fp\n", bigbuffer);printf("&bigbuffer= %Fp\n", &bigbuffer);printf("bigbuffer= %04x\n", bigbuffer);printf("&bigbuffer= %04x\n", &bigbuffer); } void main(int argc, char *argv[]) { + global_game_variables_t gvar; #ifdef __WATCOMC__ __segment sega; void __based(sega)* bigbuffer; @@ -60,25 +58,17 @@ main(int argc, char *argv[]) #ifdef __BORLANDC__ argc=argc; #endif - //printf("&main()= %Fp\n", *argv[0]); - //printf("bigbuffer= %Fp\n", bigbuffer); - //printf("&bigbuffer= %Fp\n", &bigbuffer); - //printf("bigbuffer= %04x\n", bigbuffer); - //printf("&bigbuffer= %04x\n", &bigbuffer); - #ifdef FILERL bakapee = malloc(64); #endif gvar.mm.mmstarted=0; + //PRINTBB #ifdef FILERL if(argv[1]) bakapee = argv[1]; else - { - printf("filename!: "); - scanf("%[^\n]", &bakapee); - } -// bakapee = "data/koishi~.pcx"; + //{ printf("filename!: "); scanf("%[^\n]", &bakapee); } + bakapee = "data/koishi~.pcx"; #endif // printf("main()=%Fp start MM\n", *argv[0]); @@ -87,11 +77,7 @@ main(int argc, char *argv[]) //PM_UnlockMainMem(); CA_Startup(&gvar); // printf(" done!\n"); - //printf("&main()= %Fp\n", *argv[0]); - //printf("bigbuffer= %Fp\n", bigbuffer); - //printf("&bigbuffer= %Fp\n", &bigbuffer); - //printf("bigbuffer= %04x\n", bigbuffer); - //printf("&bigbuffer= %04x\n", &bigbuffer); + //PRINTBB // getch(); #ifdef FILERL // bakapeehandle = open(bakapee,O_RDONLY | O_BINARY, S_IREAD); @@ -110,25 +96,23 @@ main(int argc, char *argv[]) // close(bakapeehandle); //hmm functions in cache system use the buffered stuff #ifdef __WATCOMC__ - printf("size of big buffer~=%u\n", _bmsize(sega, bigbuffer)); + printf("\nsize of big buffer~=%u\n", _bmsize(sega, bigbuffer)); #endif #endif printf("press any key to continue!\n"); getch(); - printf("[\n%s\n]\n", bigbuffer); + printf("\n\ncontents of the buffer\n[\n%s\n]\n", bigbuffer); //printf("dark purple = purgable\n"); //printf("medium blue = non purgable\n"); //printf("red = locked\n"); printf("press any key to continue!\n"); getch(); - //++++modexEnter(); - //++++modexShowPage(&screen); MM_ShowMemory(&gvar, &gvar.mm); //getch(); MM_DumpData(&gvar.mm); - //++++modexLeave(); - //++++MM_Report(&gvar.mm, &gvar.mmi); + MM_Report(&gvar); // printf(" stop!\n"); + getch(); #ifdef FILERL MM_FreePtr(&bigbuffer, &gvar.mm); #endif @@ -148,21 +132,23 @@ main(int argc, char *argv[]) printf("&near= %Fp ", &(gvar.mm.nearheap)); printf("&far= %Fp", &(gvar.mm.farheap)); printf("\n"); +#ifdef EXMMVERBOSE printf("bigb= %Fp ", bigbuffer); //printf("bigbr= %04x", bigbuffer); //printf("\n"); printf("&bigb=%Fp ", &bigbuffer); //printf("&bigb=%04x", &bigbuffer); printf("\n"); +#endif printf("========================================\n"); #ifdef __WATCOMC__ - printf("Total free: %lu\n", (dword)(GetFreeSize())); +//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())); heapdump(&gvar); + #endif printf("Project 16 emmtest.exe. This is just a test file!\n"); printf("version %s\n", VERSION); -#endif //printf("core left: %lu\n", (dword)_coreleft()); //printf("far core left: %lu\n", (dword)_farcoreleft()); //printf("based core left: %lu\n", (dword)_basedcoreleft()); diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index 8f86cb2a..35644b35 100755 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -1125,6 +1125,15 @@ void CA_Startup(global_game_variables_t *gvar) unlink("profile.16w"); gvar->handle.profilehandle = open("profile.16w", O_CREAT | O_WRONLY | O_TEXT); #endif +#endif//profile + +#ifdef __BORLANDC__ + unlink("meminfo.16b"); + gvar->handle.showmemhandle = open("meminfo.16b", O_CREAT | O_WRONLY | O_TEXT); +#endif +#ifdef __WATCOMC__ + unlink("meminfo.16w"); + gvar->handle.showmemhandle = open("meminfo.16w", O_CREAT | O_WRONLY | O_TEXT); #endif /* CAL_SetupMapFile (); CAL_SetupGrFile (); @@ -1190,7 +1199,7 @@ void CA_Shutdown(global_game_variables_t *gvar) #ifdef PROFILE close(gvar->handle.profilehandle); #endif -// close(gvar->handle.showmemhandle); + close(gvar->handle.showmemhandle); /*++++ close(maphandle); close(grhandle); diff --git a/src/lib/16_ca.h b/src/lib/16_ca.h index a193a645..54a125ae 100755 --- a/src/lib/16_ca.h +++ b/src/lib/16_ca.h @@ -37,7 +37,7 @@ //#define NUMMAPS 39 //#define MAPPLANES 3 -#define PROFILE +//++++#define PROFILE//++++ //=========================================================================== diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 7cf59d3d..84ca6f40 100755 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -1594,24 +1594,29 @@ dword MM_TotalFree(mminfo_t *mm) ===================== */ -void MM_Report(/*page_t *page, */mminfo_t *mm, mminfotype *mmi) +void MM_Report(global_game_variables_t *gvar) { + printf("========================================\n"); + printf(" MM_Report\n"); + printf("========================================\n"); if(MML_CheckForEMS()) { - printf("EMM v%x.%x available\n", mm->EMSVer>>4,mm->EMSVer&0x0F); - printf("totalEMSpages=%u\n", mm->totalEMSpages); - printf("freeEMSpages=%u\n", mm->freeEMSpages); - printf("EMSpageframe=%x\n", mm->EMSpageframe); + printf(" LIMEMS\n"); + printf(" EMM v%x.%x available\n", gvar->mm.EMSVer>>4,gvar->mm.EMSVer&0x0F); + printf(" totalEMSpages: %u ", gvar->mm.totalEMSpages); printf("freeEMSpages: %u\n", gvar->mm.freeEMSpages); + printf(" EMSpageframe: %x\n", gvar->mm.EMSpageframe); } - if(MML_CheckForXMS(mm)) printf("XMSaddr=%X\n", *XMSaddr); - printf("near=%lu\n", mmi->nearheap); - printf("far=%lu\n", mmi->farheap); - printf("EMSmem=%lu\n", mmi->EMSmem); - printf("XMSmem=%lu\n", mmi->XMSmem); - printf("mainmem=%lu\n", mmi->mainmem); - printf("UnusedMemory=%lu\n", MM_UnusedMemory(mm)); - printf("TotalFree=%lu\n", MM_TotalFree(mm)); - printf("TotalUsed=%lu\n", mmi->mainmem+mmi->EMSmem+mmi->XMSmem+mmi->XMSmem); + if(MML_CheckForXMS(&(gvar->mm))) + { + printf(" XMS\n"); + printf(" XMSaddr: %X\n", *XMSaddr); + } + printf("near: %lu ", gvar->mmi.nearheap); printf("far: %lu\n", gvar->mmi.farheap); if(MML_CheckForEMS()) + printf("EMSmem: %lu ", gvar->mmi.EMSmem); if(MML_CheckForXMS(&(gvar->mm))) printf("XMSmem: %lu", gvar->mmi.XMSmem); printf("\n"); + //printf("mainmem: %lu\n", gvar->mmi.mainmem); + printf("Total convmem: %lu ", gvar->mmi.mainmem); printf("TotalFree: %lu ", MM_TotalFree(&(gvar->mm))); printf("TotalUsed: %lu\n", gvar->mmi.mainmem+gvar->mmi.EMSmem+gvar->mmi.XMSmem+gvar->mmi.XMSmem); + printf(" UnusedMemory: %lu\n", MM_UnusedMemory(&(gvar->mm))); + //printf("========================================\n"); } //========================================================================== diff --git a/src/lib/16_mm.h b/src/lib/16_mm.h index 963eb3a4..3b1eac3d 100755 --- a/src/lib/16_mm.h +++ b/src/lib/16_mm.h @@ -196,7 +196,7 @@ void MM_ShowMemory(global_game_variables_t *gvar,/*page_t *page, */mminfo_t *mm) void MM_DumpData(mminfo_t *mm); dword MM_UnusedMemory(mminfo_t *mm); dword MM_TotalFree(mminfo_t *mm); -void MM_Report(/*page_t *page, */mminfo_t *mm, mminfotype *mmi); +void MM_Report(global_game_variables_t *gvar); static void MM_EMSerr(byte *stri, byte err); void MM_BombOnError(boolean bomb, mminfo_t *mm); //void MM_GetNewBlock(mminfo_t *mm); diff --git a/src/lib/typdefst.h b/src/lib/typdefst.h index 9a2f3320..86379ed8 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -100,8 +100,7 @@ typedef struct typedef struct { -// int showmemhandle; - int profilehandle,debughandle; + int profilehandle,debughandle,showmemhandle; int heaphandle; } handle_t; @@ -188,8 +187,8 @@ typedef struct { byte ca_levelbit,ca_levelnum; int mapon; - _seg *grsegs[NUMCHUNKS]; - byte far grneeded[NUMCHUNKS]; + //_seg *grsegs[NUMCHUNKS]; + //byte far grneeded[NUMCHUNKS]; //huffnode huffnode; } ca_t;