pcxtest2.exe: pcxtest2.$(OBJ) gfx.lib
wcl $(FLAGS) pcxtest2.$(OBJ) gfx.lib -fm=pcxtest2.map
+pcxtest0.exe: pcxtest0.$(OBJ) gfx.lib
+ wcl $(FLAGS) pcxtest0.$(OBJ) gfx.lib -fm=pcxtest0.map
+
maptest.exe: maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib
wcl $(FLAGS) maptest.$(OBJ) mapread.$(OBJ) jsmn.$(OBJ) $(16LIBOBJS) gfx.lib -fm=maptest.map
pcxtest.$(OBJ): $(SRC)pcxtest.c $(SRCLIB)modex16.h
wcl $(FLAGS) -c $(SRC)pcxtest.c
+pcxtest0.$(OBJ): $(SRC)pcxtest0.c $(SRCLIB)modex16.h
+ wcl $(FLAGS) -c $(SRC)pcxtest0.c
+
pcxtest2.$(OBJ): $(SRC)pcxtest2.c $(SRCLIB)modex16.h
wcl $(FLAGS) -c $(SRC)pcxtest2.c
typedef void _seg * memptr;\r
#endif\r
\r
+#define AARED "\x1b[41;31m"\r
+#define AABLUE "\x1b[44;34m"\r
+#define AAGREEN "\x1b[42;32m"\r
+#define AAYELLOW "\x1b[43;33m"\r
+#define AAGREY "\x1b[47;37m"\r
+#define AABLACK "\x1b[40;30m"\r
+#define AAWHITE "\x1b[47;37m"\r
+#define AAMAGENTA "\x1b[45;35m"\r
+#define AARESET "\x1b[0m"\r
+\r
/* local function */\r
void wait(clock_t wait);\r
\r
#define FREEBLOCK(x) {*x->useptr=NULL;x->next=mm->mmfree;mm->mmfree=x;}
-#define AARED "\x1b[41;31m"
-#define AABLUE "\x1b[44;34m"
-#define AAGREEN "\x1b[42;32m"
-#define AAYELLOW "\x1b[43;33m"
-#define AAGREY "\x1b[47;37m"
-#define AABLACK "\x1b[40;30m"
-#define AAWHITE "\x1b[47;37m"
-#define AAMAGENTA "\x1b[45;35m"
-#define AARESET "\x1b[0m"
-
#define SAVENEARHEAP 0x200 // space to leave in data segment
#define SAVEFARHEAP 0//x400 // space to leave in far heap
}\r
break;\r
case 2:\r
- CRTParmCount = sizeof(ModeX_192x144regs) / sizeof(ModeX_192x144regs[0]);\r
+ CRTParmCount = sizeof(ModeX_160x120regs) / sizeof(ModeX_160x120regs[0]);\r
/* width and height */\r
- gv->video.page[0].sw=192;\r
- gv->video.page[0].sh=144;\r
+ gv->video.page[0].sw=120;\r
+ gv->video.page[0].sh=160;\r
\r
/* send the CRTParms */\r
for(i=0; i<CRTParmCount; i++) {\r
- outpw(CRTC_INDEX, ModeX_192x144regs[i]);\r
+ outpw(CRTC_INDEX, ModeX_160x120regs[i]);\r
}\r
\r
/* clear video memory */\r
ptr[i] = 0x0000;\r
}\r
break;\r
+ case 4:\r
+ CRTParmCount = sizeof(ModeX_192x144regs) / sizeof(ModeX_192x144regs[0]);\r
+ /* width and height */\r
+ gv->video.page[0].sw=192;\r
+ gv->video.page[0].sh=144;\r
+\r
+ /* send the CRTParms */\r
+ for(i=0; i<CRTParmCount; i++) {\r
+ outpw(CRTC_INDEX, ModeX_192x144regs[i]);\r
+ }\r
+\r
+ /* clear video memory */\r
+ outpw(SC_INDEX, 0x0f02);\r
+ for(i=0; i<0x8000; i++) {\r
+ ptr[i] = 0x0000;\r
+ }\r
+ break;\r
case 5:\r
CRTParmCount = sizeof(ModeX_256x192regs) / sizeof(ModeX_256x192regs[0]);\r
/* width and height */\r
#include "src/lib/modex16/320x200.h"
#include "src/lib/modex16/256x192.h"
#include "src/lib/modex16/192x144_.h"
+#include "src/lib/modex16/160x120.h"
//320x240 = 20x15
//192x144 = 12x9
*\r
*/\r
\r
-#ifndef _SMALLMODEXRESS_H_\r
-#define _SMALLMODEXRESS_H_\r
+#ifndef _SMALLMODEXREST_H_\r
+#define _SMALLMODEXREST_H_\r
\r
#include "src/lib/types.h"\r
\r
0x3c0, 0x13, 0x00\r
};*/\r
\r
-static const word ModeX_192x144regs[] = {\r
- 0x3f00, /* Horizontal total */\r
- 0x2f01, /* horizontal display enable end */\r
- 0x3002, /* Start horizontal blanking */\r
- 0x0003, /* End horizontal blanking */\r
- 0x3404, /* Start horizontal retrace */\r
- 0x4805, /* End horizontal retrace */\r
+static const word ModeX_160x120regs[] = {\r
+ 0x3200, /* Horizontal total */\r
+ 0x2701, /* horizontal display enable end */\r
+ 0x2802, /* Start horizontal blanking */\r
+ 0x2003, /* End horizontal blanking */\r
+ 0x2b04, /* Start horizontal retrace */\r
+ 0x7005, /* End horizontal retrace */\r
0x0d06, /* vertical total */\r
0x3e07, /* overflow (bit 8 of vertical counts) */\r
- 0x4109, /* cell height (2 to double-scan */\r
+ 0x4309, /* cell height (2 to double-scan */\r
0xea10, /* v sync start */\r
0xac11, /* v sync end and protect cr0-cr7 */\r
- 0x1f12, /* vertical displayed */\r
- 0x1813, /* offset/logical width */\r
+ 0xdf12, /* vertical displayed */\r
+ 0x1413, /* offset/logical width */\r
0x0014, /* turn off dword mode */\r
0xe715, /* v blank start */\r
0x0616, /* v blank end */\r
0xe317 /* turn on byte mode */\r
};//50 => 30\r
\r
-#endif /*_SMALLMODEXRESS_H_*/\r
+#endif /*_SMALLMODEXREST_H_*/\r
/*#include "TwkUser.h" // get Register definition\r
Register 192x144[] =\r
{\r
*\r
*/\r
\r
-#ifndef _SMALLMODEXRES_H_\r
-#define _SMALLMODEXRES_H_\r
+#ifndef _SMALLMODEXRESS_H_\r
+#define _SMALLMODEXRESS_H_\r
\r
#include "src/lib/types.h"\r
\r
};*/\r
\r
static const word ModeX_192x144regs[] = {\r
- 0x5f00, /* Horizontal total */\r
- 0x2f01, /* horizontal display enable end */\r
- 0x5002, /* Start horizontal blanking */\r
- 0x8203, /* End horizontal blanking */\r
- 0x5404, /* Start horizontal retrace */\r
- 0x8005, /* End horizontal retrace */\r
+ 0x3f00, /* Horizontal total */\r
+ 0x2701, /* horizontal display enable end */\r
+ 0x3002, /* Start horizontal blanking */\r
+ 0x0003, /* End horizontal blanking */\r
+ 0x3404, /* Start horizontal retrace */\r
+ 0x4805, /* End horizontal retrace */\r
0x0d06, /* vertical total */\r
0x3e07, /* overflow (bit 8 of vertical counts) */\r
0x4109, /* cell height (2 to double-scan */\r
0xe317 /* turn on byte mode */\r
};//50 => 30\r
\r
-#endif /*_SMALLMODEXRES_H_*/\r
-/*\r
-192x144[] =\r
+#endif /*_SMALLMODEXRESS_H_*/\r
+/*#include "TwkUser.h" // get Register definition\r
+Register 192x144[] =\r
{\r
- { 0x3c2, 0x0, 0xe3},\r
{ 0x3d4, 0x0, 0x3f},\r
{ 0x3d4, 0x1, 0x2f},\r
- { 0x3d4, 0x2, 0x50},\r
- { 0x3d4, 0x3, 0x82},\r
- { 0x3d4, 0x4, 0x54},\r
- { 0x3d4, 0x5, 0x80},\r
+ { 0x3d4, 0x2, 0x30},\r
+ { 0x3d4, 0x3, 0x0},\r
+ { 0x3d4, 0x4, 0x34},\r
+ { 0x3d4, 0x5, 0x48},\r
{ 0x3d4, 0x6, 0xd},\r
{ 0x3d4, 0x7, 0x3e},\r
{ 0x3d4, 0x8, 0x0},\r
{ 0x3ce, 0x5, 0x40},\r
{ 0x3ce, 0x6, 0x5},\r
{ 0x3c0, 0x10, 0x41},\r
+ { 0x3c0, 0x11, 0xe},\r
{ 0x3c0, 0x13, 0x0}\r
- };\r
-*/\r
+ };*/\r
*\r
*/\r
\r
-#ifndef _SMALLMODEXRESS_H_\r
-#define _SMALLMODEXRESS_H_\r
+#ifndef _SMALLMODEXRES_H_\r
+#define _SMALLMODEXRES_H_\r
\r
#include "src/lib/types.h"\r
\r
};*/\r
\r
static const word ModeX_192x144regs[] = {\r
- 0x3f00, /* Horizontal total */\r
+ 0x5f00, /* Horizontal total */\r
0x2f01, /* horizontal display enable end */\r
- 0x3002, /* Start horizontal blanking */\r
- 0x0003, /* End horizontal blanking */\r
- 0x3404, /* Start horizontal retrace */\r
- 0x4805, /* End horizontal retrace */\r
+ 0x5002, /* Start horizontal blanking */\r
+ 0x8203, /* End horizontal blanking */\r
+ 0x5404, /* Start horizontal retrace */\r
+ 0x8005, /* End horizontal retrace */\r
0x0d06, /* vertical total */\r
0x3e07, /* overflow (bit 8 of vertical counts) */\r
0x4109, /* cell height (2 to double-scan */\r
0xe317 /* turn on byte mode */\r
};//50 => 30\r
\r
-#endif /*_SMALLMODEXRESS_H_*/\r
-/*#include "TwkUser.h" // get Register definition\r
-Register 192x144[] =\r
+#endif /*_SMALLMODEXRES_H_*/\r
+/*\r
+192x144[] =\r
{\r
+ { 0x3c2, 0x0, 0xe3},\r
{ 0x3d4, 0x0, 0x3f},\r
{ 0x3d4, 0x1, 0x2f},\r
- { 0x3d4, 0x2, 0x30},\r
- { 0x3d4, 0x3, 0x0},\r
- { 0x3d4, 0x4, 0x34},\r
- { 0x3d4, 0x5, 0x48},\r
+ { 0x3d4, 0x2, 0x50},\r
+ { 0x3d4, 0x3, 0x82},\r
+ { 0x3d4, 0x4, 0x54},\r
+ { 0x3d4, 0x5, 0x80},\r
{ 0x3d4, 0x6, 0xd},\r
{ 0x3d4, 0x7, 0x3e},\r
{ 0x3d4, 0x8, 0x0},\r
{ 0x3ce, 0x5, 0x40},\r
{ 0x3ce, 0x6, 0x5},\r
{ 0x3c0, 0x10, 0x41},\r
- { 0x3c0, 0x11, 0xe},\r
{ 0x3c0, 0x13, 0x0}\r
- };*/\r
+ };\r
+*/\r
--- /dev/null
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
+\r
+#include <stdio.h>\r
+#include <dos.h>\r
+#include <string.h>\r
+#include "src/lib/modex16.h"\r
+#include "src/lib/bitmap.h"\r
+#include "src/lib/planar.h"\r
+\r
+global_game_variables_t gvar;\r
+\r
+/*\r
+void\r
+DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite)\r
+{\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 < p->width; px+=4) {\r
+ offset=px;\r
+ for(py=0; py<p->height/2; py++) {\r
+ SELECT_ALL_PLANES();\r
+ if(!sprite || p->plane[offset])\r
+ page->data = p->plane;\r
+ //offset+=p->width;\r
+ //offset++;\r
+ }\r
+ }\r
+ }\r
+}\r
+*/\r
+\r
+void main() {\r
+ bitmap_t bmp;\r
+ planar_buf_t *p;\r
+ int i;\r
+ word start;\r
+ int plane;\r
+ float t1, t2;\r
+\r
+//0000 bmp = bitmapLoadPcx("data/koishi~~.pcx");\r
+// bmp = bitmapLoadPcx("data/chikyuu.pcx");\r
+ bmp = bitmapLoadPcx("data/koishi^^.pcx");\r
+// bmp = bitmapLoadPcx("16/PCX_LIB/chikyuu.pcx");\r
+ p = planar_buf_from_bitmap(&bmp);\r
+ VGAmodeX(1, &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
+\r
+ /* clear and draw one sprite and one bitmap */\r
+ modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 1);\r
+\r
+ /* update display~*/\r
+ gvar.video.page[0].dx+=16;\r
+ gvar.video.page[0].dy+=16;\r
+ modexShowPage(&gvar.video.page[0]);\r
+\r
+ /* non sprite comparison */\r
+ start = *clockw;\r
+ //for(i=0; i<100 ;i++) {\r
+ oldDrawBmp(VGA, 20, 20, &bmp, 0);\r
+ //}\r
+\r
+ start = *clockw;\r
+ //for(i=0; i<100 ;i++) {\r
+//0000 modexDrawBmp(&gvar.video.page[0], 20, 20, &bmp);\r
+ modexDrawBmp(&gvar.video.page[0], 160, 120, &bmp);\r
+ //}\r
+ t1 = (*clockw-start) /18.2;\r
+\r
+ start = *clockw;\r
+ //for(i=0; i<100; i++) {\r
+//0000 modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 20, 20, 128, 20, 64, 64);\r
+ modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240);\r
+ //}\r
+ t2 = (*clockw-start)/18.2;\r
+\r
+\r
+ start = *clockw;\r
+ //for(i=0; i<100 ;i++) {\r
+ oldDrawBmp(VGA, 20, 20, &bmp, 1);\r
+ //}\r
+\r
+\r
+ start = *clockw;\r
+ //for(i=0; i<100 ;i++) {\r
+//0000 modexDrawSprite(&gvar.video.page[0], 20, 20, &bmp);\r
+ modexDrawSprite(&gvar.video.page[0], 160, 120, &bmp);\r
+ //}\r
+ //_fmemset(MK_FP(0xA000, 0), (int)p->plane, gvar.video.page[0].sw*(gvar.video.page[0].sh*2));\r
+ //modexDrawBmp(&gvar.video.page[0], 0, 0, &bmp);\r
+ while(!kbhit())\r
+ {\r
+ //DrawPBuf(&gvar.video.page[0], 0, 0, p, 0);\r
+ }\r
+ VGAmodeX(0, &gvar);\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
+ printf("\n%d\n", sizeof(p->plane));\r
+ printf("%d\n", sizeof(bmp));*/\r
+\r
+ /*for(i=0; i<(320*240); i++)\r
+ {\r
+ fprintf(stdout, "%d", bmp.data[i]);\r
+ if(i%bmp.width==0) fprintf(stdout, "\n");\r
+ }*/\r
+ printf("CPU to VGA: %f\n", t1);\r
+ printf("VGA to VGA: %f\n", t2);\r
+ printf("gvar.video.page[0].width: %u\n", gvar.video.page[0].width);\r
+ printf("gvar.video.page[0].height: %u\n", gvar.video.page[0].height);\r
+ return;\r
+}\r