//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();
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
=\r
============================\r
*/\r
-/*++++\r
void CA_OpenDebug(void)\r
{\r
unlink("DEBUG.TXT");\r
\r
void CA_CloseDebug(void)\r
{\r
- close debughandle);\r
-}*/\r
+ close(debughandle);\r
+}\r
\r
\r
\r
#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
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
//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
#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)
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_*/
end = -1;
-//CA_OpenDebug ();
+CA_OpenDebug ();
chx=0;
chy=0;
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!
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);
}
//****#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
+}
+
//==========================================================================
//#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
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);