OSDN Git Service

updated copyleft and need to test and fix newer version of open watcom
[proj16/16.git] / src / fonttest.c
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2022 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
3  *\r
4  * This file is part of Project 16.\r
5  *\r
6  * Project 16 is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 3 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Project 16 is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
19  * Fifth Floor, Boston, MA 02110-1301 USA.\r
20  *\r
21  */\r
22 #include <stdio.h>\r
23 #include <conio.h>\r
24 #include "src/lib/16_t.h"\r
25 #include "src/lib/16text.h"\r
26 \r
27 void main(int argc, char near *argv[])\r
28 {\r
29     int i;\r
30     int j;\r
31         char l[16];\r
32     char c,ct;\r
33     word s, o, t, w;\r
34     word addr = (word) l;\r
35     textInit();\r
36 \r
37     //print the addresses of the fonts\r
38     printf("ROM FONT Addresses\n");\r
39     for(i=0; i<4; i++) {\r
40         printf("%d: %x:%x\n", i, romFonts[i].seg, romFonts[i].off);\r
41     }\r
42 \r
43 //      printf("*argv[1]=%d\n", *argv[1]);\r
44 \r
45         printf("Font type: ");\r
46         gets(&ct);\r
47 \r
48         printf("Character: ");\r
49         gets(&c);\r
50 \r
51         if(ct!=1)\r
52         switch(ct)\r
53         {\r
54                 case 48:\r
55                         printf("type 0\n");\r
56                         t=0;\r
57                         w=14;\r
58                 break;\r
59                 case 49:\r
60                         printf("type 1\n");\r
61                         t=1;\r
62                         w=8;\r
63                 break;\r
64                 case 50:\r
65                         printf("type 2\n");\r
66                         t=2;\r
67                         w=8;\r
68                 break;\r
69                 case 51:\r
70                         printf("type 3\n");\r
71                         t=3;\r
72                         w=16;\r
73                 break;\r
74                 default:\r
75                         printf("type 3\n");\r
76                         t=3;\r
77                         w=16;\r
78                 break;\r
79         }\r
80         else\r
81         {\r
82                 printf("type 3\n");\r
83                 t=3;\r
84                 w=16;\r
85         }\r
86 \r
87 \r
88     s=romFonts[t].seg;\r
89     o=romFonts[t].off;\r
90 \r
91     //load the letter 'A'\r
92     __asm {\r
93                 MOV DI, addr\r
94                 MOV SI, o\r
95                 MOV ES, s\r
96                 SUB AH, AH\r
97                 MOV AL, c       ; the letter\r
98                 MOV CX, w\r
99                 MUL CX\r
100                 ADD SI, AX      ;the address of charcter\r
101         L1:     MOV AX, ES:SI\r
102                 MOV DS:DI, AX\r
103                 INC SI\r
104                 INC DI\r
105                 DEC CX\r
106                 JNZ L1\r
107     }\r
108 \r
109     //render the letter in ascii art\r
110     for(i=0; i<w; i++) {\r
111         j=1<<8;\r
112         while(j) {\r
113             printf("%c", l[i] & j ? '*':' ');\r
114             j>>=1;\r
115         }\r
116         printf("\n");\r
117     }\r
118 }\r