16FLAGS=-fh=16.hed
BAKAPIFLAGS=-fh=bakapi.hed
-SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k56832#60000#32768
+SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k55808#60000#32768
DFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1 $(SFLAGS)
ZFLAGS=-zk0 -zq -zc -zp8# -zm
CFLAGS=$(IFLAGS) -mh -lr -l=dos -wo# -d2##wwww
-/* 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.
- *
- */
-
+/* 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 "16text.h"\r
\r
/* this array holds the rom font descriptors */\r
font_t romFonts[4];\r
-\r
+fontdata_t romFontsData;\r
\r
static void getRomFontAddr(char fontNum, int index) {\r
word fontSeg;\r
romFonts[ROM_FONT_8x8_LOW].charSize=8;\r
romFonts[ROM_FONT_8x8_HIGH].charSize=8;\r
romFonts[ROM_FONT_8x16].charSize=16;\r
+ //romFontsData\r
}\r
-/* 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.
- *
- */
+/* 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
* This is the text subsystem for project 16.\r
* These functions provide for the rendering of text strings\r
* They copy the font characters directly to VGA.\r
*/\r
#ifndef TEXT_H\r
-#define TEXT_H
-#ifdef __WATCOMC__
-#include <jstring.h>
+#define TEXT_H\r
+#ifdef __WATCOMC__\r
+#include <jstring.h>\r
#include <jctype.h>\r
-#endif
+#endif\r
#include "src/lib/types.h"\r
\r
/* font information type */\r
byte charSize; //bytes in each character\r
} font_t;\r
\r
+typedef struct fontdata {\r
+ byte z[9];\r
+ byte col; //color\r
+ byte bgcol; //bg color!\r
+ word chw; //char width\r
+ byte l[1024];\r
+} fontdata_t;\r
+\r
/* storage for the rom fonts */\r
extern font_t romFonts[4];\r
+extern fontdata_t romFontsData;\r
#define ROM_FONT_8x14 0\r
#define ROM_FONT_8x8_LOW 1\r
#define ROM_FONT_8x8_HIGH 2\r
\r
void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str, boolean q)\r
{\r
- word i, s, o, w, j, k, xp;\r
- byte l[1024];\r
- word addr = (word) l;\r
- word chw=0;\r
+ word s, o, w;\r
+ word addr = (word) romFontsData.l;\r
byte c;\r
- byte z[10];\r
- //byte near *bakapee;\r
-\r
- switch(t)\r
- {\r
- case 0:\r
- w=14;\r
- break;\r
- case 1:\r
- w=8;\r
- break;\r
- case 2:\r
- w=8;\r
- break;\r
- case 3:\r
- w=16;\r
- break;\r
- default:\r
- t=3;\r
- w=16;\r
- break;\r
- }\r
\r
s=romFonts[t].seg;\r
o=romFonts[t].off;\r
+ w=romFonts[t].charSize;\r
+ romFontsData.chw=0;\r
\r
for(; *str != '\0'; str++)\r
{\r
c = (*str);\r
if((c=='\n'/* || c=="\\r
-"*/) || chw\r
+"*/) || romFontsData.chw\r
>=page->width)\r
{\r
- chw=0;\r
- y+=w;\r
+ romFontsData.chw=0;\r
+ y+=romFonts[t].charSize;\r
continue;\r
}\r
//load the letter 'A'\r
DEC CX\r
JNZ L1\r
}\r
- //bakapee = _nmalloc(sizeof(byte)*8);\r
//TODO: OPTIMIZE THIS!!!!\r
- for(i=0; i<w; i++)\r
- {\r
- /*modexSelectPlane(PLANE(x));\r
- j=1<<8;\r
- *bakapee=(l[i] & j ? col:bgcol);\r
- _fmemcpy(page->data + (((page->width/4) * (y+page->dy+i)) + ((x+page->dx+chw) / 4)), bakapee, 8);*/\r
- j=1<<8;\r
- k=0;\r
- xp=0;\r
- //every "pixel" row\r
- while(j)\r
- {\r
- if(q)\r
- //_fmemcpy(page->data + (((page->width/4) * (y)) + ((x) / 4)), l[i] & j ? col:bgcol, 8);\r
- modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol);\r
- else\r
- //printf("l[i]=%c j=%02u l[i] & j=%02u %c\n", l[i] , j, l[i] & j, l[i] & j ? '*':' ');\r
- //printf("%c", l[i] & j ? '*':' ');\r
- z[k]=l[i] & j ? '*':' ';\r
- xp++;\r
- j>>=1;\r
- k++;\r
- }\r
- if(!q)\r
- {\r
- for(k=0;k<10;k++)\r
- {\r
- printf("%c", z[k]);\r
- }\r
- printf("\n");\r
- }\r
- }\r
+ modexDrawCharPBuf(page, x, y, t, col, bgcol, q);\r
+\r
if(!q) getch();\r
- chw += xp;\r
}\r
//_nfree(bakapee);\r
}\r
JNZ PLANE_LOOP ; do all 4 planes\r
}\r
}\r
+\r
+void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, boolean q)\r
+{\r
+ word i, j, k;\r
+ for(i=0; i<romFonts[t].charSize; i++)\r
+ {\r
+ j=1<<8;\r
+ k=0;\r
+ //every "pixel" row\r
+ while(j)\r
+ {\r
+ if(q)\r
+ _fmemcpy(page->data + (((page->width/4) * (y+i)) + ((x+romFontsData.chw+k) / 4)),\r
+ romFontsData.l[i] & j ?\r
+ col:bgcol, 2);\r
+ //modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol);\r
+ else\r
+ //printf("l[i]=%c j=%02u l[i] & j=%02u %c\n", l[i] , j, l[i] & j, l[i] & j ? '*':' ');\r
+ //printf("%c", l[i] & j ? '*':' ');\r
+ romFontsData.z[k]=romFontsData.l[i] & j ? '*':' ';\r
+ j>>=1;\r
+ k++;\r
+ }\r
+ if(!q)\r
+ {\r
+ for(k=0;k<9;k++)\r
+ {\r
+ printf("%c", romFontsData.z[k]);\r
+ }\r
+ printf("\n");\r
+ }\r
+ }\r
+ romFontsData.chw += k;\r
+}\r
void modexDrawBmpPBufRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *bmp);\r
void modexDrawSpritePBuf(page_t *page, int x, int y, planar_buf_t *bmp);\r
void modexDrawSpritePBufRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *bmp);\r
+void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, boolean q);\r
\r
#endif\r