From: sparky4 Date: Fri, 23 Oct 2015 18:06:27 +0000 (-0500) Subject: pcxtest0 for planar dump test X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=d7ea637a201c3ca8847111d846b75f0ae3dc3e34;p=16.git pcxtest0 for planar dump test --- diff --git a/16.exe b/16.exe index 6cf1dd64..05529702 100755 Binary files a/16.exe and b/16.exe differ diff --git a/bakapi.exe b/bakapi.exe index 00764d7a..41f0d5d9 100755 Binary files a/bakapi.exe and b/bakapi.exe differ diff --git a/exmmtest.exe b/exmmtest.exe index bf2ec903..a5b14e70 100755 Binary files a/exmmtest.exe and b/exmmtest.exe differ diff --git a/fmemtest.exe b/fmemtest.exe index d2fbb904..23284457 100755 Binary files a/fmemtest.exe and b/fmemtest.exe differ diff --git a/fontgfx.exe b/fontgfx.exe index 25ee116d..5c0cbbfa 100755 Binary files a/fontgfx.exe and b/fontgfx.exe differ diff --git a/fonttest.exe b/fonttest.exe index 7bf6f43c..b59fddc9 100755 Binary files a/fonttest.exe and b/fonttest.exe differ diff --git a/inputest.exe b/inputest.exe index f529b881..0ea864fb 100755 Binary files a/inputest.exe and b/inputest.exe differ diff --git a/makefile b/makefile index d91dffb8..ff72a7f0 100755 --- a/makefile +++ b/makefile @@ -151,6 +151,9 @@ palettel.exe: palettel.$(OBJ) $(16LIBOBJS) gfx.lib pcxtest2.exe: pcxtest2.$(OBJ) gfx.lib wcl $(FLAGS) pcxtest2.$(OBJ) gfx.lib -fm=pcxtest2.map +pcxtest0.exe: pcxtest0.$(OBJ) gfx.lib + wcl $(FLAGS) pcxtest0.$(OBJ) gfx.lib -fm=pcxtest0.map + maptest.exe: maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib wcl $(FLAGS) maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib -fm=maptest.map @@ -192,6 +195,9 @@ test2.$(OBJ): $(SRC)test2.c $(SRCLIB)modex16.h pcxtest.$(OBJ): $(SRC)pcxtest.c $(SRCLIB)modex16.h wcl $(FLAGS) -c $(SRC)pcxtest.c +pcxtest0.$(OBJ): $(SRC)pcxtest0.c $(SRCLIB)modex16.h + wcl $(FLAGS) -c $(SRC)pcxtest0.c + pcxtest2.$(OBJ): $(SRC)pcxtest2.c $(SRCLIB)modex16.h wcl $(FLAGS) -c $(SRC)pcxtest2.c diff --git a/maptest.exe b/maptest.exe index fb045bf1..44142561 100755 Binary files a/maptest.exe and b/maptest.exe differ diff --git a/palettec.exe b/palettec.exe index 6040b6fd..655a308f 100755 Binary files a/palettec.exe and b/palettec.exe differ diff --git a/palettel.exe b/palettel.exe index e4c5ad1f..a1339ce8 100755 Binary files a/palettel.exe and b/palettel.exe differ diff --git a/pcxtest.exe b/pcxtest.exe index 1fe9a5a2..338d1f0a 100755 Binary files a/pcxtest.exe and b/pcxtest.exe differ diff --git a/pcxtest2.exe b/pcxtest2.exe index ba1ce313..fd899f5b 100755 Binary files a/pcxtest2.exe and b/pcxtest2.exe differ diff --git a/scroll.exe b/scroll.exe index a5d7b73e..66d711e6 100755 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/src/lib/16_head.h b/src/lib/16_head.h index 5db7e3f4..941069c2 100755 --- a/src/lib/16_head.h +++ b/src/lib/16_head.h @@ -172,6 +172,16 @@ typedef void __based(__self) * memptr; typedef void _seg * memptr; #endif +#define AARED "\x1b[41;31m" +#define AABLUE "\x1b[44;34m" +#define AAGREEN "\x1b[42;32m" +#define AAYELLOW "\x1b[43;33m" +#define AAGREY "\x1b[47;37m" +#define AABLACK "\x1b[40;30m" +#define AAWHITE "\x1b[47;37m" +#define AAMAGENTA "\x1b[45;35m" +#define AARESET "\x1b[0m" + /* local function */ void wait(clock_t wait); diff --git a/src/lib/16_mm.h b/src/lib/16_mm.h index 23daa0bb..de35b428 100755 --- a/src/lib/16_mm.h +++ b/src/lib/16_mm.h @@ -39,16 +39,6 @@ #define FREEBLOCK(x) {*x->useptr=NULL;x->next=mm->mmfree;mm->mmfree=x;} -#define AARED "\x1b[41;31m" -#define AABLUE "\x1b[44;34m" -#define AAGREEN "\x1b[42;32m" -#define AAYELLOW "\x1b[43;33m" -#define AAGREY "\x1b[47;37m" -#define AABLACK "\x1b[40;30m" -#define AAWHITE "\x1b[47;37m" -#define AAMAGENTA "\x1b[45;35m" -#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 b8e603bb..9403ce7c 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -115,14 +115,14 @@ modexEnter(sword vq, global_game_variables_t *gv) } break; case 2: - CRTParmCount = sizeof(ModeX_192x144regs) / sizeof(ModeX_192x144regs[0]); + CRTParmCount = sizeof(ModeX_160x120regs) / sizeof(ModeX_160x120regs[0]); /* width and height */ - gv->video.page[0].sw=192; - gv->video.page[0].sh=144; + gv->video.page[0].sw=120; + gv->video.page[0].sh=160; /* send the CRTParms */ for(i=0; ivideo.page[0].sw=192; + gv->video.page[0].sh=144; + + /* send the CRTParms */ + for(i=0; i 30 -#endif /*_SMALLMODEXRESS_H_*/ +#endif /*_SMALLMODEXREST_H_*/ /*#include "TwkUser.h" // get Register definition Register 192x144[] = { diff --git a/src/lib/modex16/192x144.h b/src/lib/modex16/192x144.h index a6f645e6..8271a0db 100755 --- a/src/lib/modex16/192x144.h +++ b/src/lib/modex16/192x144.h @@ -20,8 +20,8 @@ * */ -#ifndef _SMALLMODEXRES_H_ -#define _SMALLMODEXRES_H_ +#ifndef _SMALLMODEXRESS_H_ +#define _SMALLMODEXRESS_H_ #include "src/lib/types.h" @@ -55,12 +55,12 @@ };*/ static const word ModeX_192x144regs[] = { - 0x5f00, /* Horizontal total */ - 0x2f01, /* horizontal display enable end */ - 0x5002, /* Start horizontal blanking */ - 0x8203, /* End horizontal blanking */ - 0x5404, /* Start horizontal retrace */ - 0x8005, /* End horizontal retrace */ + 0x3f00, /* Horizontal total */ + 0x2701, /* horizontal display enable end */ + 0x3002, /* Start horizontal blanking */ + 0x0003, /* End horizontal blanking */ + 0x3404, /* Start horizontal retrace */ + 0x4805, /* End horizontal retrace */ 0x0d06, /* vertical total */ 0x3e07, /* overflow (bit 8 of vertical counts) */ 0x4109, /* cell height (2 to double-scan */ @@ -74,17 +74,16 @@ static const word ModeX_192x144regs[] = { 0xe317 /* turn on byte mode */ };//50 => 30 -#endif /*_SMALLMODEXRES_H_*/ -/* -192x144[] = +#endif /*_SMALLMODEXRESS_H_*/ +/*#include "TwkUser.h" // get Register definition +Register 192x144[] = { - { 0x3c2, 0x0, 0xe3}, { 0x3d4, 0x0, 0x3f}, { 0x3d4, 0x1, 0x2f}, - { 0x3d4, 0x2, 0x50}, - { 0x3d4, 0x3, 0x82}, - { 0x3d4, 0x4, 0x54}, - { 0x3d4, 0x5, 0x80}, + { 0x3d4, 0x2, 0x30}, + { 0x3d4, 0x3, 0x0}, + { 0x3d4, 0x4, 0x34}, + { 0x3d4, 0x5, 0x48}, { 0x3d4, 0x6, 0xd}, { 0x3d4, 0x7, 0x3e}, { 0x3d4, 0x8, 0x0}, @@ -102,6 +101,6 @@ static const word ModeX_192x144regs[] = { { 0x3ce, 0x5, 0x40}, { 0x3ce, 0x6, 0x5}, { 0x3c0, 0x10, 0x41}, + { 0x3c0, 0x11, 0xe}, { 0x3c0, 0x13, 0x0} - }; -*/ + };*/ diff --git a/src/lib/modex16/192x144_.h b/src/lib/modex16/192x144_.h index fc5a764d..a6f645e6 100755 --- a/src/lib/modex16/192x144_.h +++ b/src/lib/modex16/192x144_.h @@ -20,8 +20,8 @@ * */ -#ifndef _SMALLMODEXRESS_H_ -#define _SMALLMODEXRESS_H_ +#ifndef _SMALLMODEXRES_H_ +#define _SMALLMODEXRES_H_ #include "src/lib/types.h" @@ -55,12 +55,12 @@ };*/ static const word ModeX_192x144regs[] = { - 0x3f00, /* Horizontal total */ + 0x5f00, /* Horizontal total */ 0x2f01, /* horizontal display enable end */ - 0x3002, /* Start horizontal blanking */ - 0x0003, /* End horizontal blanking */ - 0x3404, /* Start horizontal retrace */ - 0x4805, /* End horizontal retrace */ + 0x5002, /* Start horizontal blanking */ + 0x8203, /* End horizontal blanking */ + 0x5404, /* Start horizontal retrace */ + 0x8005, /* End horizontal retrace */ 0x0d06, /* vertical total */ 0x3e07, /* overflow (bit 8 of vertical counts) */ 0x4109, /* cell height (2 to double-scan */ @@ -74,16 +74,17 @@ static const word ModeX_192x144regs[] = { 0xe317 /* turn on byte mode */ };//50 => 30 -#endif /*_SMALLMODEXRESS_H_*/ -/*#include "TwkUser.h" // get Register definition -Register 192x144[] = +#endif /*_SMALLMODEXRES_H_*/ +/* +192x144[] = { + { 0x3c2, 0x0, 0xe3}, { 0x3d4, 0x0, 0x3f}, { 0x3d4, 0x1, 0x2f}, - { 0x3d4, 0x2, 0x30}, - { 0x3d4, 0x3, 0x0}, - { 0x3d4, 0x4, 0x34}, - { 0x3d4, 0x5, 0x48}, + { 0x3d4, 0x2, 0x50}, + { 0x3d4, 0x3, 0x82}, + { 0x3d4, 0x4, 0x54}, + { 0x3d4, 0x5, 0x80}, { 0x3d4, 0x6, 0xd}, { 0x3d4, 0x7, 0x3e}, { 0x3d4, 0x8, 0x0}, @@ -101,6 +102,6 @@ Register 192x144[] = { 0x3ce, 0x5, 0x40}, { 0x3ce, 0x6, 0x5}, { 0x3c0, 0x10, 0x41}, - { 0x3c0, 0x11, 0xe}, { 0x3c0, 0x13, 0x0} - };*/ + }; +*/ diff --git a/src/pcxtest0.c b/src/pcxtest0.c new file mode 100755 index 00000000..f5efc3c7 --- /dev/null +++ b/src/pcxtest0.c @@ -0,0 +1,143 @@ +/* Project 16 Source Code~ + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include +#include "src/lib/modex16.h" +#include "src/lib/bitmap.h" +#include "src/lib/planar.h" + +global_game_variables_t gvar; + +/* +void +DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite) +{ + byte plane; + word px, py; + word offset; + + // TODO Make this fast. It's SLOOOOOOW + for(plane=0; plane < 4; plane++) { + modexSelectPlane(PLANE(plane+x)); + for(px = plane; px < p->width; px+=4) { + offset=px; + for(py=0; pyheight/2; py++) { + SELECT_ALL_PLANES(); + if(!sprite || p->plane[offset]) + page->data = p->plane; + //offset+=p->width; + //offset++; + } + } + } +} +*/ + +void main() { + bitmap_t bmp; + planar_buf_t *p; + int i; + word start; + int plane; + float t1, t2; + +//0000 bmp = bitmapLoadPcx("data/koishi~~.pcx"); +// bmp = bitmapLoadPcx("data/chikyuu.pcx"); + bmp = bitmapLoadPcx("data/koishi^^.pcx"); +// bmp = bitmapLoadPcx("16/PCX_LIB/chikyuu.pcx"); + p = planar_buf_from_bitmap(&bmp); + VGAmodeX(1, &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); + + /* clear and draw one sprite and one bitmap */ + modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 1); + + /* update display~*/ + gvar.video.page[0].dx+=16; + gvar.video.page[0].dy+=16; + modexShowPage(&gvar.video.page[0]); + + /* non sprite comparison */ + start = *clockw; + //for(i=0; i<100 ;i++) { + oldDrawBmp(VGA, 20, 20, &bmp, 0); + //} + + start = *clockw; + //for(i=0; i<100 ;i++) { +//0000 modexDrawBmp(&gvar.video.page[0], 20, 20, &bmp); + modexDrawBmp(&gvar.video.page[0], 160, 120, &bmp); + //} + t1 = (*clockw-start) /18.2; + + start = *clockw; + //for(i=0; i<100; i++) { +//0000 modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 20, 20, 128, 20, 64, 64); + modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240); + //} + t2 = (*clockw-start)/18.2; + + + start = *clockw; + //for(i=0; i<100 ;i++) { + oldDrawBmp(VGA, 20, 20, &bmp, 1); + //} + + + start = *clockw; + //for(i=0; i<100 ;i++) { +//0000 modexDrawSprite(&gvar.video.page[0], 20, 20, &bmp); + modexDrawSprite(&gvar.video.page[0], 160, 120, &bmp); + //} + //_fmemset(MK_FP(0xA000, 0), (int)p->plane, gvar.video.page[0].sw*(gvar.video.page[0].sh*2)); + //modexDrawBmp(&gvar.video.page[0], 0, 0, &bmp); + while(!kbhit()) + { + //DrawPBuf(&gvar.video.page[0], 0, 0, p, 0); + } + VGAmodeX(0, &gvar); + /*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)); + + printf("\n%d\n", sizeof(p->plane)); + printf("%d\n", sizeof(bmp));*/ + + /*for(i=0; i<(320*240); i++) + { + fprintf(stdout, "%d", bmp.data[i]); + if(i%bmp.width==0) fprintf(stdout, "\n"); + }*/ + printf("CPU to VGA: %f\n", t1); + printf("VGA to VGA: %f\n", t2); + printf("gvar.video.page[0].width: %u\n", gvar.video.page[0].width); + printf("gvar.video.page[0].height: %u\n", gvar.video.page[0].height); + return; +} diff --git a/test.exe b/test.exe index a3d4a590..3b6a8510 100755 Binary files a/test.exe and b/test.exe differ diff --git a/test2.exe b/test2.exe index 0d3af2a4..33a72c85 100755 Binary files a/test2.exe and b/test2.exe differ diff --git a/tesutobakapee.exe b/tesutobakapee.exe index 4e0a1ea5..e667a143 100755 Binary files a/tesutobakapee.exe and b/tesutobakapee.exe differ diff --git a/vgmtest.exe b/vgmtest.exe index f0bd57fe..ddce9f04 100755 Binary files a/vgmtest.exe and b/vgmtest.exe differ