X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=blobdiff_plain;f=src%2Flib%2F16_mm.c;h=a5903b0cfd16f833414408bbeae43e9ada938411;hp=544d280aca3ba052c22747653a5ce1d922712228;hb=0df3c2d5e81ce6a2f1d498b3107e1fd223e7af80;hpb=ee23271b54767e3d62abc7a25bd3917074575b8b diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 544d280a..a5903b0c 100755 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -1357,13 +1357,20 @@ extern char global_temp_status_text2[512]; ===================== */ + void MM_ShowMemory (global_game_variables_t *gvar) { mmblocktype far *scan; - unsigned color,temp,x,y ,w,q,width; + unsigned color,temp,x,y ,w,width; sdword end,owner; byte scratch[160],scratch0[4096],str[16]; +#ifdef MMSMSCANINFO mmshowmemoryinfo_t scaninfo[MAXBLOCKS]; + byte scratch1[4]; + unsigned xpos,ypos, oldq,q,maxq; + boolean done,restarted; + ScanCode scancode; +#endif 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); @@ -1371,16 +1378,23 @@ void MM_ShowMemory (global_game_variables_t *gvar) //gvar->video.ofs.bufferofs = gvar->video.ofs.displayofs; temp = BDOFSCONV gvar->video.BOFS; gvar->video.BOFS = gvar->video.DOFS; +#ifdef MMSMSCANINFO + oldq = 0; restarted = false; +reset: + q = 0; +#endif scan = gvar->mm.mmhead; end = -1; w = 0; - width = gvar->video.page[0].width; q = 0; + width = gvar->video.page[0].width; CA_OpenDebug (gvar); while (scan) { +#ifdef MMSMSCANINFO scaninfo[q].scan = scan; +#endif strcpy(scratch, AARESET); if(scan->attributes & PURGEBITS) { @@ -1411,8 +1425,18 @@ 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; +#ifdef MMSMSCANINFO + if(restarted){ + y += gvar->video.page[0].dy; + x += gvar->video.page[0].dx; + } +#if 0 + else{ + scaninfo[q].y = y; + scaninfo[q].x = x; + } +#endif +#endif VW_Hlin(x,x+end,y,color,gvar); VL_Plot(x,y,5,gvar); //++==++==optional strcat(scratch0, AARESET); strcat(scratch0, AAGREY); strcat(scratch0,"_"); @@ -1477,19 +1501,22 @@ void MM_ShowMemory (global_game_variables_t *gvar) //0000fprintf(stdout, "[%u]\n", q); scan = scan->next; +#ifdef MMSMSCANINFO q++; -//if(color!=6) IN_Ack(gvar); +#endif +//0000if(q==1 && gvar->video.VL_Started && color!=6) IN_Ack(gvar); } CA_CloseDebug (gvar); -#ifdef MMSMPANVID +#if 0 +//def MMSMPANVID { int dx,dy,odx,ody; odx = gvar->video.page[0].dx; ody = gvar->video.page[0].dy; dx = dy = 0; - while(!gvar->in.inst->Keyboard[sc_Escape]) + while(!gvar->in.inst->Keyboard[sc_Escape] && !gvar->in.inst->Keyboard[sc_Space]) { if(gvar->in.inst->Keyboard[sc_UpArrow]) { @@ -1521,16 +1548,156 @@ void MM_ShowMemory (global_game_variables_t *gvar) } #endif #ifdef MMSMSCANINFO - MM_ShowMemoryDetail (x, y, w, q, end, &scaninfo, gvar); +//#define MMSMSCANINFOXYPOSNEW +//{ + maxq = q; + if(restarted) q = oldq; + else q = 0; + restarted = false; + + IN_Ack(gvar); +// VL_ClearVideo (8); + for (done = false;!done;) + { + if(scaninfo[q].scan->attributes & PURGEBITS) + { + color = 6; // dark purple = purgable + strcpy(scratch1, AAMAGENTA); // dark purple = purgable + //printf("%s", AAMAGENTA); + }else{ + color = 2; // medium blue = non purgable + strcpy(scratch1, AABLUE); // medium blue = non purgable + //printf("%s", AABLUE); + } + if(scaninfo[q].scan->attributes & LOCKBIT) + { + color = 1; // red = locked + strcpy(scratch1, AARED); // red = locked + //printf("%s", AARED); + } + end = scaninfo[q].scan->length-1; +//modexprint(page, x, y, t, tlsw, color, bgcolor, vidsw, const byte *str); +#define MMSMPRINTMEMINFO modexprint(&(gvar->video.page[0]), xpos, ypos, 1, 1, color, 8, gvar->video.VL_Started, global_temp_status_text); ypos+=8; +#ifdef __WATCOMC__ + if(gvar->video.VL_Started) + { + 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); + }else +#endif + clrscr(); + sprintf(global_temp_status_text, "block #%04u", q); MMSMPRINTMEMINFO +// sprintf(global_temp_status_text, "%Fp", scaninfo[q].scan->useptr); MMSMPRINTMEMINFO + sprintf(global_temp_status_text, "start: %04x", (unsigned)scaninfo[q].scan->start); MMSMPRINTMEMINFO + sprintf(global_temp_status_text, "useptr: %04x", (unsigned)scaninfo[q].scan->useptr); MMSMPRINTMEMINFO + sprintf(global_temp_status_text, "size: %05u", (unsigned)scaninfo[q].scan->length); MMSMPRINTMEMINFO + if (scaninfo[q].scan->next && scaninfo[q].scan->next->start > end+1) + { + sprintf(global_temp_status_text, "free: %05u", (unsigned)(scaninfo[q].scan->next->start-scaninfo[q].scan->start)); MMSMPRINTMEMINFO + }else ypos+=8; + if(gvar->video.VL_Started) + { + y = scaninfo[q].scan->start/width; + x = scaninfo[q].scan->start%width; +#ifndef MMSMSCANINFOXYPOSNEW + y = ypos; + x = xpos; +#else + //y = scaninfo[q].y; + //x = scaninfo[q].x; + y += gvar->video.page[0].dy; + x += gvar->video.page[0].dx; +#endif + VW_Hlin(x,x+end,y,color,gvar); + VL_Plot(x,y,5,gvar); + } + else + { + printf("%s", scratch1); + printf("%s", AAGREY); printf("_"); + if(scaninfo[q].scan->length<64000) + for(w=(scaninfo[q].scan->start)/80;w<=end/80;w++) + { + //strcat(scratch1, "+"); + printf("+"); + } + } + + + if (scaninfo[q].scan->next && scaninfo[q].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[q].scan->next->start-scaninfo[q].scan->start)/80);w++) + { + //strcat(scratch1,"0"); + printf("0"); + } + }else VW_Hlin(x+end+1,x+(scaninfo[q].scan->next->start-scaninfo[q].scan->start),y,3,gvar); // black = free//now green + + + if(gvar->video.VL_Started) + { + //if (scan->next && scan->next->start > end+1) free + xpos = gvar->video.page[0].dx; + ypos = gvar->video.page[0].dy;//(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(q>0) q--; + else q = maxq; + break; + case sc_RightArrow: + if(q10) q-=10; + else q = maxq; + break; + case sc_DownArrow: + if(qmm.mmhead; +// x = gvar->video.page[0].dx; +// y = gvar->video.page[0].dy;//(gvar->video.page[0].sh-(32));//8*4 + oldq = q; + restarted = true; + goto reset; + break; + case sc_Escape: + done = true; + break; + } + } +//} +// MM_ShowMemoryDetail (x, y, w, q, end, &scaninfo, gvar); #endif - if(gvar->video.VL_Started) IN_Ack(gvar); +//?? if(gvar->video.VL_Started) IN_Ack(gvar); gvar->video.BOFS = (byte __far *)temp; } -#ifdef MMSMSCANINFO +#if 0 +//def MMSMSCANINFO void MM_ShowMemoryDetail (unsigned x, unsigned y, unsigned w, unsigned q, sdword end, mmshowmemoryinfo_t *scaninfo, global_game_variables_t *gvar) { byte scratch1[4]; @@ -1560,13 +1727,7 @@ void MM_ShowMemoryDetail (unsigned x, unsigned y, unsigned w, unsigned q, sdword //printf("%s", AARED); } end = scaninfo[q].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); +//modexprint(page, x, y, t, tlsw, color, bgcolor, vidsw, const byte *str); #define MMSMPRINTMEMINFO modexprint(&(gvar->video.page[0]), xpos, ypos, 1, 1, ccolor, 8, gvar->video.VL_Started, global_temp_status_text); ypos+=8; #ifdef __WATCOMC__ if(gvar->video.VL_Started) @@ -1632,7 +1793,7 @@ void MM_ShowMemoryDetail (unsigned x, unsigned y, unsigned w, unsigned q, sdword printf("\n"); } //0000printf("%s", AABLACK); fprintf(stdout, "q=%u maxq=%u\n", q, maxq); printf("%s", AARESET); -fprintf(stdout, ""); //this is a HAX to make it decrement and increment properly when it is at 0 and qmax +//fprintf(stdout, ""); //this is a HAX to make it decrement and increment properly when it is at 0 and qmax while (!(scancode = gvar->in.inst->LastScan)){} IN_ClearKey(scancode);