X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_mm.c;h=706aaff19a0f217bed5152a375ab3d54edd61bcf;hb=181c6beee3d42da41fc53f44f0aa3e9315016ad2;hp=223649433eb5b9f720bab86e262a07bb836a084c;hpb=26e7d516fe403f4fef98b9bb349fedcd9eb3a13d;p=16.git diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 22364943..706aaff1 100755 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -1,19 +1,23 @@ -/* Catacomb Apocalypse Source Code - * Copyright (C) 1993-2014 Flat Rock Software +/* Project 16 Source Code~ + * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover * - * This program is free software; you can redistribute it and/or modify + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Project 16 is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * */ // NEWMM.C @@ -550,7 +554,7 @@ getmemory: } #endif // printf("base=%u ", base); printf("size=%u\n", size); - MML_UseSpace(base,size, gvar); + MML_UseSpace (base,size, gvar); gvar->mmi.XMSmem += size*16; gvar->mm.UMBbase[gvar->mm.numUMBs] = base; gvar->mm.numUMBs++; @@ -609,7 +613,7 @@ void MML_ShutdownXMS(global_game_variables_t *gvar) { scan->blob=segm; - //MML_UseSpace(segstart, seglength, gvar); + //MML_UseSpace (segstart, seglength, gvar); printf("MML_UseSpace: Segment spans two blocks!\n"); //} @@ -624,7 +628,7 @@ void MML_ShutdownXMS(global_game_variables_t *gvar) } //++++todo: linked list of segment! */ -void MML_UseSpace(word segstart, dword seglength, global_game_variables_t *gvar) +void MML_UseSpace (word segstart, dword seglength, global_game_variables_t *gvar) { mmblocktype far *scan,far *last; word oldend; @@ -740,7 +744,7 @@ void MML_ClearBlock(global_game_variables_t *gvar) =================== */ -void MM_Startup(global_game_variables_t *gvar) +void MM_Startup (global_game_variables_t *gvar) { int i; //dword length,seglength; @@ -793,7 +797,7 @@ void MM_Startup(global_game_variables_t *gvar) length -= SAVENEARHEAP; seglength = length / 16; // now in paragraphs segstart = FP_SEG(start)+(FP_OFF(start)+15)/16; - MML_UseSpace(segstart,seglength, gvar); + MML_UseSpace (segstart,seglength, gvar); gvar->mmi.nearheap = length; //0000printf("near: start=%Fp segstart=%x seglen=%lu len=%lu\n", start, segstart, (dword)seglength, length); @@ -814,7 +818,7 @@ void MM_Startup(global_game_variables_t *gvar) length -= SAVEFARHEAP; seglength = length / 16; // now in paragraphs segstart = FP_SEG(start)+(FP_OFF(start)+15)/16; - MML_UseSpace(segstart,seglength, gvar); + MML_UseSpace (segstart,seglength, gvar); gvar->mmi.farheap = length; //0000printf("far: start=%Fp segstart=%x seglen=%lu len=%lu\n", start, segstart, (dword)seglength, length); @@ -837,7 +841,7 @@ void MM_Startup(global_game_variables_t *gvar) { MML_SetupEMS(gvar); // allocate space //16_PM: EMS4! AND EMS 3.2 MASSIVE DATA HANDLMENT! - MML_UseSpace(gvar->mm.EMSPageFrame,(MAPPAGES)*0x4000lu, gvar); + MML_UseSpace (gvar->mm.EMSPageFrame,(MAPPAGES)*0x4000lu, gvar); //if(gvar->pm.emm.EMSVer<0x40) MM_MapEMS(gvar); // map in used pages //else @@ -884,7 +888,7 @@ xmsskip: ==================== */ -void MM_Shutdown(global_game_variables_t *gvar) +void MM_Shutdown (global_game_variables_t *gvar) { if(!(gvar->mm.mmstarted)) return; @@ -936,13 +940,14 @@ void MM_GetPtr (memptr *baseptr, dword size, global_game_variables_t *gvar) gvar->mm.mmnew->useptr = baseptr; //if(gvar->mm.mmnew->useptr==NULL){ #ifdef __DEBUG_MM__ + printf("MM_GetPtr\n"); if(dbg_debugmm>0){ - printf("MM_GetPtr\n"); //%04x printf(" baseptr=%Fp ", baseptr); printf("useptr=%Fp\n", gvar->mm.mmnew->useptr); printf(" *baseptr=%Fp ", *baseptr); printf("*useptr=%Fp\n", *(gvar->mm.mmnew->useptr)); printf(" &baseptr=%Fp ", &baseptr); printf("&useptr=%Fp\n", &(gvar->mm.mmnew->useptr)); } + printf(" size is %lu\n", size); #endif //Quit(gvar, "gvar->mm.mmnew->useptr==NULL"); } gvar->mm.mmnew->attributes = BASEATTRIBUTES; @@ -1320,13 +1325,12 @@ void MM_ShowMemory (global_game_variables_t *gvar) 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) { @@ -1426,6 +1430,7 @@ void MM_ShowMemory (global_game_variables_t *gvar) #endif #ifdef MMSMSCANINFO { + byte scratch1[4]; unsigned maxq = q; boolean done; ScanCode scancode; @@ -1438,12 +1443,18 @@ void MM_ShowMemory (global_game_variables_t *gvar) 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{ @@ -1454,9 +1465,9 @@ void MM_ShowMemory (global_game_variables_t *gvar) } 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; - VL_ShowPage(&gvar->video.page[0], 1, 0); 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 @@ -1467,16 +1478,51 @@ void MM_ShowMemory (global_game_variables_t *gvar) { sprintf(global_temp_status_text, "free: %05u", (unsigned)(scaninfo[qq].scan->next->start-scaninfo[qq].scan->start)); MMSMPRINTMEMINFO } - 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); - if (scaninfo[qq].scan->next && scaninfo[qq].scan->next->start > end+1) - 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) + { + 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 (scan->next && scan->next->start > end+1) free - xpos = 16; - ypos = 16;//(gvar->video.page[0].sh-(32));//8*4 + 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); @@ -1498,7 +1544,7 @@ void MM_ShowMemory (global_game_variables_t *gvar) } #endif - IN_Ack(gvar); + if(gvar->video.VL_Started) IN_Ack(gvar); gvar->video.BOFS = (byte __far *)temp; }