* Functions and types for a planar image buffer.
* This is meant to be able to load into video memory faster.
*/
-#include "src/lib/bitmap.h"
-
#ifndef PLANAR_H
#define PLANAR_H
+
+#include "src/lib/bitmap.h"
+#include "src/lib/16_ca.h"
+#include "src/lib/16_mm.h"
+#include "src/lib/16_hc.h"
+
typedef struct {
- byte huge *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 */
+ byte huge *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 */
} planar_buf_t;
-
/* 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
*/
planar_buf_t *planar_buf_from_bitmap(bitmap_t *b);
-
/* allocates a planar buffer with specified dimensions */
planar_buf_t *planar_buf_alloc(word width, word height);
-
/* deallocates a planar buffer */
void planar_buf_free(planar_buf_t *p);
#endif
void\r
DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite)\r
{\r
- word plane;\r
+ int plane;\r
int px, py, i;\r
-// word offset = (word) page->data;\r
-\r
px=x;\r
py=y;\r
// TODO Make this fast. It's SLOOOOOOW\r
// }\r
// }\r
// }\r
-// z=0;\r
for(plane=0; plane < 4; plane++) {\r
- //modexputPixel(page, 120, 90+z, z+1);\r
- //z++;\r
i=0;\r
modexSelectPlane(PLANE(plane+x));\r
- //modexSelectPlane(plane);\r
for(; y < p->height; y++) {\r
//for(px=0; px < p->width; px++) {\r
//printf("%02X ", (int) p->plane[plane][i++]);\r
- strncpy(page->data + (((page->width/4) * (y+page->dy)) + ((x+page->dx) / 4))\r
-,&(p->plane[plane][i+=p->pwidth]), p->pwidth);\r
+ _fstrncpy(page->data + (((page->width/4) * (y+page->dy)) + ((x+page->dx) / 4)), &(p->plane[plane][i+=p->pwidth]), p->pwidth);\r
//}\r
}\r
//getch();\r
p = planar_buf_from_bitmap(&bmp);\r
VGAmodeX(baka, &gvar);\r
gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);\r
-// gvar.video.page[0].sw+=32;\r
-// gvar.video.page[0].sh+=32;\r
\r
/* fix up the palette and everything */\r
modexPalUpdate1(bmp.palette);\r
//if(argv[2]) pee = strcpy(VGA, &(p->plane[plane][24]));\r
}//gvar.video.page[0].data\r
VGAmodeX(0, &gvar);\r
- planar_buf_free(p);\r
/*printf("\nmain=%Fp\n\n", &i);\r
printf("bmp.data=%Fp\n", bmp.data);\r
printf("*bmp.data=%Fp\n", *(bmp.data));\r
printf("&bmp.data=%Fp\n", &(bmp.data));*/\r
\r
/* print out the contents of each plane */\r
- /*for(plane=0; plane < 4; plane++) {\r
+ for(plane=0; plane < 4; plane++) {\r
i=0;\r
printf("Plane %d\n", plane);\r
for(py=0; py < p->height; py++) {\r
}\r
printf("\n");\r
}\r
- }*/\r
+ }\r
fprintf(stderr,"\n%d\n", sizeof(p->plane));\r
fprintf(stderr,"pw=%d\n", p->width);\r
fprintf(stderr,"ph=%d\n", p->height);\r
fprintf(stderr,"ppw=%d\n", p->pwidth);\r
fprintf(stderr,"%d\n", sizeof(bmp));\r
+ planar_buf_free(p);\r
// fprintf(stderr,"%s\n", *pee);\r
// fprintf(stderr, "CPU to VGA: %f\n", t1);\r
// fprintf(stderr, "VGA to VGA: %f\n", t2);\r