From: sparky4 Date: Sun, 19 Jul 2015 21:00:44 +0000 (-0500) Subject: ok! X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;ds=sidebyside;h=ee8ff115b770801a7028e34795cad0a0982a551c;p=16.git ok! 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 --- diff --git a/exmmtest.exe b/exmmtest.exe index dda4760f..3aa742b3 100644 Binary files a/exmmtest.exe and b/exmmtest.exe differ diff --git a/miditest.exe b/miditest.exe index 1cf5b3db..47056053 100644 Binary files a/miditest.exe and b/miditest.exe differ diff --git a/sountest.exe b/sountest.exe index ac0c4bde..55721859 100644 Binary files a/sountest.exe and b/sountest.exe differ diff --git a/src/exmmtest.c b/src/exmmtest.c index 8cd440f5..b1663ffe 100644 --- a/src/exmmtest.c +++ b/src/exmmtest.c @@ -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(); diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index df722dae..4ee50576 100644 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -74,9 +74,9 @@ byte _seg *audiosegs[NUMSNDCHUNKS]; void _seg *grsegs[NUMCHUNKS]; byte far grneeded[NUMCHUNKS]; -byte ca_levelbit,ca_levelnum; +byte ca_levelbit,ca_levelnum;*/ -int profilehandle,debughandle;*/ +int profilehandle,debughandle; void (*drawcachebox) (char *title, unsigned numcache); void (*updatecachebox) (void); @@ -173,7 +173,6 @@ long GRFILEPOS(int c) = ============================ */ -/*++++ void CA_OpenDebug(void) { unlink("DEBUG.TXT"); @@ -182,8 +181,8 @@ void CA_OpenDebug(void) void CA_CloseDebug(void) { - close debughandle); -}*/ + close(debughandle); +} diff --git a/src/lib/16_ca.h b/src/lib/16_ca.h index b752bae5..29030c6a 100644 --- a/src/lib/16_ca.h +++ b/src/lib/16_ca.h @@ -20,10 +20,6 @@ #ifndef __16_CA__ #define __16_CA__ -#include -#include -#include - #ifndef __16_MM__ #include "src/lib/16_head.h" #include "src/lib/16_mm.h" @@ -65,9 +61,9 @@ extern void _seg *grsegs[NUMCHUNKS]; extern byte far grneeded[NUMCHUNKS]; extern byte ca_levelbit,ca_levelnum; -extern char *titleptr[8]; +extern char *titleptr[8];*/ -extern int profilehandle,debughandle;*/ +extern int profilehandle,debughandle; // // hooks for custom cache dialogs @@ -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); //=========================================================================== - + void CA_OpenDebug (void); -void CA_CloseDebug (void); +void CA_CloseDebug (void); boolean CA_FarRead (int handle, byte huge *dest, dword length, mminfo_t *mm); -boolean CA_FarWrite (int handle, byte huge *source, dword length, mminfo_t *mm); +boolean CA_FarWrite (int handle, byte huge *source, dword length, mminfo_t *mm); + boolean CA_ReadFile (char *filename, memptr *ptr, mminfo_t *mm); -boolean CA_LoadFile (char *filename, memptr *ptr, mminfo_t *mm, mminfotype *mmi); +boolean CA_LoadFile (char *filename, memptr *ptr, mminfo_t *mm, mminfotype *mmi); //long CA_RLEWCompress (unsigned huge *source, long length, unsigned huge *dest,unsigned rlewtag); diff --git a/src/lib/16_head.h b/src/lib/16_head.h index cb491f70..18e0e4c0 100644 --- a/src/lib/16_head.h +++ b/src/lib/16_head.h @@ -37,6 +37,9 @@ #include // just for wait #include #include +#include +#include +#include #include "src/lib/types.h" /* Control codes for all keys on the keyboard */ @@ -133,6 +136,7 @@ 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); +extern void CA_CloseDebug (void); + #endif/*_LIBHEAD_H_*/ diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 9e980b67..4d126499 100644 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -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 +//========================================================================== + +/* +===================== += += MM_DumpData += +===================== +*/ + +void MM_DumpData(mminfo_t *mm) +{ + mmblocktype far *scan,far *best; + long lowest,oldlowest; + unsigned owner; + char lock,purge; + FILE *dumpfile; + + + free (mm->nearheap); + dumpfile = fopen ("mmdump.txt","w"); + if (!dumpfile){ + printf("MM_DumpData: Couldn't open MMDUMP.TXT!"); + return; + } + + lowest = -1; + do + { + oldlowest = lowest; + lowest = 0xffff; + + scan = mm->mmhead; + while (scan) + { + owner = (unsigned)scan->useptr; + + if (owner && owner oldlowest) + { + best = scan; + lowest = owner; + } + + scan = scan->next; + } + + if (lowest != 0xffff) + { + if (best->attributes & PURGEBITS) + purge = 'P'; + else + purge = '-'; + if (best->attributes & LOCKBIT) + lock = 'L'; + else + lock = '-'; + fprintf (dumpfile,"0x%p (%c%c) = %u\n" + ,(unsigned)lowest,lock,purge,best->length); + } + + } while (lowest != 0xffff); + + fclose (dumpfile); + printf("MMDUMP.TXT created."); +} + //========================================================================== diff --git a/src/lib/16_mm.h b/src/lib/16_mm.h index f7457aa5..5ff492c4 100644 --- a/src/lib/16_mm.h +++ b/src/lib/16_mm.h @@ -26,6 +26,7 @@ //#include #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); diff --git a/tsthimem.exe b/tsthimem.exe index f14444b0..14bb7052 100644 Binary files a/tsthimem.exe and b/tsthimem.exe differ