From: sparky4 Date: Fri, 23 Oct 2015 21:21:04 +0000 (-0500) Subject: ok planar buffer dump somewhat works X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=3c814ec6432e3ba48f8d3ec7a374b2bd296efbec;p=16.git ok planar buffer dump somewhat works --- diff --git a/16.exe b/16.exe index 637f3400..8709ad37 100755 Binary files a/16.exe and b/16.exe differ diff --git a/exmmtest.exe b/exmmtest.exe index 014545ab..0cf4e7e6 100755 Binary files a/exmmtest.exe and b/exmmtest.exe differ diff --git a/planrpcx.exe b/planrpcx.exe index 49ed2d23..03ef92cb 100755 Binary files a/planrpcx.exe and b/planrpcx.exe differ diff --git a/scroll.exe b/scroll.exe index e9867d07..38953b73 100755 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/src/lib/planar.h b/src/lib/planar.h index 9e003d4c..af8c5bf4 100755 --- a/src/lib/planar.h +++ b/src/lib/planar.h @@ -23,18 +23,21 @@ * Functions and types for a planar image buffer. * This is meant to be able to load into video memory faster. */ -#include "src/lib/bitmap.h" - #ifndef PLANAR_H #define PLANAR_H + +#include "src/lib/bitmap.h" +#include "src/lib/16_ca.h" +#include "src/lib/16_mm.h" +#include "src/lib/16_hc.h" + typedef struct { - byte huge *plane[4]; /* 4 planes of image data */ - word width; /* width of the image (spread across 4 planes) */ - word height; /* height of the image (spread across 4 planes) */ - word pwidth; /* the number of bytes in each plane */ + byte huge *plane[4]; /* 4 planes of image data */ + word width; /* width of the image (spread across 4 planes) */ + word height; /* height of the image (spread across 4 planes) */ + word pwidth; /* the number of bytes in each plane */ } planar_buf_t; - /* creates a planar buffer from the bitmap data. The planar buffer is dynamically allocated, and should be destroyed with the planar_buf_free function when no longer @@ -42,11 +45,9 @@ typedef struct { */ planar_buf_t *planar_buf_from_bitmap(bitmap_t *b); - /* allocates a planar buffer with specified dimensions */ planar_buf_t *planar_buf_alloc(word width, word height); - /* deallocates a planar buffer */ void planar_buf_free(planar_buf_t *p); #endif diff --git a/src/planrpcx.c b/src/planrpcx.c index dc36d283..da238f93 100755 --- a/src/planrpcx.c +++ b/src/planrpcx.c @@ -32,10 +32,8 @@ global_game_variables_t gvar; void DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite) { - word plane; + int plane; int px, py, i; -// word offset = (word) page->data; - px=x; py=y; // TODO Make this fast. It's SLOOOOOOW @@ -53,18 +51,13 @@ DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite) // } // } // } -// z=0; for(plane=0; plane < 4; plane++) { - //modexputPixel(page, 120, 90+z, z+1); - //z++; i=0; modexSelectPlane(PLANE(plane+x)); - //modexSelectPlane(plane); for(; y < p->height; y++) { //for(px=0; px < p->width; px++) { //printf("%02X ", (int) p->plane[plane][i++]); - strncpy(page->data + (((page->width/4) * (y+page->dy)) + ((x+page->dx) / 4)) -,&(p->plane[plane][i+=p->pwidth]), p->pwidth); + _fstrncpy(page->data + (((page->width/4) * (y+page->dy)) + ((x+page->dx) / 4)), &(p->plane[plane][i+=p->pwidth]), p->pwidth); //} } //getch(); @@ -101,8 +94,6 @@ baka = 1; p = planar_buf_from_bitmap(&bmp); VGAmodeX(baka, &gvar); gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]); -// gvar.video.page[0].sw+=32; -// gvar.video.page[0].sh+=32; /* fix up the palette and everything */ modexPalUpdate1(bmp.palette); @@ -141,14 +132,13 @@ baka = 1; //if(argv[2]) pee = strcpy(VGA, &(p->plane[plane][24])); }//gvar.video.page[0].data VGAmodeX(0, &gvar); - planar_buf_free(p); /*printf("\nmain=%Fp\n\n", &i); printf("bmp.data=%Fp\n", bmp.data); printf("*bmp.data=%Fp\n", *(bmp.data)); printf("&bmp.data=%Fp\n", &(bmp.data));*/ /* print out the contents of each plane */ - /*for(plane=0; plane < 4; plane++) { + for(plane=0; plane < 4; plane++) { i=0; printf("Plane %d\n", plane); for(py=0; py < p->height; py++) { @@ -157,12 +147,13 @@ baka = 1; } printf("\n"); } - }*/ + } fprintf(stderr,"\n%d\n", sizeof(p->plane)); fprintf(stderr,"pw=%d\n", p->width); fprintf(stderr,"ph=%d\n", p->height); fprintf(stderr,"ppw=%d\n", p->pwidth); fprintf(stderr,"%d\n", sizeof(bmp)); + planar_buf_free(p); // fprintf(stderr,"%s\n", *pee); // fprintf(stderr, "CPU to VGA: %f\n", t1); // fprintf(stderr, "VGA to VGA: %f\n", t2); diff --git a/test.exe b/test.exe index 18c1d770..b5ea2dcd 100755 Binary files a/test.exe and b/test.exe differ