X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=blobdiff_plain;f=src%2Flib%2F16_mm.c;h=18c02bbb7da332a4260ca928391fd4d0cad08888;hp=544d280aca3ba052c22747653a5ce1d922712228;hb=be16a39d3ed2b062cca8167096a24dd7aa826b44;hpb=4b957f5e39b063de7e50121ce333b84413407820 diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 544d280a..18c02bbb 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,sw; 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,mmsmscaninfoxyposinew; + 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; mmsmscaninfoxyposinew = 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; sw = gvar->video.page[0].sw; CA_OpenDebug (gvar); while (scan) { +#ifdef MMSMSCANINFO scaninfo[q].scan = scan; +#endif strcpy(scratch, AARESET); if(scan->attributes & PURGEBITS) { @@ -1399,20 +1413,27 @@ void MM_ShowMemory (global_game_variables_t *gvar) { printf("\nend==%d\n\n", end); strcat(scratch, "MM_ShowMemory: Memory block order currupted!\n"); - strcat(scratch, "End's Size: "); - ultoa (end,str,10); - strcat (scratch,str); - strcat(scratch, "\nscan->start's Size: "); - ultoa (scan->start,str,10); - strcat (scratch,str); + strcat(scratch, "End's Size: "); ultoa (end,str,10); strcat (scratch,str); + strcat(scratch, "\nscan->start's Size: "); ultoa (scan->start,str,10); strcat (scratch,str); write(gvar->handle.debughandle,scratch,strlen(scratch)); Quit (gvar, "MM_ShowMemory: Memory block order currupted!"); } end = scan->length-1; - y = scan->start/width; - x = scan->start%width; - scaninfo[q].x = x; - scaninfo[q].y = y; + y = gvar->video.page[0].dx+(scan->start/sw); + x = gvar->video.page[0].dy+(scan->start%sw); +#if 0 +//def 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,8 +1498,10 @@ 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); @@ -1489,7 +1512,7 @@ void MM_ShowMemory (global_game_variables_t *gvar) 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,149 +1544,155 @@ void MM_ShowMemory (global_game_variables_t *gvar) } #endif #ifdef MMSMSCANINFO - MM_ShowMemoryDetail (x, y, w, q, end, &scaninfo, gvar); -#endif - - - if(gvar->video.VL_Started) IN_Ack(gvar); - - gvar->video.BOFS = (byte __far *)temp; -} - -#ifdef MMSMSCANINFO -void MM_ShowMemoryDetail (unsigned x, unsigned y, unsigned w, unsigned q, sdword end, mmshowmemoryinfo_t *scaninfo, global_game_variables_t *gvar) + maxq = q; + if(restarted) q = oldq; + else q = 0; + restarted = false; + + IN_Ack(gvar); +// VL_ClearVideo (8); + for (done = false;!done;) { - byte scratch1[4]; - unsigned maxq = q; - boolean done; - ScanCode scancode; - int xpos,ypos; - word ccolor = 3; - IN_Ack(gvar); -// VL_ClearVideo (8); - for (q = 0,done = false;!done;) + if(scaninfo[q].scan->attributes & PURGEBITS) { - if(scaninfo[q].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[q].scan->attributes & LOCKBIT) - { - ccolor = 1; // red = locked - strcpy(scratch1, AARED); // red = locked - //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); -#define MMSMPRINTMEMINFO modexprint(&(gvar->video.page[0]), xpos, ypos, 1, 1, ccolor, 8, gvar->video.VL_Started, global_temp_status_text); ypos+=8; + 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) + if(gvar->video.VL_Started) + { + VL_ShowPage(&gvar->video.page[0], 1, 0); + modexClearRegion(&gvar->video.page[0], gvar->video.page[0].dx, gvar->video.page[0].dy, gvar->video.page[0].sw, gvar->video.page[0].sh, 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/sw; + x = scaninfo[q].scan->start%sw; + if(!mmsmscaninfoxyposinew) { - sprintf(global_temp_status_text, "free: %05u", (unsigned)(scaninfo[q].scan->next->start-scaninfo[q].scan->start)); MMSMPRINTMEMINFO + 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; } - if(gvar->video.VL_Started) + VW_Hlin(x,x+end,y,color,gvar); + VL_Plot(x,y,5,gvar); + } + else + { + printf("%s", scratch1); + printf("%s", AAGREY); printf("_"); + for(w=(scaninfo[q].scan->start)/80;w<=end/80;w++) { - y = ypos;//scaninfo[q].scan->start/width; - x = xpos;//scaninfo[q].scan->start%width; - VW_Hlin(x,x+end,y,ccolor,gvar); - VL_Plot(x,y,5,gvar); + //strcat(scratch1, "+"); + printf("+"); } - else + } + + + 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++) { - 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("+"); - } + //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 (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; + } + else + { + //printf("%s\n", scratch1); + printf("%s", AARESET); + printf("\n"); + } - 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"); - } -//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 - while (!(scancode = gvar->in.inst->LastScan)){} + 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(q0) q--; + else q = maxq; + break; + case sc_RightArrow: + if(q9) q-=10; + else q = maxq; + break; + case sc_DownArrow: + if(qvideo.page[0], gvar->video.page[0].dx, gvar->video.page[0].dy, gvar->video.page[0].sw, gvar->video.page[0].sh, 8); + goto reset; + break; + case sc_Escape: + done = true; + break; } } +#else + if(gvar->video.VL_Started) IN_Ack(gvar); #endif + gvar->video.BOFS = (byte __far *)temp; +} + //========================================================================== + /* ===================== =