Rev 180 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
180 | heavyiron | 1 | fontname equ 'font8x16.bmp' |
2 | virtual at 0 |
||
3 | file fontname, 3Eh |
||
4 | ; sanity check |
||
5 | load a1 word from 0 |
||
6 | load a2 dword from 0xE |
||
7 | if (a1 <> 'BM') | (a2 <> 0x28) |
||
8 | error 'not BMP file!' |
||
9 | end if |
||
10 | load a1 dword from 0x12 |
||
11 | load a2 dword from 0x16 |
||
12 | if (a1 and 0xF) | (a2 and 0xF) | (a1 > 16*16) |
||
13 | error 'font: invalid width or height' |
||
14 | end if |
||
15 | font_width = a1 shr 4 |
||
16 | font_bmp_scanline = (font_width*2 + 3) and not 3 |
||
17 | font_height = a2 shr 4 |
||
18 | load a1 dword from 0x1A |
||
19 | if a1 <> 0x10001 |
||
20 | error 'font: not monochrome bitmap' |
||
21 | end if |
||
22 | end virtual |
||
23 | |||
24 | font: |
||
474 | diamond | 25 | macro set_name_test a,b |
26 | { |
||
27 | if %=a |
||
28 | font_data_#a = b |
||
29 | end if |
||
30 | } |
||
31 | macro set_name b |
||
32 | { |
||
33 | set_name_test 1,b |
||
34 | set_name_test 2,b |
||
35 | set_name_test 3,b |
||
36 | set_name_test 4,b |
||
37 | set_name_test 5,b |
||
38 | set_name_test 6,b |
||
39 | set_name_test 7,b |
||
40 | set_name_test 8,b |
||
41 | set_name_test 9,b |
||
42 | set_name_test 10,b |
||
43 | set_name_test 11,b |
||
44 | set_name_test 12,b |
||
45 | set_name_test 13,b |
||
46 | set_name_test 14,b |
||
47 | set_name_test 15,b |
||
48 | set_name_test 16,b |
||
49 | } |
||
50 | macro db_name_test a |
||
51 | { |
||
52 | if %=a |
||
53 | db font_data_#a |
||
54 | end if |
||
55 | } |
||
56 | macro db_name |
||
57 | { |
||
58 | db_name_test 1 |
||
59 | db_name_test 2 |
||
60 | db_name_test 3 |
||
61 | db_name_test 4 |
||
62 | db_name_test 5 |
||
63 | db_name_test 6 |
||
64 | db_name_test 7 |
||
65 | db_name_test 8 |
||
66 | db_name_test 9 |
||
67 | db_name_test 10 |
||
68 | db_name_test 11 |
||
69 | db_name_test 12 |
||
70 | db_name_test 13 |
||
71 | db_name_test 14 |
||
72 | db_name_test 15 |
||
73 | db_name_test 16 |
||
74 | } |
||
75 | macro dw_name_test a |
||
76 | { |
||
77 | if %=a |
||
78 | dw font_data_#a |
||
79 | end if |
||
80 | } |
||
81 | macro dw_name |
||
82 | { |
||
83 | dw_name_test 1 |
||
84 | dw_name_test 2 |
||
85 | dw_name_test 3 |
||
86 | dw_name_test 4 |
||
87 | dw_name_test 5 |
||
88 | dw_name_test 6 |
||
89 | dw_name_test 7 |
||
90 | dw_name_test 8 |
||
91 | dw_name_test 9 |
||
92 | dw_name_test 10 |
||
93 | dw_name_test 11 |
||
94 | dw_name_test 12 |
||
95 | dw_name_test 13 |
||
96 | dw_name_test 14 |
||
97 | dw_name_test 15 |
||
98 | dw_name_test 16 |
||
99 | } |
||
180 | heavyiron | 100 | repeat font_height |
101 | cur_scan = % |
||
474 | diamond | 102 | repeat 16 |
180 | heavyiron | 103 | virtual at 0 |
474 | diamond | 104 | file fontname:3Eh + font_bmp_scanline*(font_height*(17-%)-cur_scan), font_width*2 |
180 | heavyiron | 105 | dd 0 |
474 | diamond | 106 | repeat 16 |
107 | load a1 dword from ((%-1)*font_width) shr 3 |
||
108 | a1 = ((a1 and 0x55555555) shl 1) or ((a1 and 0xAAAAAAAA) shr 1) |
||
109 | a1 = ((a1 and 0x33333333) shl 2) or ((a1 and 0xCCCCCCCC) shr 2) |
||
110 | a1 = ((a1 and 0x0F0F0F0F) shl 4) or ((a1 and 0xF0F0F0F0) shr 4) |
||
111 | a1 = (a1 shr (((%-1)*font_width) and 7)) and ((1 shl font_width) - 1) |
||
112 | a1 = a1 xor ((1 shl font_width) - 1) |
||
113 | set_name a1 |
||
114 | end repeat |
||
180 | heavyiron | 115 | end virtual |
116 | if font_width > 8 |
||
474 | diamond | 117 | repeat 16 |
118 | dw_name |
||
119 | end repeat |
||
180 | heavyiron | 120 | else |
474 | diamond | 121 | repeat 16 |
122 | db_name |
||
123 | end repeat |
||
180 | heavyiron | 124 | end if |
125 | end repeat |
||
126 | end repeat |
||
474 | diamond | 127 | purge set_name_test |
128 | purge db_name_test |
||
129 | purge dw_name_test |
||
130 | purge set_name |
||
131 | purge db_name |
||
132 | purge dw_name>>> |