X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fpcxtest.c;h=7e10a95850cbd677f2819d33fcf85c9edbcfa3b7;hb=e0822f1d126fdc00b5fb8e1de1b84ef0f8f75a4a;hp=be8dcc7ab7ed14d933d53ea9c3ca90228c667afd;hpb=cb1e2d6d3b2dc7a316ca19e9a5277e2f63b39337;p=16.git diff --git a/src/pcxtest.c b/src/pcxtest.c index be8dcc7a..7e10a958 100644 --- a/src/pcxtest.c +++ b/src/pcxtest.c @@ -5,27 +5,7 @@ #include "src/lib/bitmap.h" #include "src/lib/planar.c" -word far* clock= (word far*) 0x046C; /* 18.2hz clock */ - -void -oldDrawBmp(byte far* page, int x, int y, bitmap_t *bmp, 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 < bmp->width; px+=4) { - offset=px; - for(py=0; pyheight; py++) { - if(!sprite || bmp->data[offset]) - page[PAGE_OFFSET(x+px, y+py)] = bmp->data[offset]; - offset+=bmp->width; - } - } - } -} +word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ /* void @@ -55,7 +35,7 @@ DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite) void main() { bitmap_t bmp; planar_buf_t *p; - int i; + int i; page_t page; word start; int plane; @@ -64,59 +44,67 @@ void main() { page=modexDefaultPage(); //0000 bmp = bitmapLoadPcx("data/koishi~~.pcx"); - bmp = bitmapLoadPcx("data/chikyuu.pcx"); -//0000 p = planar_buf_from_bitmap(&bmp); +// bmp = bitmapLoadPcx("data/chikyuu.pcx"); + bmp = bitmapLoadPcx("data/koishi^^.pcx"); +// bmp = bitmapLoadPcx("16/PCX_LIB/chikyuu.pcx"); + p = planar_buf_from_bitmap(&bmp); modexEnter(); /* fix up the palette and everything */ -//++++ modexPalUpdate(&bmp, 0, 0, 0); + modexPalUpdate1(bmp.palette); /* clear and draw one sprite and one bitmap */ modexClearRegion(&page, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 1); /* non sprite comparison */ - /*0000start = *clock; + start = *clockw; for(i=0; i<100 ;i++) { oldDrawBmp(VGA, 20, 20, &bmp, 0); } - start = *clock; + start = *clockw; for(i=0; i<100 ;i++) { //0000 modexDrawBmp(&page, 20, 20, &bmp); modexDrawBmp(&page, 0, 0, &bmp); } - t1 = (*clock-start) /18.2; + t1 = (*clockw-start) /18.2; - start = *clock; + start = *clockw; for(i=0; i<100; i++) { //0000 modexCopyPageRegion(&page, &page, 20, 20, 128, 20, 64, 64); modexCopyPageRegion(&page, &page, 0, 0, 0, 0, 320, 240); } - t2 = (*clock-start)/18.2; + t2 = (*clockw-start)/18.2; - start = *clock; + start = *clockw; for(i=0; i<100 ;i++) { oldDrawBmp(VGA, 20, 20, &bmp, 1); } - start = *clock; + start = *clockw; for(i=0; i<100 ;i++) { //0000 modexDrawSprite(&page, 20, 20, &bmp); modexDrawSprite(&page, 0, 0, &bmp); - }*/ + } //_fmemset(MK_FP(0xA000, 0), (int)p->plane, SCREEN_WIDTH*(SCREEN_HEIGHT*2)); + modexDrawBmp(&page, 0, 0, &bmp); while(!kbhit()) { //DrawPBuf(&page, 0, 0, p, 0); - modexDrawBmp(&page, 0, 0, &bmp); } modexLeave(); printf("\n%d\n", sizeof(p->plane)); - printf("%d\n", sizeof(bmp)); -//0000 printf("CPU to VGA: %f\n", t1); -//0000 printf("VGA to VGA: %f\n", t2); + printf("%d\n", sizeof(bmp)); + + for(i=0; i<(320*240); i++) + { + fprintf(stdout, "%d", bmp.data[i]); + if(i%320==0) fprintf(stdout, "\n"); + } + printf("CPU to VGA: %f\n", t1); + printf("VGA to VGA: %f\n", t2); return; }