From: sparky4 Date: Sat, 8 Aug 2015 20:39:48 +0000 (-0500) Subject: ok! wwww X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=2170cf972950dffecd075a65d1f8d9a49eb82ce9;p=16.git ok! wwww modified: 16.exe modified: bakapi.exe modified: exmmtest.exe modified: fontgfx.exe modified: maptest.exe modified: palettec.exe modified: pcxtest.exe modified: scroll.exe modified: src/exmmtest.c modified: src/fontgfx.c modified: src/lib/16_ca.c modified: src/lib/16_head.h modified: src/lib/16_mm.c modified: src/lib/16_mm.h modified: src/lib/modex16.c modified: test.exe modified: test2.exe --- diff --git a/16.exe b/16.exe index d0458619..3d3f2797 100644 Binary files a/16.exe and b/16.exe differ diff --git a/bakapi.exe b/bakapi.exe index e1c1f69d..4975fc13 100644 Binary files a/bakapi.exe and b/bakapi.exe differ diff --git a/exmmtest.exe b/exmmtest.exe index 64f660ac..6f9a4af5 100644 Binary files a/exmmtest.exe and b/exmmtest.exe differ diff --git a/fontgfx.exe b/fontgfx.exe index 0b932c07..cd80b9da 100644 Binary files a/fontgfx.exe and b/fontgfx.exe differ diff --git a/maptest.exe b/maptest.exe index 6ad04474..6d95e77e 100644 Binary files a/maptest.exe and b/maptest.exe differ diff --git a/palettec.exe b/palettec.exe index b38c6f72..45763678 100644 Binary files a/palettec.exe and b/palettec.exe differ diff --git a/pcxtest.exe b/pcxtest.exe index 87b9f8e4..d39c22f0 100644 Binary files a/pcxtest.exe and b/pcxtest.exe differ diff --git a/scroll.exe b/scroll.exe index 1e15ab21..de253902 100644 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/src/exmmtest.c b/src/exmmtest.c index 4d8ca6c1..8e5b2283 100644 --- a/src/exmmtest.c +++ b/src/exmmtest.c @@ -87,12 +87,12 @@ main(int argc, char *argv[]) //screen.width += (16*2); //screen.height += (16*2); - printf("main()=%Fp start MM\n", *argv[0]); +// printf("main()=%Fp start MM\n", *argv[0]); MM_Startup(&mm, &mmi); //PM_Startup(); //PM_UnlockMainMem(); CA_Startup(&gvar); - printf(" done!\n"); +// printf(" done!\n"); printf("&main()= %Fp\n", *argv[0]); printf("bigbuffer= %Fp\n", bigbuffer); printf("&bigbuffer= %Fp\n", &bigbuffer); @@ -130,14 +130,14 @@ main(int argc, char *argv[]) MM_DumpData(&mm); //++++modexLeave(); MM_Report(&mm, &mmi); - printf(" stop!\n"); +// printf(" stop!\n"); #ifdef FILERL MM_FreePtr(&bigbuffer, &mm); #endif //PM_Shutdown(); CA_Shutdown(&gvar); MM_Shutdown(&mm); - printf(" done!\n"); +// printf(" done!\n"); #ifdef FILERL free(bakapee); if(baka) printf("\nyay!\n"); diff --git a/src/fontgfx.c b/src/fontgfx.c index d6599e60..4fc08ee9 100644 --- a/src/fontgfx.c +++ b/src/fontgfx.c @@ -65,8 +65,8 @@ IIIIIII BBBBBBBBB MMMM M MMMM\n\ modexEnter(); /* setup camera and screen~ */ screen = modexDefaultPage(); - screen.width += (16*2); - screen.height += (16*2); + //screen.width += (16*2); + //screen.height += (16*2); //++++ modexShowPage(&screen); //modexprint(16, 16, 1, 15, "wwww"); //getch(); @@ -75,7 +75,7 @@ IIIIIII BBBBBBBBB MMMM M MMMM\n\ colpee=32; for(e=0x00; e<=0xFE; e++) { - if(chx+8>(SCREEN_WIDTH/2)-16) + if(chx+8>(screen.width/2)) { chx=0; chy+=8; diff --git a/src/lib/16_ca.c b/src/lib/16_ca.c index abeffbfd..f134df8b 100644 --- a/src/lib/16_ca.c +++ b/src/lib/16_ca.c @@ -1083,6 +1083,8 @@ void CA_Startup(global_game_variables_t *gvar) unlink("profile.16"); gvar->handle.profilehandle = open("profile.16", O_CREAT | O_WRONLY | O_TEXT); #endif + unlink("debug0.16"); + gvar->handle.showmemhandle = open("debug0.16", O_CREAT | O_WRONLY | O_TEXT); /*++++ // MDM begin - (GAMERS EDGE) // @@ -1144,6 +1146,7 @@ void CA_Shutdown(global_game_variables_t *gvar) #ifdef PROFILE close(gvar->handle.profilehandle); #endif + close(gvar->handle.showmemhandle); /*++++ close(maphandle); close(grhandle); diff --git a/src/lib/16_head.h b/src/lib/16_head.h index 665c4fb2..8baff16a 100644 --- a/src/lib/16_head.h +++ b/src/lib/16_head.h @@ -179,6 +179,7 @@ typedef void _seg * memptr; typedef struct { + int showmemhandle; int profilehandle,debughandle; int heaphandle; } handle_t; diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index 78f00337..a9bcd0c1 100644 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -1252,10 +1252,8 @@ void MM_SortMem(mminfo_t *mm) MM_SetLock(&(memptr)audiosegs[playing],false);*/ } - //========================================================================== -//****#if 0 /* ===================== = @@ -1267,12 +1265,12 @@ void MM_SortMem(mminfo_t *mm) void MM_ShowMemory(global_game_variables_t *gvar,/*page_t *page, */mminfo_t *mm) { mmblocktype huge *scan; -//++++ word color; + //byte color; word temp; long end,owner; -//++++ word chx,chy; - byte scratch[160],str[16]; - + word chx,chy; + byte scratch[160],scratch0[4096],str[16]; + byte d = "#"; //**** VW_SetDefaultColors(); //**** VW_SetLineWidth(40); //++++mh temp = bufferofs; @@ -1280,28 +1278,24 @@ void MM_ShowMemory(global_game_variables_t *gvar,/*page_t *page, */mminfo_t *mm) //**** VW_SetScreen (0,0); scan = mm->mmhead; - end = -1; CA_OpenDebug (gvar); - -//++++ chx=0; + chx=0; //++++ chy=0; - while(scan) { -/*++++ if(scan->attributes & PURGEBITS) - color = 5; // dark purple = purgable + if(scan->attributes & PURGEBITS) + strcpy(scratch0, AAMAGENTA); // dark purple = purgable else - color = 9; // medium blue = non purgable + strcpy(scratch0, AABLUE); // medium blue = non purgable if(scan->attributes & LOCKBIT) - color = 12; // red = locked*/ + strcpy(scratch0, AARED); // red = locked if(scan->start<=end) { - //printf("); write(gvar->handle.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; + break; } end = scan->start+scan->length-1; //++++ chy = scan->start/320; @@ -1311,32 +1305,45 @@ CA_OpenDebug (gvar); //{ //++++ modexClearRegion(page, chx, chy, 4, 4, color); //} - //++++ VW_Hlin(scan->start,(unsigned)end,0,color); - + for(chx=scan->start;chx>=(word)end;chx++) + { + strcat(scratch0,&d); + } + strcat (scratch0,AAWHITE); strcat(scratch0,&d); //++++ VW_Plot(scan->start,0,15); //++++ modexClearRegion(page, chx, chy, 4, 4, 15); - if(scan->next->start > end+1) //++++ VW_Hlin(end+1,scan->next->start,0,0); // black = free + if(scan->next->start > end+1) + { + strcat(scratch0,AABLACK); + for(chx=end+1;chx>=(word)scan->next->start;chx++) + { + strcat(scratch0,&d); + } + } //for(chx=scan->next->start;chx+4>=(word)end+1;chx+=4) //{ -//++++ chx+=scan->next->start; -//++++ modexClearRegion(page, chx, chy, 4, 4, 2); +// chx+=scan->next->start; +// modexClearRegion(page, chx, chy, 4, 4, 2); //} //modexhlin(page, end+1,scan->next->start, chy, 0); - -/* - end = scan->length-1; - y = scan->start/320; +/* y = scan->start/320; x = scan->start%320; VW_Hlin(x,x+end,y,color); VW_Plot(x,y,15); - if (scan->next && scan->next->start > end+1) - VW_Hlin(x+end+1,x+(scan->next->start-scan->start),y,0); // black = free -*/ - -//****#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! + if (scan->next && scan->next->start > end+1) + { + //write(gvar->handle.showmemhandle,AABLACK,strlen(AABLACK)); + //for(chx=scan->start;chx>=(word)end;chx++) + //{ + //write(gvar->handle.showmemhandle,"_",1); + //} + //write(gvar->handle.showmemhandle,"\n",strlen("\n")); + strcat(scratch0,AABLACK); strcat(scratch0,0x10); + }*/ +//++++ VW_Hlin(x+end+1,x+(scan->next->start-scan->start),y,0); // black = free +write(gvar->handle.showmemhandle,scratch0,strlen(scratch0)); strcpy(scratch,"Seg:"); ultoa (scan->start,str,16); strcat (scratch,str); @@ -1352,7 +1359,6 @@ write(gvar->handle.debughandle,scratch,strlen(scratch)); //modexprint(page, chx, chy, 1, 0, 24, &scratch); //++++chy+=4; //fprintf(stdout, "%s", scratch); -//****#endif scan = scan->next; } @@ -1363,7 +1369,6 @@ CA_CloseDebug (gvar); //**** VW_SetLineWidth(64); //++++mh bufferofs = temp; } -//****#endif //========================================================================== @@ -1383,8 +1388,7 @@ void MM_DumpData(mminfo_t *mm) byte lock,purge; FILE *dumpfile; - - //++++free(mm->nearheap); + free(mm->nearheap); dumpfile = fopen ("mmdump.16","w"); if (!dumpfile){ printf("MM_DumpData: Couldn't open MMDUMP.16!\n"); diff --git a/src/lib/16_mm.h b/src/lib/16_mm.h index 2e012302..1ecca330 100644 --- a/src/lib/16_mm.h +++ b/src/lib/16_mm.h @@ -40,6 +40,12 @@ #define FREEBLOCK(x) {*x->useptr=NULL;x->next=mm->mmfree;mm->mmfree=x;mm->endid--;} +#define AAMAGENTA "\x1b[35;35m" +#define AABLUE "\x1b[34;34m" +#define AARED "\x1b[31;31m" +#define AABLACK "\x1b[40;40m" +#define AAWHITE "\x1b[37;37m" +#define AARESET "\x1b[0m" #define SAVENEARHEAP 0x200 // space to leave in data segment #define SAVEFARHEAP 0//x400 // space to leave in far heap diff --git a/src/lib/modex16.c b/src/lib/modex16.c index e5550b4c..b1e6d51f 100644 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -28,37 +28,37 @@ byte far* VGA=(byte far*) 0xA0000000; /* this points to video memory. */ static void fadePalette(sbyte fade, sbyte start, word iter, byte *palette); -static byte tmppal[PAL_SIZE]; +static byte tmppal[PAL_SIZE]; int old_mode; - -///////////////////////////////////////////////////////////////////////////// -// // -// setvideo() - This function Manages the video modes // -// // -///////////////////////////////////////////////////////////////////////////// -void VGAmodeX(sword vq) -{ - union REGS in, out; - - if(!vq) - { // deinit the video - // change to the video mode we were in before we switched to mode 13h - modexLeave(); - in.h.ah = 0x00; - in.h.al = old_mode; - int86(0x10, &in, &out); - - } - else if(vq==1) - { // init the video - // get old video mode - in.h.ah = 0xf; - int86(0x10, &in, &out); - old_mode = out.h.al; - // enter mode - modexEnter(); - } -} + +///////////////////////////////////////////////////////////////////////////// +// // +// setvideo() - This function Manages the video modes // +// // +///////////////////////////////////////////////////////////////////////////// +void VGAmodeX(sword vq) +{ + union REGS in, out; + + if(!vq) + { // deinit the video + // change to the video mode we were in before we switched to mode 13h + modexLeave(); + in.h.ah = 0x00; + in.h.al = old_mode; + int86(0x10, &in, &out); + + } + else if(vq==1) + { // init the video + // get old video mode + in.h.ah = 0xf; + int86(0x10, &in, &out); + old_mode = out.h.al; + // enter mode + modexEnter(); + } +} static void vgaSetMode(byte mode) @@ -677,7 +677,7 @@ modexPalWhite() { } -/* utility */ +/* utility */ void modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqoffset) { @@ -970,15 +970,15 @@ no... wait.... no wwww } void modexputPixel(page_t *page, int x, int y, byte color) -{ +{ word pageOff = (word) page->data; /* Each address accesses four neighboring pixels, so set Write Plane Enable according to which pixel we want to modify. The plane is determined by the two least - significant bits of the x-coordinate: */ - //modexSelectPlane(PLANE(x)); - outp(SC_INDEX, 0x02); - outp(SC_DATA, 0x01 << (x & 3)); + significant bits of the x-coordinate: */ + modexSelectPlane(PLANE(x)); + //outp(SC_INDEX, 0x02); + //outp(SC_DATA, 0x01 << (x & 3)); /* The offset of the pixel into the video segment is offset = (width * y + x) / 4, and write the given @@ -989,7 +989,7 @@ void modexputPixel(page_t *page, int x, int y, byte color) } byte modexgetPixel(page_t *page, int x, int y) -{ +{ word pageOff = (word) page->data; /* Select the plane from which we must read the pixel color: */ outpw(GC_INDEX, 0x04); @@ -997,63 +997,63 @@ byte modexgetPixel(page_t *page, int x, int y) return VGA[(unsigned)((page->width/4) * y) + (x / 4) + pageOff]; -} - -void modexhlin(page_t *page, word xl, word xh, word y, word color) -{ - word x; - word yy=0; - - for(x=0;x=SCREEN_WIDTH-1){ x=0; yy+=4; } - modexClearRegion(page, x+xl, y+yy, 4, 4, color); - } - //modexputPixel(page, x+xl, y, color); +} + +void modexhlin(page_t *page, word xl, word xh, word y, word color) +{ + word x; + word yy=0; + + for(x=0;x=SCREEN_WIDTH-1){ x=0; yy+=4; } + modexClearRegion(page, x+xl, y+yy, 4, 4, color); + } + //modexputPixel(page, x+xl, y, color); } void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str) -{ - word i, s, o, w, j, xp; +{ + word i, s, o, w, j, xp; byte l[1024]; - word addr = (word) l; - word chw=0; - byte c; - + word addr = (word) l; + word chw=0; + byte c; + switch(t) { - case 0: + case 0: w=14; break; - case 1: + case 1: w=8; break; - case 2: + case 2: w=8; break; - case 3: + case 3: w=16; break; - default: + default: t=3; w=16; break; - } + } s=romFonts[t].seg; - o=romFonts[t].off; + o=romFonts[t].off; for(; *str != '\0'; str++) - { - c = (*str); - if((c=='\n'/* || c=="\ -"*/) || chw ->=page->width) - { - chw=0; - y+=w; - continue; - } + { + c = (*str); + if((c=='\n'/* || c=="\ +"*/) || chw +>=page->width) + { + chw=0; + y+=w; + continue; + } //load the letter 'A' __asm { MOV DI, addr @@ -1070,64 +1070,64 @@ void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, cons INC DI DEC CX JNZ L1 - } + } - for(i=0; i>=1; - } + while(j) + { + modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol); + xp++; + j>>=1; + } } chw += xp; } -} - +} + void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str) -{ - word i, s, o, w, j, xp; +{ + word i, s, o, w, j, xp; byte l[1024]; - word addr = (word) l; - word chw=0; - byte c; - + word addr = (word) l; + word chw=0; + byte c; + switch(t) { - case 0: + case 0: w=14; break; - case 1: + case 1: w=8; break; - case 2: + case 2: w=8; break; - case 3: + case 3: w=16; break; - default: + default: t=3; w=16; break; - } + } s=romFonts[t].seg; - o=romFonts[t].off; + o=romFonts[t].off; for(; *str != '\0'; str++) - { - c = (*str); - if((c=='\n'/* || c=="\ -"*/)/* || chw>=page->width*/) - { - chw=0; - y+=w; - continue; - } + { + c = (*str); + if((c=='\n'/* || c=="\ +"*/)/* || chw>=page->width*/) + { + chw=0; + y+=w; + continue; + } //load the letter 'A' __asm { MOV DI, addr @@ -1144,19 +1144,19 @@ void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, c INC DI DEC CX JNZ L1 - } + } - for(i=0; i>=1; - } + while(j) + { + //modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol); + modexClearRegion(page, (x+xp+chw)*8, (y+i)*8, 8, 8, l[i] & j ? col:bgcol); + xp++; + j>>=1; + } } chw += xp; } diff --git a/test.exe b/test.exe index c2fb85a4..e14a2a44 100644 Binary files a/test.exe and b/test.exe differ diff --git a/test2.exe b/test2.exe index 1c8b210f..618ccf2c 100644 Binary files a/test2.exe and b/test2.exe differ