X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_mm.c;h=d43432fe61707e682132b1efdf1d8c2bd70e9783;hb=256be2f6f35912701d3e3770e49e388f462a6acc;hp=e2249abd0ec9c4daae564e16f5a608bdb73fef7c;hpb=c28d5b8162a2fef3c362a709915d6f8ad18625e1;p=16.git diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index e2249abd..d43432fe 100755 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -1257,14 +1257,18 @@ void MM_SortMem (global_game_variables_t *gvar) ===================== */ -#define MMSMPANVID +#ifdef __WATCOMC__ +//#define MMSMPANVID +#define MMSMSCANINFO +#endif void MM_ShowMemory (global_game_variables_t *gvar) { mmblocktype far *scan; - unsigned color,temp,x,y ,w,width; + unsigned color,temp,x,y ,w,q,width; sdword end,owner; - byte scratch[160],scratch0[4096],str[16]; + byte scratch[160],scratch0[4096],str[16]; + mmshowmemoryinfo_t scaninfo[MAXBLOCKS]; if(!gvar->video.page[0].width) gvar->video.page[0].sw = gvar->video.page[0].width = 320; //to prevent division by 0 //-- VL_SetLineWidth(40, gvar); @@ -1276,11 +1280,12 @@ void MM_ShowMemory (global_game_variables_t *gvar) end = -1; w = 0; - width = gvar->video.page[0].width; + width = gvar->video.page[0].width; q = 0; CA_OpenDebug (gvar); while (scan) { + scaninfo[q].scan = scan; strcpy(scratch, AARESET); if(scan->attributes & PURGEBITS) { @@ -1311,15 +1316,16 @@ void MM_ShowMemory (global_game_variables_t *gvar) end = scan->length-1; y = scan->start/width; x = scan->start%width; + scaninfo[q].x = x; + scaninfo[q].y = y; VW_Hlin(x,x+end,y,color,gvar); VL_Plot(x,y,5,gvar); +//++==++==optional strcat(scratch0, AARESET); strcat(scratch0, AAGREY); strcat(scratch0,"_"); for(w=(scan->start)/80;w<=end/80;w++) { //printf("+ %u %lu\n", w, scan->length); strcat(scratch0, "+"); } - //++==++==optional - strcat(scratch0, AARESET); strcat(scratch0, AAGREY); strcat(scratch0,"_"); if (scan->next && scan->next->start > end+1) { @@ -1374,6 +1380,7 @@ void MM_ShowMemory (global_game_variables_t *gvar) //fprintf(stdout, "%s", scratch); scan = scan->next; + q++; //if(color!=6) IN_Ack(gvar); } @@ -1415,9 +1422,124 @@ void MM_ShowMemory (global_game_variables_t *gvar) gvar->video.page[0].dx = odx; gvar->video.page[0].dy = ody; } -#else - IN_Ack(gvar); #endif +#ifdef MMSMSCANINFO + { + byte scratch1[4]; + unsigned maxq = q; + boolean done; + ScanCode scancode; + int xpos,ypos; + word qq, ccolor = 3; + IN_Ack(gvar); +// VL_ClearVideo (8); + for (qq = 0,done = false;!done;) + { + if(scaninfo[qq].scan->attributes & PURGEBITS) + { + ccolor = 6; // dark purple = purgable + strcpy(scratch1, AAMAGENTA); // dark purple = purgable + //printf("%s", AAMAGENTA); + }else{ + ccolor = 2; // medium blue = non purgable + strcpy(scratch1, AABLUE); // medium blue = non purgable + //printf("%s", AABLUE); + } + if(scaninfo[qq].scan->attributes & LOCKBIT) + { + ccolor = 1; // red = locked + strcpy(scratch1, AARED); // red = locked + //printf("%s", AARED); + } + end = scaninfo[qq].scan->length-1; +/*typedef struct mmblockstruct{ + word start,length; + unsigned attributes; + memptr *useptr; // pointer to the segment start + struct mmblockstruct far *next; +} mmblocktype;*/ + //modexprint(page, x, y, t, tlsw, color, bgcolor, vidsw, const byte *str); +#define MMSMPRINTMEMINFO modexprint(&(gvar->video.page[0]), xpos, ypos, 1, 0, ccolor, 8, gvar->video.VL_Started, global_temp_status_text); ypos+=8; + if(!gvar->video.VL_Started) clrscr(); else + { + VL_ShowPage(&gvar->video.page[0], 1, 0); + modexClearRegion(&gvar->video.page[0], 0, 0, gvar->video.page[0].width, gvar->video.page[0].height, 8); + } + sprintf(global_temp_status_text, "block #%04u", qq); MMSMPRINTMEMINFO +// sprintf(global_temp_status_text, "%Fp", scaninfo[qq].scan->useptr); MMSMPRINTMEMINFO + sprintf(global_temp_status_text, "%04x", (unsigned)scaninfo[qq].scan->useptr); MMSMPRINTMEMINFO + sprintf(global_temp_status_text, "size: %05u", (unsigned)scaninfo[qq].scan->length); MMSMPRINTMEMINFO + if (scaninfo[qq].scan->next && scaninfo[qq].scan->next->start > end+1) + { + sprintf(global_temp_status_text, "free: %05u", (unsigned)(scaninfo[qq].scan->next->start-scaninfo[qq].scan->start)); MMSMPRINTMEMINFO + } + if(gvar->video.VL_Started) + { + y = ypos;//scaninfo[qq].scan->start/width; + x = xpos;//scaninfo[qq].scan->start%width; + VW_Hlin(x,x+end,y,ccolor,gvar); + VL_Plot(x,y,5,gvar); + } + else + { + printf("%s", scratch1); + printf("%s", AAGREY); printf("_"); + for(w=(scaninfo[qq].scan->start)/80;w<=end/80;w++) + { + //strcat(scratch1, "+"); + printf("+"); + } + } + + + if (scaninfo[qq].scan->next && scaninfo[qq].scan->next->start > end+1) if(!gvar->video.VL_Started) + { + //strcat(scratch1, AARESET); + printf("%s", AARESET); + //strcat(scratch1,AAGREEN); + printf("%s", AAGREEN); + for(w=(end+1)/80;w<=((scaninfo[qq].scan->next->start-scaninfo[qq].scan->start)/80);w++) + { + //strcat(scratch1,"0"); + printf("0"); + } + }else VW_Hlin(x+end+1,x+(scaninfo[qq].scan->next->start-scaninfo[qq].scan->start),y,3,gvar); // black = free//now green + + + if(gvar->video.VL_Started) + { + //if (scan->next && scan->next->start > end+1) free + xpos = 16; + ypos = 16;//(gvar->video.page[0].sh-(32));//8*4 + } + else + { + //printf("%s\n", scratch1); + printf("%s", AARESET); + printf("\n"); + } + while (!(scancode = gvar->in.inst->LastScan)){} + + IN_ClearKey(scancode); + switch (scancode) + { + case sc_LeftArrow: + if(qq>0) qq--; + else qq = maxq; + break; + case sc_RightArrow: + if(qqvideo.VL_Started) IN_Ack(gvar); gvar->video.BOFS = (byte __far *)temp; }