+++ /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
-#include <stdio.h>\r
-#include <conio.h>\r
-#include "lib/types.h"\r
-#include "lib/16text.h"
-#include "lib/modex16.h"\r
-\r
-void main(int argc, char near *argv[])\r
-{\r
- int i, xp;\r
- int j;\r
- char l[16];\r
- char c,ct;\r
- word s, o, t, w;\r
- word addr = (word) l;
- //byte *pal, *pal2, fond;
- //bitmap_t fontdata;
- page_t page;\r
- textInit();\r
-\r
- //print the addresses of the fonts\r
- printf("ROM FONT Addresses\n");\r
- for(i=0; i<4; i++) {\r
- printf("%d: %x:%x\n", i, romFonts[i].seg, romFonts[i].off);\r
- }\r
-\r
-// printf("*argv[1]=%d\n", *argv[1]);\r
-
- printf("Font type: ");\r
- gets(&ct);
-\r
- printf("Character: ");\r
- gets(&c);\r
-\r
- if(ct!=1)\r
- switch(ct)\r
- {\r
- case 48:
- printf("type 0\n");\r
- t=0;\r
- w=14;\r
- break;\r
- case 49:
- printf("type 1\n");\r
- t=1;\r
- w=8;\r
- break;\r
- case 50:
- printf("type 2\n");\r
- t=2;\r
- w=8;\r
- break;\r
- case 51:
- printf("type 3\n");\r
- t=3;\r
- w=16;\r
- break;\r
- default:
- printf("type 3\n");\r
- t=3;\r
- w=16;\r
- break;\r
- }\r
- else\r
- {
- printf("type 3\n");\r
- t=3;\r
- w=16; \r
- }\r
-\r
-\r
- s=romFonts[t].seg;\r
- o=romFonts[t].off;\r
-\r
- //load the letter 'A'\r
- __asm {\r
- MOV DI, addr\r
- MOV SI, o\r
- MOV ES, s\r
- SUB AH, AH\r
- MOV AL, c ; the letter\r
- MOV CX, w\r
- MUL CX\r
- ADD SI, AX ;the address of charcter\r
- L1: MOV AX, ES:SI\r
- MOV DS:DI, AX\r
- INC SI\r
- INC DI\r
- DEC CX\r
- JNZ L1\r
- }
-
- //load our palette\r
- //modexLoadPalFile("data/default.pal", &pal2);
-
- /*fontdata.width=8;
- fontdata.height=w;
- fontdata.palette=pal2;
-
- fontdata.data=malloc(256);
-
- for(i=0; i<w; i++)
- {\r
- j=1<<8;\r
- while(j)
- {
- fond=(byte)l[i] & j ? '1':'0';
- fontdata.data=&(fond);
- printf("%02x ", *(fontdata.data));\r
- j>>=1;\r
- }
- printf("\n");\r
- }
-
- printf("\n\nok hit a key~\n");
- while(!getch())\r
- {\r
- //DrawPBuf(&page, 0, 0, p, 0);\r
- }*/\r
-\r
- // save the palette\r
- /*pal = modexNewPal();\r
- modexPalSave(pal);\r
- modexFadeOff(4, pal);\r
- modexPalBlack();\r
-*/\r
- modexEnter();\r
-/* modexPalBlack();*/\r
-\r
- // set up the page, but with 16 pixels on all borders in offscreen mem\r
- page=modexDefaultPage();\r
- //page.width += 32;\r
- //page.height += 32;
- modexShowPage(&page);
- modexClearRegion(&page, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 1);
- // fade in\r
- //modexFadeOn(4, pal2);
-
- //render the letter in ascii art\r
- for(i=0; i<w; i++)
- {\r
- j=1<<8;
- xp=0;\r
- while(j)
- {
- //printf("j=%d\n", j);\r
- //printf("%c", l[i] & j ? '*':' ');
- //====printf("%02x ", l[i] & j);
- //printf("l[i]=%d ", l[i]);
- //printf("j=%d ", j);
- //printf("%02x\n", l[i] & j);
- modexClearRegion(&page, xp, i*4, 4, 4, l[i] & j ? 15:0);
-//while(!getch());
- xp+=4;
- j>>=1;
- }\r
- //====
- //printf("\n");
- }
- //modexDrawSprite(&page, 0, 0, &fontdata);
- while(!getch())\r
- {\r
- //DrawPBuf(&page, 0, 0, p, 0);\r
- }
-
- // fade back to text mode\r
- /*modexFadeOff(4, pal2);\r
- modexPalBlack();*/\r
- modexLeave();\r
- /*modexPalBlack();\r
- modexFadeOn(4, pal);*/
- //render the letter in ascii art\r
- for(i=0; i<w; i++)
- {\r
- j=1<<8;\r
- while(j)
- {
- printf("%c", l[i] & j ? '*':' ');
- //====printf("%02x ", l[i] & j);
-//while(!getch());
- j>>=1;
- }\r
- printf("\n");
- }
- printf("\ni=%d\n", i);
- printf("j=%d\n", j);
-
-}\r