]> 4ch.mooo.com Git - 16.git/commitdiff
^^ yay! i polished exmmtest and the memory reporter
authorsparky4 <sparky4@cock.li>
Sun, 4 Sep 2016 01:26:49 +0000 (20:26 -0500)
committersparky4 <sparky4@cock.li>
Sun, 4 Sep 2016 01:26:49 +0000 (20:26 -0500)
DEBUG.16W
HEAP.16W
MEMINFO.16W [moved from PROFILE.16B with 100% similarity]
MMDUMP.16W
PROFILE.16W [deleted file]
src/exmmtest.c
src/lib/16_ca.c
src/lib/16_ca.h
src/lib/16_mm.c
src/lib/16_mm.h
src/lib/typdefst.h

index 2b5d8553e1143f382c1b7dd5c81b11958eedb7d6..e5d8c2f69f459ce3971e726112d4f3c8d841f771 100755 (executable)
--- a/DEBUG.16W
+++ b/DEBUG.16W
@@ -1,17 +1,17 @@
-\e[0mSeg:0      Size:9878       Owner:0x0\r
-\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[47;37m_\e[0m\r
+\e[0mSeg:0      Size:7705       Owner:0x0\r
+\e[41;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[47;37m_\e[0m\r
 \e[42;32m0\r
-\e[0m\e[0mSeg:2696       Size:256        Owner:0x47b4\r
+\e[0m\e[0mSeg:1e19       Size:256        Owner:0x527c\r
 \e[44;34m++++\e[0m\e[47;37m_\e[0m\r
 \e[42;32m\r
-\e[0m\e[0mSeg:2796       Size:273        Owner:0x92cc\r
-\e[44;34m+++++\e[0m\e[47;37m_\e[0m\r
+\e[0m\e[0mSeg:1f19       Size:273        Owner:0x92d4\r
+\e[44;34m++++\e[0m\e[47;37m_\e[0m\r
 \e[42;32m\r
-\e[0m\e[0mSeg:2d25       Size:40 Owner:0x0\r
+\e[0m\e[0mSeg:24a8       Size:40 Owner:0x0\r
 \e[41;31m+\e[0m\e[47;37m_\e[0m\r
-\e[42;32m000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\r
-\e[0m\e[0mSeg:bd4d       Size:8883       Owner:0x0\r
-\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[47;37m_\e[0m\r
+\e[42;32m000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\r
+\e[0m\e[0mSeg:b4d0       Size:11056      Owner:0x0\r
+\e[41;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[47;37m_\e[0m\r
 \e[42;32m\r
 \e[0m\e[0mSeg:e000       Size:8191       Owner:0x0\r
 \e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[47;37m_\e[0m
\ No newline at end of file
index 030058f7567ebe79354d76b51de4c0a057a68c97..5abdbe31187005dcffe00577e2dcad3890480434 100755 (executable)
--- a/HEAP.16W
+++ b/HEAP.16W
@@ -1,71 +1,45 @@
 \r
        == default ==\r
 \r
-  FREE block at 2b0b0016 of size 18\r
-  USED block at 2b0b0028 of size 136\r
-  USED block at 2b0b00b0 of size 50\r
-  USED block at 2b0b00e2 of size 50\r
-  USED block at 2b0b0114 of size 50\r
-  USED block at 2b0b0146 of size 50\r
-  USED block at 2b0b0178 of size 50\r
-  USED block at 2b0b01aa of size 50\r
-  USED block at 2b0b01dc of size 50\r
-  USED block at 2b0b020e of size 50\r
-  USED block at 2b0b0240 of size 50\r
-  USED block at 2b0b0272 of size 50\r
-  USED block at 2b0b02a4 of size 50\r
-  USED block at 2b0b02d6 of size 50\r
-  USED block at 2b0b0308 of size 50\r
-  FREE block at 2b0b033a of size 14\r
-  USED block at 2b0b0348 of size 20\r
-  FREE block at 2b0b035c of size 7328\r
+  USED block at 24ca0016 of size 66\r
+  FREE block at 24ca0058 of size 18\r
+  USED block at 24ca006a of size 136\r
+  USED block at 24ca00f2 of size 20\r
+  FREE block at 24ca0106 of size 7926\r
 OK - end of heap\r
 \r
        == near ==\r
 \r
-  USED block at 1b0aa346 of size 12\r
-  USED block at 1b0aa352 of size 326\r
-  USED block at 1b0aa498 of size 52\r
-  USED block at 1b0aa4cc of size 20\r
-  USED block at 1b0aa4e0 of size 20\r
-  USED block at 1b0aa4f4 of size 20\r
-  USED block at 1b0aa508 of size 20\r
-  USED block at 1b0aa51c of size 20\r
-  USED block at 1b0aa530 of size 23244\r
+  USED block at 14c99306 of size 12\r
+  USED block at 14c99312 of size 328\r
+  USED block at 14c9945a of size 52\r
+  USED block at 14c9948e of size 20\r
+  USED block at 14c994a2 of size 20\r
+  USED block at 14c994b6 of size 20\r
+  USED block at 14c994ca of size 20\r
+  USED block at 14c994de of size 20\r
+  USED block at 14c994f2 of size 27402\r
 OK - end of heap\r
 \r
        == far ==\r
 \r
-  USED block at 2b0b0016 of size 18\r
-  USED block at 2b0b0028 of size 136\r
-  USED block at 2b0b00b0 of size 50\r
-  USED block at 2b0b00e2 of size 50\r
-  USED block at 2b0b0114 of size 50\r
-  USED block at 2b0b0146 of size 50\r
-  USED block at 2b0b0178 of size 50\r
-  USED block at 2b0b01aa of size 50\r
-  USED block at 2b0b01dc of size 50\r
-  USED block at 2b0b020e of size 50\r
-  USED block at 2b0b0240 of size 50\r
-  USED block at 2b0b0272 of size 50\r
-  USED block at 2b0b02a4 of size 50\r
-  USED block at 2b0b02d6 of size 50\r
-  USED block at 2b0b0308 of size 50\r
-  USED block at 2b0b033a of size 14\r
-  USED block at 2b0b0348 of size 20\r
-  USED block at 2b0b035c of size 7328\r
+  USED block at 24ca0016 of size 66\r
+  USED block at 24ca0058 of size 18\r
+  USED block at 24ca006a of size 136\r
+  USED block at 24ca00f2 of size 20\r
+  USED block at 24ca0106 of size 7926\r
 OK - end of heap\r
 \r
 Memory Type         Total      Used       Free\r
 ----------------  --------   --------   --------\r
-Default                   8166         806       7360\r
-Near              23734        490       23244\r
-Far               8166         806       7360\r
+Default                   8166         222       7944\r
+Near              27894        492       27402\r
+Far               8166         222       7944\r
 ----------------  --------   --------   --------\r
-coreleft = 23242\r
-farcoreleft = 38624\r
-GetFreeSize = 15402\r
-GetNearFreeSize = 23244\r
-GetFarFreeSize = 15402\r
-memavl = 23242\r
-stackavail = 11767\r
+coreleft = 27400\r
+farcoreleft = 2422\r
+GetFreeSize = 40578\r
+GetNearFreeSize = 27402\r
+GetFarFreeSize = 40578\r
+memavl = 27400\r
+stackavail = 11848\r
similarity index 100%
rename from PROFILE.16B
rename to MEMINFO.16W
index 28faf5bb94c9a0ae4220040873c6e02095d6117d..a8b4d9e746c2d2b729c25cddb21268cb77aac17f 100755 (executable)
Binary files a/MMDUMP.16W and b/MMDUMP.16W differ
diff --git a/PROFILE.16W b/PROFILE.16W
deleted file mode 100755 (executable)
index e69de29..0000000
index d1db67c611ba050c97f2a99191d84689e97bd403..d7eee8ded05e43947cfa344bbca94982862ec3d2 100755 (executable)
@@ -22,9 +22,6 @@
 /*\r
        exmm test\r
 */\r
-//#include <stdio.h>\r
-//#include <bios.h>\r
-\r
 #include "src/lib/16_head.h"\r
 #include "src/lib/16_ca.h"\r
 #include "src/lib/16_mm.h"\r
 #define FILERL\r
 //#define FILEREAD\r
 \r
-global_game_variables_t gvar;\r
+#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); }\r
 \r
 void\r
 main(int argc, char *argv[])\r
 {\r
+       global_game_variables_t gvar;\r
 #ifdef __WATCOMC__\r
        __segment sega;\r
        void __based(sega)* bigbuffer;\r
@@ -60,25 +58,17 @@ main(int argc, char *argv[])
 #ifdef __BORLANDC__\r
        argc=argc;\r
 #endif\r
-       //printf("&main()=      %Fp\n", *argv[0]);\r
-       //printf("bigbuffer=    %Fp\n", bigbuffer);\r
-       //printf("&bigbuffer=   %Fp\n", &bigbuffer);\r
-       //printf("bigbuffer=    %04x\n", bigbuffer);\r
-       //printf("&bigbuffer=   %04x\n", &bigbuffer);\r
-\r
 #ifdef FILERL\r
        bakapee = malloc(64);\r
 #endif\r
        gvar.mm.mmstarted=0;\r
 \r
+       //PRINTBB\r
 #ifdef FILERL\r
        if(argv[1]) bakapee = argv[1];\r
        else\r
-       {\r
-               printf("filename!: ");\r
-               scanf("%[^\n]", &bakapee);\r
-       }\r
-//     bakapee = "data/koishi~.pcx";\r
+       //{ printf("filename!: "); scanf("%[^\n]", &bakapee); }\r
+       bakapee = "data/koishi~.pcx";\r
 #endif\r
 \r
 //     printf("main()=%Fp      start MM\n", *argv[0]);\r
@@ -87,11 +77,7 @@ main(int argc, char *argv[])
        //PM_UnlockMainMem();\r
        CA_Startup(&gvar);\r
 //     printf("                done!\n");\r
-       //printf("&main()=      %Fp\n", *argv[0]);\r
-       //printf("bigbuffer=    %Fp\n", bigbuffer);\r
-       //printf("&bigbuffer=   %Fp\n", &bigbuffer);\r
-       //printf("bigbuffer=    %04x\n", bigbuffer);\r
-       //printf("&bigbuffer=   %04x\n", &bigbuffer);\r
+       //PRINTBB\r
 //     getch();\r
 #ifdef FILERL\r
 //     bakapeehandle = open(bakapee,O_RDONLY | O_BINARY, S_IREAD);\r
@@ -110,25 +96,23 @@ main(int argc, char *argv[])
 //     close(bakapeehandle);\r
        //hmm functions in cache system use the buffered stuff\r
 #ifdef __WATCOMC__\r
-       printf("size of big buffer~=%u\n", _bmsize(sega, bigbuffer));\r
+       printf("\nsize of big buffer~=%u\n", _bmsize(sega, bigbuffer));\r
 #endif\r
 #endif\r
        printf("press any key to continue!\n");\r
        getch();\r
-       printf("[\n%s\n]\n", bigbuffer);\r
+       printf("\n\ncontents of the buffer\n[\n%s\n]\n", bigbuffer);\r
        //printf("dark purple = purgable\n");\r
        //printf("medium blue = non purgable\n");\r
        //printf("red = locked\n");\r
        printf("press any key to continue!\n");\r
        getch();\r
-       //++++modexEnter();\r
-       //++++modexShowPage(&screen);\r
        MM_ShowMemory(&gvar, &gvar.mm);\r
        //getch();\r
        MM_DumpData(&gvar.mm);\r
-       //++++modexLeave();\r
-       //++++MM_Report(&gvar.mm, &gvar.mmi);\r
+       MM_Report(&gvar);\r
 //     printf("                stop!\n");\r
+       getch();\r
 #ifdef FILERL\r
        MM_FreePtr(&bigbuffer, &gvar.mm);\r
 #endif\r
@@ -148,21 +132,23 @@ main(int argc, char *argv[])
        printf("&near=  %Fp ", &(gvar.mm.nearheap));\r
        printf("&far=   %Fp", &(gvar.mm.farheap));\r
        printf("\n");\r
+#ifdef EXMMVERBOSE\r
        printf("bigb=   %Fp ", bigbuffer);\r
        //printf("bigbr=        %04x", bigbuffer);\r
        //printf("\n");\r
        printf("&bigb=%Fp ", &bigbuffer);\r
        //printf("&bigb=%04x", &bigbuffer);\r
        printf("\n");\r
+#endif\r
        printf("========================================\n");\r
 #ifdef __WATCOMC__\r
-       printf("Total free:                     %lu\n", (dword)(GetFreeSize()));\r
+//this is far  printf("Total free:                     %lu\n", (dword)(GetFreeSize()));\r
        printf("Total near free:                %lu\n", (dword)(GetNearFreeSize()));\r
        printf("Total far free:                 %lu\n", (dword)(GetFarFreeSize()));\r
        heapdump(&gvar);\r
+       #endif\r
        printf("Project 16 emmtest.exe. This is just a test file!\n");\r
        printf("version %s\n", VERSION);\r
-#endif\r
        //printf("core left:                    %lu\n", (dword)_coreleft());\r
        //printf("far core left:                        %lu\n", (dword)_farcoreleft());\r
        //printf("based core left:                      %lu\n", (dword)_basedcoreleft());\r
index 8f86cb2a871245a8e2814ee290d7036b28034f22..35644b35dbb233e9358f36e856722f8f0673c874 100755 (executable)
@@ -1125,6 +1125,15 @@ void CA_Startup(global_game_variables_t *gvar)
        unlink("profile.16w");\r
        gvar->handle.profilehandle = open("profile.16w", O_CREAT | O_WRONLY | O_TEXT);\r
 #endif\r
+#endif//profile\r
+\r
+#ifdef __BORLANDC__\r
+       unlink("meminfo.16b");\r
+       gvar->handle.showmemhandle = open("meminfo.16b", O_CREAT | O_WRONLY | O_TEXT);\r
+#endif\r
+#ifdef __WATCOMC__\r
+       unlink("meminfo.16w");\r
+       gvar->handle.showmemhandle = open("meminfo.16w", O_CREAT | O_WRONLY | O_TEXT);\r
 #endif\r
 /*     CAL_SetupMapFile ();\r
        CAL_SetupGrFile ();\r
@@ -1190,7 +1199,7 @@ void CA_Shutdown(global_game_variables_t *gvar)
 #ifdef PROFILE\r
        close(gvar->handle.profilehandle);\r
 #endif\r
-//     close(gvar->handle.showmemhandle);\r
+       close(gvar->handle.showmemhandle);\r
 /*++++\r
        close(maphandle);\r
        close(grhandle);\r
index a193a645775f5539a9f0b3e0d3a3984b2154d423..54a125ae0da512c74417a8f53a2d192b52fe81bb 100755 (executable)
@@ -37,7 +37,7 @@
 \r
 //#define NUMMAPS              39\r
 //#define MAPPLANES            3\r
-#define PROFILE\r
+//++++#define PROFILE//++++\r
 \r
 //===========================================================================\r
 \r
index 7cf59d3dfa3033db30a596e6c627ce33b3d2feb9..84ca6f40910a0d581e3587128ad9b9fc9c763ed8 100755 (executable)
@@ -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");
 }
 
 //==========================================================================
index 963eb3a45ef98129ccb46ea87890ca03cd5f5bfc..3b1eac3d5510c83d39ea53f6c64abaa4baabbb56 100755 (executable)
@@ -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);
index 9a2f332020ccf882ee737644ae68fcc1875b5814..86379ed8d156be97748dc3659a68720549edb9c3 100755 (executable)
@@ -100,8 +100,7 @@ typedef struct
 \r
 typedef struct\r
 {\r
-//     int showmemhandle;\r
-       int                     profilehandle,debughandle;\r
+       int                     profilehandle,debughandle,showmemhandle;\r
        int heaphandle;\r
 } handle_t;\r
 \r
@@ -188,8 +187,8 @@ typedef struct
 {\r
        byte            ca_levelbit,ca_levelnum;\r
        int             mapon;\r
-       _seg    *grsegs[NUMCHUNKS];\r
-       byte            far     grneeded[NUMCHUNKS];\r
+       //_seg  *grsegs[NUMCHUNKS];\r
+       //byte          far     grneeded[NUMCHUNKS];\r
        //huffnode huffnode;\r
 } ca_t;\r
 \r