From: sparky4 Date: Fri, 6 Nov 2015 00:25:08 +0000 (-0600) Subject: eh... X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=ef6299431f115ac663324d55ffb64570a2e66258;p=16.git eh... --- diff --git a/16.exe b/16.exe index 34b67ab5..77b1a430 100755 Binary files a/16.exe and b/16.exe differ diff --git a/bakapi.exe b/bakapi.exe index 0c3cdab9..ac161f8c 100755 Binary files a/bakapi.exe and b/bakapi.exe differ diff --git a/exmmtest.exe b/exmmtest.exe index abc81244..a5b7a5f2 100755 Binary files a/exmmtest.exe and b/exmmtest.exe differ diff --git a/fmemtest.exe b/fmemtest.exe index 0129d453..f9f137f9 100755 Binary files a/fmemtest.exe and b/fmemtest.exe differ diff --git a/fontgfx.exe b/fontgfx.exe index 4efeb74b..0059951a 100755 Binary files a/fontgfx.exe and b/fontgfx.exe differ diff --git a/fonttest.exe b/fonttest.exe index cc97491c..1cb340c7 100755 Binary files a/fonttest.exe and b/fonttest.exe differ diff --git a/inputest.exe b/inputest.exe index 64acc519..ee9f5ae1 100755 Binary files a/inputest.exe and b/inputest.exe differ diff --git a/makefile b/makefile index 7135b965..cf7ce427 100755 --- a/makefile +++ b/makefile @@ -59,7 +59,7 @@ WCPULIB=$(SRCLIB)wcpu$(DIRSEP) 16FLAGS=-fh=16.hed BAKAPIFLAGS=-fh=bakapi.hed -SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k56000#60000#32768 +SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k56832#60000#32768 DFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1 $(SFLAGS) ZFLAGS=-zk0 -zq -zc -zp8# -zm CFLAGS=$(IFLAGS) -mh -lr -l=dos -wo# -d2##wwww @@ -72,7 +72,7 @@ DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ) 16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) 16_ca.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) timer.$(OBJ) # #3812intf.$(OBJ) -GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) planar.$(OBJ) 16planar.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) +GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) planar.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) 16planar.$(OBJ) TESTEXEC = exmmtest.exe test.exe pcxtest.exe pcxtest2.exe test2.exe palettec.exe maptest.exe fmemtest.exe fonttest.exe fontgfx.exe scroll.exe vgmtest.exe inputest.exe palettel.exe planrpcx.exe # tsthimem.exe diff --git a/maptest.exe b/maptest.exe index 9908b0be..52f66585 100755 Binary files a/maptest.exe and b/maptest.exe differ diff --git a/palettec.exe b/palettec.exe index 2363132c..d404ae15 100755 Binary files a/palettec.exe and b/palettec.exe differ diff --git a/palettel.exe b/palettel.exe index 1885f391..6d664006 100755 Binary files a/palettel.exe and b/palettel.exe differ diff --git a/pcxtest.exe b/pcxtest.exe index 5a3991f1..9bbd7e12 100755 Binary files a/pcxtest.exe and b/pcxtest.exe differ diff --git a/pcxtest2.exe b/pcxtest2.exe index d704d6fc..b1c39e31 100755 Binary files a/pcxtest2.exe and b/pcxtest2.exe differ diff --git a/planrpcx.exe b/planrpcx.exe index c39db0bb..1bb9b57e 100755 Binary files a/planrpcx.exe and b/planrpcx.exe differ diff --git a/scroll.exe b/scroll.exe index 1d2ed371..2870d11f 100755 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/src/lib/bitmap.c b/src/lib/bitmap.c index ae750383..4f25bbd4 100755 --- a/src/lib/bitmap.c +++ b/src/lib/bitmap.c @@ -25,29 +25,6 @@ #include #include "src/lib/bitmap.h" -#ifndef PCXHEADER_H -#define PCXHEADER_H -static struct pcxHeader { - byte id; - byte version; - byte encoding; - byte bpp; - word xmin; - word ymin; - word xmax; - word ymax; - word hres; - word vres; - byte pal16[48]; - byte res1; - word bpplane; - word palType; - word hScreenSize; - word vScreenSize; - byte padding[54]; -} head; -#endif /*PCXHEADER_H*/ - static void loadPcxStage1(FILE *file, bitmap_t *result) { long bufSize; int index; @@ -149,6 +126,7 @@ bitmapLoadPcx(char *filename) { result.data[index] = val; } } while(index < bufSize); + printf("index=%d\n", index); loadPcxPalette(file, &result); diff --git a/src/lib/modex16.h b/src/lib/modex16.h index b5ca74b1..f4a07ad4 100755 --- a/src/lib/modex16.h +++ b/src/lib/modex16.h @@ -26,7 +26,6 @@ #define MODEX16_H //#include -#include "src/lib/types.h" #include "src/lib/16_head.h" #include "src/lib/bitmap.h" #include "src/lib/planar.h" @@ -39,6 +38,26 @@ #include "src/lib/modex16/192x144_.h" #include "src/lib/modex16/160x120.h" +static struct pcxHeader { + byte id; + byte version; + byte encoding; + byte bpp; + word xmin; + word ymin; + word xmax; + word ymax; + word hres; + word vres; + byte pal16[48]; + byte res1; + word bpplane; + word palType; + word hScreenSize; + word vScreenSize; + byte padding[54]; +} head; + //320x240 = 20x15 //192x144 = 12x9 diff --git a/src/lib/modex16/16planar.c b/src/lib/modex16/16planar.c index 4c5c2578..833db3f8 100755 --- a/src/lib/modex16/16planar.c +++ b/src/lib/modex16/16planar.c @@ -25,46 +25,31 @@ #include #include "src/lib/modex16/16planar.h" -#ifndef PCXHEADER_H -#define PCXHEADER_H -static struct pcxHeader { - byte id; - byte version; - byte encoding; - byte bpp; - word xmin; - word ymin; - word xmax; - word ymax; - word hres; - word vres; - byte pal16[48]; - byte res1; - word bpplane; - word palType; - word hScreenSize; - word vScreenSize; - byte padding[54]; -} head; -#endif /*PCXHEADER_H*/ +/* + *============================================================================ + */ static void loadPcxpbufStage1(FILE *file, planar_buf_t *result) { int index; byte count, val; long int pos; +//word w=0; +//fprintf(stderr, "\nplanarLoadPcx: "); +//fprintf(stderr, "%u ", w++); /* read the header */ fread(&head, sizeof(char), sizeof(struct pcxHeader), file); - +//fprintf(stderr, "%u ", w++); /* get the width and height */ result->width = head.xmax - head.xmin + 1; result->height = head.ymax - head.ymin + 1; - + result->pwidth = result->width / 4 + (result->width%4 ? 1 : 0); +//fprintf(stderr, "%u ", w++); /* make sure this is 8bpp */ if(head.bpp != 8) { fprintf(stderr, "I only know how to handle 8bpp pcx files!\n"); fclose(file); - //exit(-2); + exit(-2); } } @@ -90,37 +75,92 @@ static void loadPcxpbufPalette(FILE *file, planar_buf_t *result) { } } +/* allocates a planar buffer with specified dimensions */ +planar_buf_t +pbuf_alloc(word width, word height) { + planar_buf_t p; + int i; + + /* allocate the structure and populate sizes */ + //p=malloc(sizeof(planar_buf_t)); + p.width = width; + p.height = height; + p.pwidth = width / 4 + (width%4 ? 1 : 0); + //p.pwidth = width / 4 + (width%4 ? 1 : 0); + + /* allocate the planes */ + for(i=0; i<4; i++) { + p.plane[i] = _fmalloc(p.height * p.pwidth); + } + + return p; +} + +/* allocates a planar buffer with specified dimensions */ +void +pbuf_alloc0(planar_buf_t *p, word width, word height) { + int i; + + /* allocate the structure and populate sizes */ + //p=malloc(sizeof(planar_buf_t)); + p->width = width; + p->height = height; + p->pwidth = width / 4 + (width%4 ? 1 : 0); + //p.pwidth = width / 4 + (width%4 ? 1 : 0); + + /* allocate the planes */ + for(i=0; i<4; i++) { + p->plane[i] = _fmalloc(p->height * p->pwidth); + } +} + /* sparky4's functions~ */ planar_buf_t planarLoadPcx(char *filename) { FILE *file; planar_buf_t result; dword bufSize; - int index, plane, x, y; + int index[4], plane; byte count, val; - word q; +word w=0; +fprintf(stderr, "\nplanarLoadPcx: "); +fprintf(stderr, "%u ", w++); /* open the PCX file for reading */ file = fopen(filename, "rb"); +//fprintf(stderr, "%u ", w++); if(!file) { fprintf(stderr, "Could not open %s for reading.\n", filename); - //exit(-2); + exit(-2); } - +//fprintf(stderr, "%u ", w++); /* load the first part of the pcx file */ loadPcxpbufStage1(file, &result); - +//fprintf(stderr, "%u ", w++); /* allocate the buffer */ bufSize = (/*(dword)*/result.width * result.height); - //result = pbuf_alloc(result.width, result.height); - if(!result.plane[0]) { + result = pbuf_alloc(result.width, result.height); + //pbuf_alloc0(&result, result.width, result.height); +//fprintf(stderr, "%u ", w++); + printf("&bufSize=%p\n", &bufSize); + printf("&result.data=%p\n", result.plane); + printf("Size of block is %zu bytes\n", _msize(result.plane)); + printf("Size of bufSize is %zu bytes\n", bufSize); + printf("Size of result.width is %zu \n", result.width); + printf("Size of result.height is %zu \n", result.height); + printf("Dimensions of result is %lu\n", (dword)result.width*result.height); + //exit(0); + if(!result.plane) { fprintf(stderr, "Could not allocate memory for bitmap data."); fclose(file); - //exit(-1); + exit(-1); } - +fprintf(stderr, "read the buffer? %u ", w++); +getch(); /* read the buffer in */ - index = 0; + index[0] = 0,index[1]=0,index[2]=0,index[3]=0; + /* start on the first plane */ + plane=0; do { /* get the run length and the value */ count = fgetc(file); @@ -132,21 +172,28 @@ planar_buf_t planarLoadPcx(char *filename) count = 1; } - // start on the first plane - plane=0; /* write the pixel the specified number of times */ - for(; count && index < bufSize; count--,index++) { +//fprintf(stderr, "\nputting in memory~ %u\n", w++); +//if(index>=49152) getch(); + for(; count && (index[0]+index[1]+index[2]+index[3]) < bufSize; count--,index[plane]++) { +//fprintf(stderr, "count=%d index=%d plane=%d\n", count, index, plane); switch (plane) { case 4: plane=0; break; + case 0: + case 1: + case 2: + plane++; + break; } + //fprintf(stderr, "%d ", result.plane[plane][(index[0]+index[1]+index[2]+index[3])]); // copy to each plane - result.plane[plane++][index]=val; + result.plane[plane++][index[plane]]=val; } - } while(index < bufSize); - + } while((index[0]+index[1]+index[2]+index[3]) < bufSize); + getch(); //++++loadPcxpbufPalette(file, &result); fclose(file); return result; diff --git a/src/lib/planar.c b/src/lib/planar.c index 38e4eb7b..c15c39c5 100755 --- a/src/lib/planar.c +++ b/src/lib/planar.c @@ -87,7 +87,7 @@ planar_buf_alloc(word width, word height) { /* allocate the planes */ for(i=0; i<4; i++) { - p->plane[i] = malloc(p->height * p->pwidth); + p->plane[i] = malloc(p->height * p->pwidth); } return p; diff --git a/src/lib/planar.h b/src/lib/planar.h index 821f4763..c4b67307 100755 --- a/src/lib/planar.h +++ b/src/lib/planar.h @@ -28,8 +28,6 @@ #include "src/lib/modex16.h" -extern byte *modexNewPal(); - /* 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 @@ -43,5 +41,4 @@ planar_buf_t huge *planar_buf_alloc(word width, word height); /* deallocates a planar buffer */ void planar_buf_free(planar_buf_t *p); - #endif diff --git a/src/lib/typdefst.h b/src/lib/typdefst.h index 2e1cd488..9f4936b9 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -56,7 +56,7 @@ typedef struct { } tileset_t; typedef struct { - byte huge *plane[4]; /* 4 planes of image data */ + byte far *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 */ diff --git a/src/planrpcx.c b/src/planrpcx.c index 11d8d5dd..92113cc7 100755 --- a/src/planrpcx.c +++ b/src/planrpcx.c @@ -26,23 +26,24 @@ #include "src/lib/modex16.h" global_game_variables_t gvar; -planar_buf_t huge p, ptmp; +planar_buf_t p, ptmp; +int i; +word start;//, w; +int plane; +float t1, t2, tpee; +int x,y; +word px,py; +sword baka; +char *bakapeee; void main(int argc, char *argv[]) { - int i; - word start; - int plane; - float t1, t2, tpee; - int x,y; - word px,py; - sword baka; - char *bakapeee; - byte l[1024]; + //byte l[1024]; word j,chw,xp,col,bgcol; - +//w=0; +//printf("%u ", w++); bakapeee = malloc(64); if(argv[1]) bakapeee = argv[1]; @@ -51,10 +52,15 @@ void main(int argc, char *argv[]) // if(argv[2]) baka = atoi(argv[2]); // else baka = 1; - +//fprintf(stderr, "%u ", w++); p = planarLoadPcx(bakapeee); - ptmp = planarLoadPcx("data/ptmp.pcx"); -/* VGAmodeX(baka, &gvar); +//fprintf(stderr, "%u ", w++); +// ptmp = planarLoadPcx("data/ptmp.pcx"); +//fprintf(stderr, "%u ", w++); +//fprintf(stderr, "^^;", w++); +//getch(); + + VGAmodeX(baka, &gvar); gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]); //fix up the palette and everything @@ -91,7 +97,7 @@ baka = 1; while(!kbhit()) { } - VGAmodeX(0, &gvar);*/ + VGAmodeX(0, &gvar); //print out the contents of each plane for(plane=0; plane < 4; plane++) { @@ -105,7 +111,8 @@ baka = 1; } } col=0x0d, bgcol=0; - /*for(i=0; i<8; i++) + /* + for(i=0; i<8; i++) { //modexSelectPlane(PLANE(x)); //j=1<<8; @@ -127,18 +134,16 @@ baka = 1; chw += xp; fprintf(stderr,"Project 16 planrpcx.exe. This is just a test file!\n"); fprintf(stderr,"version %s\n", VERSION); - fprintf(stderr,"%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(p)); - fprintf(stderr,"%dx%d\n", gvar.video.page[0].sw-(p.width), gvar.video.page[0].sh-(p.height)); - //planar_buf_free(p); + //fprintf(stderr,"%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(p)); + //fprintf(stderr,"%dx%d\n", gvar.video.page[0].sw-(p.width), gvar.video.page[0].sh-(p.height)); free(bakapeee); - fprintf(stderr, "modexDrawBmpPBuf: %f\n", t1); - fprintf(stderr, "modexDrawPBuf: %f\n", t2); - fprintf(stderr, "speed difference %f\n", t2/t1); - fprintf(stderr, "gvar.video.page[0].width: %u\n", gvar.video.page[0].width); - fprintf(stderr, "gvar.video.page[0].height: %u\n", gvar.video.page[0].height); - return; + //fprintf(stderr, "modexDrawBmpPBuf: %f\n", t1); + //fprintf(stderr, "modexDrawPBuf: %f\n", t2); + //fprintf(stderr, "speed difference %f\n", t2/t1); + //fprintf(stderr, "gvar.video.page[0].width: %u\n", gvar.video.page[0].width); + //fprintf(stderr, "gvar.video.page[0].height: %u\n", gvar.video.page[0].height); } diff --git a/test.exe b/test.exe index f0c5f918..ea3e01b8 100755 Binary files a/test.exe and b/test.exe differ diff --git a/test2.exe b/test2.exe index 3fb7194c..886eb317 100755 Binary files a/test2.exe and b/test2.exe differ diff --git a/vgmtest.exe b/vgmtest.exe index 3b870111..343c65b4 100755 Binary files a/vgmtest.exe and b/vgmtest.exe differ