+/* 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 <http://www.gnu.org/licenses/>, or
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,
+ * Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
#include <stdio.h>
+#include <dos.h>
#include <string.h>\r
-#include "src\lib\modex16.h"\r
-#include "src\lib\bitmap.h"
-#include "src\lib\planar.c"\r
+#include "src/lib/modex16.h"\r
+#include "src/lib/bitmap.h"
+#include "src/lib/planar.c"\r
\r
-word far* clock= (word far*) 0x046C; /* 18.2hz clock */\r
+word far* clockw= (word far*) 0x046C; /* 18.2hz clock */\r
\r
-void\r
-oldDrawBmp(byte far* page, int x, int y, bitmap_t *bmp, byte sprite) {\r
- byte plane;\r
- word px, py;\r
- word offset;\r
-\r
- /* TODO Make this fast. It's SLOOOOOOW */\r
- for(plane=0; plane < 4; plane++) {\r
- modexSelectPlane(PLANE(plane+x));\r
- for(px = plane; px < bmp->width; px+=4) {\r
- offset=px;\r
- for(py=0; py<bmp->height; py++) {\r
- if(!sprite || bmp->data[offset])\r
- page[PAGE_OFFSET(x+px, y+py)] = bmp->data[offset];\r
- offset+=bmp->width;\r
- }\r
- }\r
- }\r
-}\r
-
+/*
void\r
DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite)
{\r
- byte plane;\r
- word px, py;\r
- word offset;\r
+ byte plane;\r
+ word px, py;\r
+ word offset;\r
\r
- /* TODO Make this fast. It's SLOOOOOOW */\r
- for(plane=0; plane < 4; plane++) {\r
+ // TODO Make this fast. It's SLOOOOOOW\r
+ for(plane=0; plane < 4; plane++) {\r
modexSelectPlane(PLANE(plane+x));\r
for(px = plane; px < p->width; px+=4) {\r
- offset=px;\r
- for(py=0; py<p->height/2; py++) {
+ offset=px;\r
+ for(py=0; py<p->height/2; py++) {
SELECT_ALL_PLANES();\r
if(!sprite || p->plane[offset])\r
page->data = p->plane;\r
//offset+=p->width;
//offset++;\r
- }\r
+ }\r
+ }\r
}\r
- }\r
}\r
-
+*/
\r
void main() {\r
- bitmap_t bmp;
- planar_buf_t *p;\r
- int i;\r
- page_t page;\r
- word start;
- int plane;\r
- float t1, t2;\r
-\r
- page=modexDefaultPage();\r
-\r
- bmp = bitmapLoadPcx("data/ed.pcx");
- p = planar_buf_from_bitmap(&bmp);\r
- modexEnter();\r
-\r
- /* fix up the palette and everything */\r
- modexPalUpdate(bmp.palette);\r
-\r
- /* clear and draw one sprite and one bitmap */\r
- modexClearRegion(&page, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 1);\r
-\r
- /* non sprite comparison */
- /*start = *clock;\r
- for(i=0; i<100 ;i++) {\r
- oldDrawBmp(VGA, 20, 20, &bmp, 0);\r
- }\r
+ bitmap_t bmp;
+ planar_buf_t *p;\r
+ int i;
+ page_t page;\r
+ word start;
+ int plane;\r
+ float t1, t2;\r
+\r
+ page=modexDefaultPage();\r
+\r
+//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);\r
+ modexEnter();\r
+\r
+ /* fix up the palette and everything */\r
+ modexPalUpdate1(bmp.palette);\r
+\r
+ /* clear and draw one sprite and one bitmap */\r
+ modexClearRegion(&page, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 1);\r
+\r
+ /* non sprite comparison */
+ start = *clockw;\r
+ for(i=0; i<100 ;i++) {\r
+ oldDrawBmp(VGA, 20, 20, &bmp, 0);\r
+ }\r
\r
- start = *clock;\r
- for(i=0; i<100 ;i++) {\r
- modexDrawBmp(&page, 20, 20, &bmp);\r
- }\r
- t1 = (*clock-start) /18.2;\r
+ start = *clockw;\r
+ for(i=0; i<100 ;i++) {\r
+//0000 modexDrawBmp(&page, 20, 20, &bmp);
+ modexDrawBmp(&page, 0, 0, &bmp);\r
+ }\r
+ t1 = (*clockw-start) /18.2;\r
\r
- start = *clock;\r
- for(i=0; i<100; i++) {\r
- modexCopyPageRegion(&page, &page, 20, 20, 128, 20, 64, 64);\r
- }\r
- t2 = (*clock-start)/18.2;\r
+ start = *clockw;\r
+ for(i=0; i<100; i++) {\r
+//0000 modexCopyPageRegion(&page, &page, 20, 20, 128, 20, 64, 64);
+ modexCopyPageRegion(&page, &page, 0, 0, 0, 0, 320, 240);\r
+ }\r
+ t2 = (*clockw-start)/18.2;\r
\r
\r
- start = *clock;\r
- for(i=0; i<100 ;i++) {\r
- oldDrawBmp(VGA, 20, 20, &bmp, 1);\r
- }\r
+ start = *clockw;\r
+ for(i=0; i<100 ;i++) {\r
+ oldDrawBmp(VGA, 20, 20, &bmp, 1);\r
+ }\r
\r
\r
- start = *clock;\r
- for(i=0; i<100 ;i++) {\r
- modexDrawSprite(&page, 20, 20, &bmp);\r
- }*/
+ start = *clockw;\r
+ for(i=0; i<100 ;i++) {\r
+//0000 modexDrawSprite(&page, 20, 20, &bmp);
+ modexDrawSprite(&page, 0, 0, &bmp);\r
+ }
+ //_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);
+ //DrawPBuf(&page, 0, 0, p, 0);
}
- modexLeave();\r
+ modexLeave();\r
printf("\n%d\n", sizeof(p->plane));
- printf("%d\n", sizeof(bmp));\r
- //printf("CPU to VGA: %f\n", t1);\r
- //printf("VGA to VGA: %f\n", t2);\r
- return;\r
+ 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");
+ }\r
+ printf("CPU to VGA: %f\n", t1);\r
+ printf("VGA to VGA: %f\n", t2);\r
+ return;\r
}\r