]> 4ch.mooo.com Git - 16.git/commitdiff
ok!
authorsparky4 <sparky4@cock.li>
Sun, 19 Jul 2015 21:00:44 +0000 (16:00 -0500)
committersparky4 <sparky4@cock.li>
Sun, 19 Jul 2015 21:00:44 +0000 (16:00 -0500)
modified:   exmmtest.exe
modified:   miditest.exe
modified:   sountest.exe
modified:   src/exmmtest.c
modified:   src/lib/16_ca.c
modified:   src/lib/16_ca.h
modified:   src/lib/16_head.h
modified:   src/lib/16_mm.c
modified:   src/lib/16_mm.h
modified:   tsthimem.exe

exmmtest.exe
miditest.exe
sountest.exe
src/exmmtest.c
src/lib/16_ca.c
src/lib/16_ca.h
src/lib/16_head.h
src/lib/16_mm.c
src/lib/16_mm.h
tsthimem.exe

index dda4760f6a0e1c9b2d755ac26da235798a56c796..3aa742b3ce4ef6be1f8a6e11a6700f51cf63a65c 100644 (file)
Binary files a/exmmtest.exe and b/exmmtest.exe differ
index 1cf5b3dbed31e993c6f0e791168aa369afc203f2..4705605374cefef33945220a48703244836ac3ab 100644 (file)
Binary files a/miditest.exe and b/miditest.exe differ
index ac0c4bdecf0cb33fff3873e04db9f8f2f639582f..55721859d4b4494e33ca26a4feb9a5cad1e47546 100644 (file)
Binary files a/sountest.exe and b/sountest.exe differ
index 8cd440f558bc2a19146c380cd7f806983c662aac..b1663ffe7a04075e0c81a736b84d682e6a75e374 100644 (file)
@@ -60,9 +60,13 @@ main(int argc, char *argv[])
        //MM_GetPtr(&bigbuffer, mmi.nearheap, &mm, &mmi);
        //hmm functions in cache system use the buffered stuff
        printf("size of big buffer~=%u\n", _bmsize(segu, bigbuffer));
+       printf("dark purple = purgable\n");
+       printf("medium blue = non purgable\n");
+       printf("red = locked\n");
        getch();
        modexEnter();
        MM_ShowMemory(&screen, &mm);
+       MM_DumpData(&mm);
        getch();
        MM_Report(&screen, &mm, &mmi);
        modexLeave();
index df722daeaa8fecd97faba02ecc7bd34ea07d1e41..4ee50576d0a8ade086392ba5fbb2fcc475176dbb 100644 (file)
@@ -74,9 +74,9 @@ byte          _seg    *audiosegs[NUMSNDCHUNKS];
 void           _seg    *grsegs[NUMCHUNKS];\r
 \r
 byte           far     grneeded[NUMCHUNKS];\r
-byte           ca_levelbit,ca_levelnum;\r
+byte           ca_levelbit,ca_levelnum;*/\r
 \r
-int                    profilehandle,debughandle;*/\r
+int                    profilehandle,debughandle;\r
 \r
 void   (*drawcachebox)         (char *title, unsigned numcache);\r
 void   (*updatecachebox)       (void);\r
@@ -173,7 +173,6 @@ long GRFILEPOS(int c)
 =\r
 ============================\r
 */\r
-/*++++\r
 void CA_OpenDebug(void)\r
 {\r
        unlink("DEBUG.TXT");\r
@@ -182,8 +181,8 @@ void CA_OpenDebug(void)
 \r
 void CA_CloseDebug(void)\r
 {\r
-       close debughandle);\r
-}*/\r
+       close(debughandle);\r
+}\r
 \r
 \r
 \r
index b752bae52eb8d782bc8c403de284fad56f14e15b..29030c6a7ca7d796f5c792e4d60d5d33396d7cfa 100644 (file)
 #ifndef __16_CA__\r
 #define __16_CA__\r
 \r
-#include <unistd.h>\r
-#include <fcntl.h>\r
-#include <sys/stat.h>\r
-\r
 #ifndef __16_MM__\r
 #include "src/lib/16_head.h"\r
 #include "src/lib/16_mm.h"\r
@@ -65,9 +61,9 @@ extern        void            _seg    *grsegs[NUMCHUNKS];
 extern byte            far     grneeded[NUMCHUNKS];\r
 extern byte            ca_levelbit,ca_levelnum;\r
 \r
-extern char            *titleptr[8];\r
+extern char            *titleptr[8];*/\r
 \r
-extern int                     profilehandle,debughandle;*/\r
+extern int                     profilehandle,debughandle;\r
 \r
 //\r
 // hooks for custom cache dialogs\r
@@ -83,13 +79,14 @@ extern      void    (*finishcachebox)       (void);
 //void CAL_ShiftSprite (unsigned segment,unsigned source,unsigned dest,unsigned width, unsigned height, unsigned pixshift, boolean domask);\r
 \r
 //===========================================================================\r
-\r
+
 void CA_OpenDebug (void);\r
-void CA_CloseDebug (void);\r
+void CA_CloseDebug (void);
 boolean CA_FarRead (int handle, byte huge *dest, dword length, mminfo_t *mm);\r
-boolean CA_FarWrite (int handle, byte huge *source, dword length, mminfo_t *mm);\r
+boolean CA_FarWrite (int handle, byte huge *source, dword length, mminfo_t *mm);
+\r
 boolean CA_ReadFile (char *filename, memptr *ptr, mminfo_t *mm);\r
-boolean CA_LoadFile (char *filename, memptr *ptr, mminfo_t *mm, mminfotype *mmi);\r
+boolean CA_LoadFile (char *filename, memptr *ptr, mminfo_t *mm, mminfotype *mmi);
 \r
 //long CA_RLEWCompress (unsigned huge *source, long length, unsigned huge *dest,unsigned rlewtag);\r
 \r
index cb491f70accbd82097ab6863d0c54a5144a8aed9..18e0e4c038eefd519118df1f1774aee617be5116 100644 (file)
@@ -37,6 +37,9 @@
 #include <time.h> // just for wait
 #include <stdlib.h>
 #include <ctype.h>
+#include <unistd.h>\r
+#include <fcntl.h>\r
+#include <sys/stat.h>
 #include "src/lib/types.h"
 
 /* Control codes for all keys on the keyboard */
 
 static dword far* clockdw= (dword far*) 0x046C; /* 18.2hz clock */
 //static dword clockdw=0;
+extern int                     profilehandle,debughandle;
 
 #define        nil     ((void *)0)
 
@@ -153,4 +157,7 @@ long int filesize(FILE *fp);
 int US_CheckParm(char *parm,char **strings);
 //void Quit(char *error, ...);
 
+extern void CA_OpenDebug (void);\r
+extern void CA_CloseDebug (void);
+
 #endif/*_LIBHEAD_H_*/
index 9e980b670e39cb2b99bb34611de98606acf44e24..4d126499ae79e7798e5f44cf441b00b72a301005 100644 (file)
@@ -1087,7 +1087,7 @@ void MM_ShowMemory(page_t *page, mminfo_t *mm)
 
        end = -1;
 
-//CA_OpenDebug ();
+CA_OpenDebug ();
 
        chx=0;
        chy=0;
@@ -1102,20 +1102,22 @@ void MM_ShowMemory(page_t *page, mminfo_t *mm)
                        color = 12;             // red = locked
                if(scan->start<=end)
                {
-                       //printf("\nMM_ShowMemory: Memory block order currupted!\n");
-                       modexprint(&page, chx, chy, 1, 0, 24, "\nMM_ShowMemory: Memory block order currupted!\n");
+                       //printf(");
+                       write (debughandle,"\nMM_ShowMemory: Memory block order currupted!\n",strlen("\nMM_ShowMemory: Memory block order currupted!\n"));
+                       //modexprint(&page, chx, chy, 1, 0, 24, "\nMM_ShowMemory: Memory block order currupted!\n");
                        return;
                }
                end = scan->start+scan->length-1;
-//++++                         modexhlin(page, scan->start, (unsigned)end, chy, color);
+                               modexhlin(page, scan->start, (unsigned)end, chy, color);
 //++++         VW_Hlin(scan->start,(unsigned)end,0,color);
 //void VW_Plot(unsigned x, unsigned y, unsigned color);
 //void VW_Hlin(unsigned xl, unsigned xh, unsigned y, unsigned color);
 
 //++++         VW_Plot(scan->start,0,15);
-//++++                         modexputPixel(page, scan->start, chy, 15);
+                               modexputPixel(page, scan->start, chy, 15);
                if(scan->next->start > end+1)
 //++++                 VW_Hlin(end+1,scan->next->start,0,0);   // black = free
+                                       modexhlin(page, end+1,scan->next->start, chy, color);
 
 //****#if 0
 printf("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");    //bug!
@@ -1130,16 +1132,16 @@ owner = (unsigned)scan->useptr;
 ultoa (owner,str,16);
 strcat (scratch,str);
 strcat (scratch,"\n");
-//++++write (debughandle,scratch,strlen(scratch));
-modexprint(page, chx, chy, 1, 0, 24, &scratch);
-chy+=8;
-//fprintf(stdout, "%s", scratch);
+write (debughandle,scratch,strlen(scratch));
+//modexprint(page, chx, chy, 1, 0, 24, &scratch);
+//chy+=4;
+//fprintf(debughandle, "%s", scratch);
 //****#endif
 
                scan = scan->next;
        }
 
-//CA_CloseDebug ();
+CA_CloseDebug ();
 
 //++++mh       IN_Ack();
 //**** VW_SetLineWidth(64);
@@ -1147,6 +1149,72 @@ chy+=8;
 }
 //****#endif
 
+//==========================================================================\r
+\r
+/*\r
+=====================\r
+=\r
+= MM_DumpData\r
+=\r
+=====================\r
+*/\r
+\r
+void MM_DumpData(mminfo_t *mm)\r
+{\r
+       mmblocktype far *scan,far *best;\r
+       long    lowest,oldlowest;\r
+       unsigned        owner;\r
+       char    lock,purge;\r
+       FILE    *dumpfile;\r
+\r
+\r
+       free (mm->nearheap);\r
+       dumpfile = fopen ("mmdump.txt","w");\r
+       if (!dumpfile){\r
+               printf("MM_DumpData: Couldn't open MMDUMP.TXT!");
+               return;
+       }\r
+\r
+       lowest = -1;\r
+       do\r
+       {\r
+               oldlowest = lowest;\r
+               lowest = 0xffff;\r
+\r
+               scan = mm->mmhead;\r
+               while (scan)\r
+               {\r
+                       owner = (unsigned)scan->useptr;\r
+\r
+                       if (owner && owner<lowest && owner > oldlowest)\r
+                       {\r
+                               best = scan;\r
+                               lowest = owner;\r
+                       }\r
+\r
+                       scan = scan->next;\r
+               }\r
+\r
+               if (lowest != 0xffff)\r
+               {\r
+                       if (best->attributes & PURGEBITS)\r
+                               purge = 'P';\r
+                       else\r
+                               purge = '-';\r
+                       if (best->attributes & LOCKBIT)\r
+                               lock = 'L';\r
+                       else\r
+                               lock = '-';\r
+                       fprintf (dumpfile,"0x%p (%c%c) = %u\n"\r
+                       ,(unsigned)lowest,lock,purge,best->length);\r
+               }\r
+\r
+       } while (lowest != 0xffff);\r
+\r
+       fclose (dumpfile);\r
+       printf("MMDUMP.TXT created.");\r
+}
+
 //==========================================================================
 
 
index f7457aa5401dd287f0583dc8e7bc31bdf86f32c7..5ff492c4f8320df2056dfd6fd956474a0b807740 100644 (file)
@@ -26,6 +26,7 @@
 //#include <bios.h>
 #include "src/lib/16_head.h"
 #include "src/lib/modex16.h"
+//#include "src/lib/16_ca.h"
 //++++mh       #include "src/lib/16_in.h"
 
 #ifdef __DEBUG__               // 1 == Debug/Dev  ;  0 == Production/final
@@ -178,6 +179,7 @@ void MM_SetPurge(memptr *baseptr, int purge, mminfo_t *mm);
 void MM_SetLock(memptr *baseptr, boolean locked, mminfo_t *mm);
 void MM_SortMem(mminfo_t *mm);
 void MM_ShowMemory(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);
index f14444b0b06473f6aff35fb974c7ea62344ca3fd..14bb705265e3e3a5d4105875e1424194e1d8e6fc 100644 (file)
Binary files a/tsthimem.exe and b/tsthimem.exe differ