From: sparky4 Date: Wed, 11 Nov 2015 13:47:45 +0000 (-0600) Subject: working on font~ X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=81a89657d4c71baad7e1a6c65c166fcca6af8bf8 working on font~ --- diff --git a/16.exe b/16.exe index e57e73b2..e3d1b91c 100755 Binary files a/16.exe and b/16.exe differ diff --git a/bakapi.exe b/bakapi.exe index 38a9a561..4dcc4052 100755 Binary files a/bakapi.exe and b/bakapi.exe differ diff --git a/exmmtest.exe b/exmmtest.exe index 7f03a7a7..39ba53b8 100755 Binary files a/exmmtest.exe and b/exmmtest.exe differ diff --git a/fmemtest.exe b/fmemtest.exe index 7a35aaf9..c88212ab 100755 Binary files a/fmemtest.exe and b/fmemtest.exe differ diff --git a/fontgfx.exe b/fontgfx.exe index dcffafe8..1886fcc9 100755 Binary files a/fontgfx.exe and b/fontgfx.exe differ diff --git a/fonttest.exe b/fonttest.exe index 256aed67..c59b86a5 100755 Binary files a/fonttest.exe and b/fonttest.exe differ diff --git a/inputest.exe b/inputest.exe index caf53e60..09cb3893 100755 Binary files a/inputest.exe and b/inputest.exe differ diff --git a/makefile b/makefile index cf7ce427..6c388c71 100755 --- a/makefile +++ b/makefile @@ -59,7 +59,7 @@ WCPULIB=$(SRCLIB)wcpu$(DIRSEP) 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 diff --git a/maptest.exe b/maptest.exe index 6e420ea4..e9b7685a 100755 Binary files a/maptest.exe and b/maptest.exe differ diff --git a/palettec.exe b/palettec.exe index 27870e47..7222a87a 100755 Binary files a/palettec.exe and b/palettec.exe differ diff --git a/palettel.exe b/palettel.exe index de2b7d81..c68fd94d 100755 Binary files a/palettel.exe and b/palettel.exe differ diff --git a/pcxtest.exe b/pcxtest.exe index 33f8e41a..8a5dd42b 100755 Binary files a/pcxtest.exe and b/pcxtest.exe differ diff --git a/pcxtest2.exe b/pcxtest2.exe index 28294911..5f5124dd 100755 Binary files a/pcxtest2.exe and b/pcxtest2.exe differ diff --git a/planrpcx.exe b/planrpcx.exe index f3e54abf..cfcf4fff 100755 Binary files a/planrpcx.exe and b/planrpcx.exe differ diff --git a/scroll.exe b/scroll.exe index ee9d1f07..cc6b0edc 100755 Binary files a/scroll.exe and b/scroll.exe differ diff --git a/src/lib/16text.c b/src/lib/16text.c index fc7c775f..62b581e8 100755 --- a/src/lib/16text.c +++ b/src/lib/16text.c @@ -1,30 +1,30 @@ -/* 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 , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - +/* 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 , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + #include "16text.h" /* this array holds the rom font descriptors */ font_t romFonts[4]; - +fontdata_t romFontsData; static void getRomFontAddr(char fontNum, int index) { word fontSeg; @@ -56,4 +56,5 @@ void textInit() { romFonts[ROM_FONT_8x8_LOW].charSize=8; romFonts[ROM_FONT_8x8_HIGH].charSize=8; romFonts[ROM_FONT_8x16].charSize=16; + //romFontsData } diff --git a/src/lib/16text.h b/src/lib/16text.h index a4453739..c946ae5e 100755 --- a/src/lib/16text.h +++ b/src/lib/16text.h @@ -1,24 +1,24 @@ -/* 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 , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * - */ +/* 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 , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ /* * This is the text subsystem for project 16. * These functions provide for the rendering of text strings @@ -26,11 +26,11 @@ * They copy the font characters directly to VGA. */ #ifndef TEXT_H -#define TEXT_H -#ifdef __WATCOMC__ -#include +#define TEXT_H +#ifdef __WATCOMC__ +#include #include -#endif +#endif #include "src/lib/types.h" /* font information type */ @@ -40,8 +40,17 @@ typedef struct font { byte charSize; //bytes in each character } font_t; +typedef struct fontdata { + byte z[9]; + byte col; //color + byte bgcol; //bg color! + word chw; //char width + byte l[1024]; +} fontdata_t; + /* storage for the rom fonts */ extern font_t romFonts[4]; +extern fontdata_t romFontsData; #define ROM_FONT_8x14 0 #define ROM_FONT_8x8_LOW 1 #define ROM_FONT_8x8_HIGH 2 diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 8637d711..1ddefc69 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -954,46 +954,24 @@ void modexhlin(page_t *page, word xl, word xh, word y, word color) void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str, boolean q) { - word i, s, o, w, j, k, xp; - byte l[1024]; - word addr = (word) l; - word chw=0; + word s, o, w; + word addr = (word) romFontsData.l; byte c; - byte z[10]; - //byte near *bakapee; - - switch(t) - { - case 0: - w=14; - break; - case 1: - w=8; - break; - case 2: - w=8; - break; - case 3: - w=16; - break; - default: - t=3; - w=16; - break; - } s=romFonts[t].seg; o=romFonts[t].off; + w=romFonts[t].charSize; + romFontsData.chw=0; for(; *str != '\0'; str++) { c = (*str); if((c=='\n'/* || c=="\ -"*/) || chw +"*/) || romFontsData.chw >=page->width) { - chw=0; - y+=w; + romFontsData.chw=0; + y+=romFonts[t].charSize; continue; } //load the letter 'A' @@ -1013,42 +991,10 @@ void modexprint(page_t *page, word x, word y, word t, word col, word bgcol, cons DEC CX JNZ L1 } - //bakapee = _nmalloc(sizeof(byte)*8); //TODO: OPTIMIZE THIS!!!! - for(i=0; idata + (((page->width/4) * (y+page->dy+i)) + ((x+page->dx+chw) / 4)), bakapee, 8);*/ - j=1<<8; - k=0; - xp=0; - //every "pixel" row - while(j) - { - if(q) - //_fmemcpy(page->data + (((page->width/4) * (y)) + ((x) / 4)), l[i] & j ? col:bgcol, 8); - modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol); - else - //printf("l[i]=%c j=%02u l[i] & j=%02u %c\n", l[i] , j, l[i] & j, l[i] & j ? '*':' '); - //printf("%c", l[i] & j ? '*':' '); - z[k]=l[i] & j ? '*':' '; - xp++; - j>>=1; - k++; - } - if(!q) - { - for(k=0;k<10;k++) - { - printf("%c", z[k]); - } - printf("\n"); - } - } + modexDrawCharPBuf(page, x, y, t, col, bgcol, q); + if(!q) getch(); - chw += xp; } //_nfree(bakapee); } diff --git a/src/lib/modex16/16render.c b/src/lib/modex16/16render.c index 19884408..91820e8e 100755 --- a/src/lib/modex16/16render.c +++ b/src/lib/modex16/16render.c @@ -434,3 +434,37 @@ modexDrawSpritePBufRegion(page_t *page, int x, int y, JNZ PLANE_LOOP ; do all 4 planes } } + +void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, boolean q) +{ + word i, j, k; + for(i=0; idata + (((page->width/4) * (y+i)) + ((x+romFontsData.chw+k) / 4)), + romFontsData.l[i] & j ? + col:bgcol, 2); + //modexputPixel(page, x+xp+chw, y+i, l[i] & j ? col:bgcol); + else + //printf("l[i]=%c j=%02u l[i] & j=%02u %c\n", l[i] , j, l[i] & j, l[i] & j ? '*':' '); + //printf("%c", l[i] & j ? '*':' '); + romFontsData.z[k]=romFontsData.l[i] & j ? '*':' '; + j>>=1; + k++; + } + if(!q) + { + for(k=0;k<9;k++) + { + printf("%c", romFontsData.z[k]); + } + printf("\n"); + } + } + romFontsData.chw += k; +} diff --git a/src/lib/modex16/16render.h b/src/lib/modex16/16render.h index 4b2ebcd9..23d507ac 100755 --- a/src/lib/modex16/16render.h +++ b/src/lib/modex16/16render.h @@ -36,5 +36,6 @@ void modexDrawBmpPBuf(page_t *page, int x, int y, planar_buf_t *bmp); /*pbuf ver void modexDrawBmpPBufRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *bmp); void modexDrawSpritePBuf(page_t *page, int x, int y, planar_buf_t *bmp); void modexDrawSpritePBufRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *bmp); +void modexDrawCharPBuf(page_t *page, int x, int y, word t, word col, word bgcol, boolean q); #endif diff --git a/test.exe b/test.exe index e6acda17..27bdd0c7 100755 Binary files a/test.exe and b/test.exe differ diff --git a/test2.exe b/test2.exe index bb6b3a0f..4822506d 100755 Binary files a/test2.exe and b/test2.exe differ diff --git a/tesuto.exe b/tesuto.exe index e475c0f0..6dbf027e 100755 Binary files a/tesuto.exe and b/tesuto.exe differ diff --git a/vgmtest.exe b/vgmtest.exe index 335f9668..892afa7e 100755 Binary files a/vgmtest.exe and b/vgmtest.exe differ