4 #include "src\lib\modex16.h"
\r
5 #include "src\lib\bitmap.h"
6 #include "src\lib\planar.c"
\r
8 word far* clock= (word far*) 0x046C; /* 18.2hz clock */
\r
11 oldDrawBmp(byte far* page, int x, int y, bitmap_t *bmp, byte sprite) {
\r
16 /* TODO Make this fast. It's SLOOOOOOW */
\r
17 for(plane=0; plane < 4; plane++) {
\r
18 modexSelectPlane(PLANE(plane+x));
\r
19 for(px = plane; px < bmp->width; px+=4) {
\r
21 for(py=0; py<bmp->height; py++) {
\r
22 if(!sprite || bmp->data[offset])
\r
23 page[PAGE_OFFSET(x+px, y+py)] = bmp->data[offset];
\r
32 DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite)
38 // TODO Make this fast. It's SLOOOOOOW
\r
39 for(plane=0; plane < 4; plane++) {
\r
40 modexSelectPlane(PLANE(plane+x));
\r
41 for(px = plane; px < p->width; px+=4) {
\r
43 for(py=0; py<p->height/2; py++) {
44 SELECT_ALL_PLANES();
\r
45 if(!sprite || p->plane[offset])
\r
46 page->data = p->plane;
\r
64 page=modexDefaultPage();
\r
66 bmp = bitmapLoadPcx("data/koishi~~.pcx");
67 p = planar_buf_from_bitmap(&bmp);
\r
70 /* fix up the palette and everything */
\r
71 modexPalUpdate(&bmp, 0, 0, 0);
\r
73 /* clear and draw one sprite and one bitmap */
\r
74 modexClearRegion(&page, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 1);
\r
76 /* non sprite comparison */
78 for(i=0; i<100 ;i++) {
\r
79 oldDrawBmp(VGA, 20, 20, &bmp, 0);
\r
83 for(i=0; i<100 ;i++) {
\r
84 modexDrawBmp(&page, 20, 20, &bmp);
\r
86 t1 = (*clock-start) /18.2;
\r
89 for(i=0; i<100; i++) {
\r
90 modexCopyPageRegion(&page, &page, 20, 20, 128, 20, 64, 64);
\r
92 t2 = (*clock-start)/18.2;
\r
96 for(i=0; i<100 ;i++) {
\r
97 oldDrawBmp(VGA, 20, 20, &bmp, 1);
\r
102 for(i=0; i<100 ;i++) {
\r
103 modexDrawSprite(&page, 20, 20, &bmp);
\r
105 //_fmemset(MK_FP(0xA000, 0), (int)p->plane, SCREEN_WIDTH*(SCREEN_HEIGHT*2));
108 //DrawPBuf(&page, 0, 0, p, 0);
112 printf("\n%d\n", sizeof(p->plane));
113 printf("%d\n", sizeof(bmp));
\r
114 printf("CPU to VGA: %f\n", t1);
\r
115 printf("VGA to VGA: %f\n", t2);
\r