X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fpcxtest.c;h=f735a5597e2561044f64406e85cd453c41e314cd;hb=db81338f404ddb19d4bda245f7b563b42d4e3b4e;hp=e2c133cbc7f0ec79698e770541c2d6ff7b1d9871;hpb=f66b2c6a16e6f6c2c9c07a39d1855b5ea178fead;p=16.git diff --git a/src/pcxtest.c b/src/pcxtest.c index e2c133cb..f735a559 100644 --- a/src/pcxtest.c +++ b/src/pcxtest.c @@ -1,6 +1,9 @@ -#include +#include +#include +#include #include "src\lib\modex16.h" -#include "src\lib\bitmap.h" +#include "src\lib\bitmap.h" +#include "src\lib\planar.c" word far* clock= (word far*) 0x046C; /* 18.2hz clock */ @@ -22,27 +25,55 @@ oldDrawBmp(byte far* page, int x, int y, bitmap_t *bmp, byte sprite) { } } } +} + +/* +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; + bitmap_t bmp; + planar_buf_t *p; int i; page_t page; - word start; + word start; + int plane; float t1, t2; page=modexDefaultPage(); - bmp = bitmapLoadPcx("data\46113319.pcx"); + bmp = bitmapLoadPcx("data/koishi~~.pcx"); + p = planar_buf_from_bitmap(&bmp); modexEnter(); /* fix up the palette and everything */ - modexPalUpdate(bmp.palette); + modexPalUpdate(&bmp, 0, 0, 0); /* clear and draw one sprite and one bitmap */ modexClearRegion(&page, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 1); - /* non sprite comparison */ + /* non sprite comparison */ start = *clock; for(i=0; i<100 ;i++) { oldDrawBmp(VGA, 20, 20, &bmp, 0); @@ -70,9 +101,16 @@ void main() { start = *clock; for(i=0; i<100 ;i++) { modexDrawSprite(&page, 20, 20, &bmp); - } + } + //_fmemset(MK_FP(0xA000, 0), (int)p->plane, SCREEN_WIDTH*(SCREEN_HEIGHT*2)); + while(!kbhit()) + { + //DrawPBuf(&page, 0, 0, p, 0); + } modexLeave(); - + + printf("\n%d\n", sizeof(p->plane)); + printf("%d\n", sizeof(bmp)); printf("CPU to VGA: %f\n", t1); printf("VGA to VGA: %f\n", t2); return;