BASIC compiler/interpreter for PIC32MX/MZ-80K
修訂 | a7720c6e1a8d7821dbf4b46ff7766cb4f27ae286 (tree) |
---|---|
時間 | 2019-03-03 09:24:51 |
作者 | Katsumi <kmorimatsu@sour...> |
Commiter | Katsumi |
CKNJ12, CKNJ16: half size fonts for 7 bit chars
@@ -1,4 +1,4 @@ | ||
1 | -REM CKNJ12.BAS ver 0.1 | |
1 | +REM CKNJ12.BAS ver 0.2 | |
2 | 2 | REM Class CKNJ12 for MachiKania Type Z/M |
3 | 3 | REM using Shinonome 12x12 font |
4 | 4 |
@@ -42,6 +42,10 @@ LABEL GPRTCH | ||
42 | 42 | var i,x,y |
43 | 43 | REM Create BMP from font file |
44 | 44 | gosub FGETCH,args(1) |
45 | + if args(1)<0x100 then | |
46 | + REM Half sized font | |
47 | + goto GPRTHS | |
48 | + endif | |
45 | 49 | for y=0 to 5 |
46 | 50 | i=peek(FBUFF+y*3) |
47 | 51 | for x=0 to 7 |
@@ -78,14 +82,36 @@ LABEL GPRTCH | ||
78 | 82 | REM Draw in graphic |
79 | 83 | x=SYSTEM(28) |
80 | 84 | y=SYSTEM(29) |
85 | + if SYSTEM(22)<x+12 then | |
86 | + x=0 | |
87 | + y=y+12 | |
88 | + point x,y | |
89 | + endif | |
81 | 90 | putbmp x,y,12,12,BMPF |
82 | - if x+24<=SYSTEM(22) then | |
83 | - x=x+12 | |
84 | - else | |
91 | + point x+12,y | |
92 | + return | |
93 | + | |
94 | +LABEL GPRTHS | |
95 | + for y=0 to 11 | |
96 | + i=peek(FBUFF+y) | |
97 | + for x=0 to 5 | |
98 | + if i and (1<<(7-x)) then | |
99 | + poke BMPF+y*6+x,PLT>>8 | |
100 | + else | |
101 | + poke BMPF+y*6+x,PLT and 0xff | |
102 | + endif | |
103 | + next | |
104 | + next | |
105 | + REM Draw in graphic | |
106 | + x=SYSTEM(28) | |
107 | + y=SYSTEM(29) | |
108 | + if SYSTEM(22)<x+6 then | |
85 | 109 | x=0 |
86 | 110 | y=y+12 |
111 | + point x,y | |
87 | 112 | endif |
88 | - point x,y | |
113 | + putbmp x,y,6,12,BMPF | |
114 | + point x+6,y | |
89 | 115 | return |
90 | 116 | |
91 | 117 | REM Private medthod FGETCH |
@@ -103,6 +129,12 @@ LABEL FGETCH | ||
103 | 129 | endif |
104 | 130 | endif |
105 | 131 | p=args(1) |
132 | + if 0x20<=p and p<=0x7f then | |
133 | + REM 7 bits half size font | |
134 | + fseek (p-0x20)*12 | |
135 | + fget FBUFF,12 | |
136 | + return | |
137 | + endif | |
106 | 138 | if 2=MODE then |
107 | 139 | REM UTF-8 |
108 | 140 | if p<0x0500 then |
@@ -129,7 +161,7 @@ LABEL FGETCH | ||
129 | 161 | REM EUC |
130 | 162 | p=p-0xa1a1 |
131 | 163 | endif |
132 | - p=p*18 | |
164 | + p=p*18+1152 | |
133 | 165 | if 0<=p and p+18<flen() then |
134 | 166 | fseek p |
135 | 167 | fget FBUFF,18 |
@@ -166,9 +198,9 @@ LABEL EUCSTR | ||
166 | 198 | i=i+2 |
167 | 199 | REM GPrint character |
168 | 200 | gosub GPRTCH,j |
169 | - elseif 0x20<b then | |
201 | + elseif 0x20<b and b<0x80 then | |
170 | 202 | REM 7 bit character |
171 | - gosub GPRTCH,0xa3b0+b-0x30 | |
203 | + gosub GPRTCH,b | |
172 | 204 | i=i+1 |
173 | 205 | endif |
174 | 206 | wend |
@@ -191,9 +223,9 @@ LABEL UTFSTR | ||
191 | 223 | i=i+3 |
192 | 224 | REM GPrint character |
193 | 225 | gosub GPRTCH,j |
194 | - elseif 0x20<b then | |
226 | + elseif 0x20<b and b<0x80 then | |
195 | 227 | REM 7 bit character |
196 | - gosub GPRTCH,0xff00+b-0x20 | |
228 | + gosub GPRTCH,b | |
197 | 229 | i=i+1 |
198 | 230 | endif |
199 | 231 | wend |
@@ -1,6 +1,6 @@ | ||
1 | 1 | <クラス名およびバージョン> |
2 | 2 | CKNJ12 |
3 | -ver 0.1 | |
3 | +ver 0.2 | |
4 | 4 | |
5 | 5 | <ファイル名> |
6 | 6 | CKNJ12.BAS |
@@ -1,4 +1,4 @@ | ||
1 | -REM CKNJ16.BAS ver 0.11 | |
1 | +REM CKNJ16.BAS ver 0.2 | |
2 | 2 | REM Class CKNJ16 for MachiKania Type Z/M |
3 | 3 | REM using Shinonome 16x16 font |
4 | 4 |
@@ -42,6 +42,10 @@ LABEL GPRTCH | ||
42 | 42 | var i,x,y |
43 | 43 | REM Create BMP from font file |
44 | 44 | gosub FGETCH,args(1) |
45 | + if args(1)<0x100 then | |
46 | + REM Half sized font | |
47 | + goto GPRTHS | |
48 | + endif | |
45 | 49 | for y=0 to 15 |
46 | 50 | i=peek(FBUFF+y*2) |
47 | 51 | for x=0 to 7 |
@@ -63,14 +67,36 @@ LABEL GPRTCH | ||
63 | 67 | REM Draw in graphic |
64 | 68 | x=SYSTEM(28) |
65 | 69 | y=SYSTEM(29) |
70 | + if SYSTEM(22)<x+16 then | |
71 | + x=0 | |
72 | + y=y+16 | |
73 | + point x,y | |
74 | + endif | |
66 | 75 | putbmp x,y,16,16,BMPF |
67 | - if x+32<=SYSTEM(22) then | |
68 | - x=x+16 | |
69 | - else | |
76 | + point x+16,y | |
77 | + return | |
78 | + | |
79 | +LABEL GPRTHS | |
80 | + for y=0 to 15 | |
81 | + i=peek(FBUFF+y) | |
82 | + for x=0 to 7 | |
83 | + if i and (1<<(7-x)) then | |
84 | + poke BMPF+y*8+x,PLT>>8 | |
85 | + else | |
86 | + poke BMPF+y*8+x,PLT and 0xff | |
87 | + endif | |
88 | + next | |
89 | + next | |
90 | + REM Draw in graphic | |
91 | + x=SYSTEM(28) | |
92 | + y=SYSTEM(29) | |
93 | + if SYSTEM(22)<x+8 then | |
70 | 94 | x=0 |
71 | 95 | y=y+16 |
96 | + point x,y | |
72 | 97 | endif |
73 | - point x,y | |
98 | + putbmp x,y,8,16,BMPF | |
99 | + point x+8,y | |
74 | 100 | return |
75 | 101 | |
76 | 102 | REM Private medthod FGETCH |
@@ -88,6 +114,12 @@ LABEL FGETCH | ||
88 | 114 | endif |
89 | 115 | endif |
90 | 116 | p=args(1) |
117 | + if 0x20<=p and p<=0x7f then | |
118 | + REM 7 bits half size font | |
119 | + fseek (p-0x20)*16 | |
120 | + fget FBUFF,16 | |
121 | + return | |
122 | + endif | |
91 | 123 | if 2=MODE then |
92 | 124 | REM UTF-8 |
93 | 125 | if p<0x0500 then |
@@ -114,7 +146,7 @@ LABEL FGETCH | ||
114 | 146 | REM EUC |
115 | 147 | p=p-0xa1a1 |
116 | 148 | endif |
117 | - p=p*32 | |
149 | + p=p*32+1536 | |
118 | 150 | if 0<=p and p+32<flen() then |
119 | 151 | fseek p |
120 | 152 | fget FBUFF,32 |
@@ -151,9 +183,9 @@ LABEL EUCSTR | ||
151 | 183 | i=i+2 |
152 | 184 | REM GPrint character |
153 | 185 | gosub GPRTCH,j |
154 | - elseif 0x20<b then | |
186 | + elseif 0x20<b and b<0x80 then | |
155 | 187 | REM 7 bit character |
156 | - gosub GPRTCH,0xa3b0+b-0x30 | |
188 | + gosub GPRTCH,b | |
157 | 189 | i=i+1 |
158 | 190 | endif |
159 | 191 | wend |
@@ -176,9 +208,9 @@ LABEL UTFSTR | ||
176 | 208 | i=i+3 |
177 | 209 | REM GPrint character |
178 | 210 | gosub GPRTCH,j |
179 | - elseif 0x20<b then | |
211 | + elseif 0x20<b and b<0x80 then | |
180 | 212 | REM 7 bit character |
181 | - gosub GPRTCH,0xff00+b-0x20 | |
213 | + gosub GPRTCH,b | |
182 | 214 | i=i+1 |
183 | 215 | endif |
184 | 216 | wend |
@@ -1,6 +1,6 @@ | ||
1 | 1 | <クラス名およびバージョン> |
2 | 2 | CKNJ16 |
3 | -ver 0.11 | |
3 | +ver 0.2 | |
4 | 4 | |
5 | 5 | <ファイル名> |
6 | 6 | CKNJ16.BAS |