Go to most recent revision | Details | 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: |
||
25 | repeat font_height |
||
26 | cur_scan = % |
||
27 | repeat 256 |
||
28 | virtual at 0 |
||
29 | a2 = (font_width+14) shr 3 |
||
30 | if cur_scan=1 & %=0x10 |
||
31 | a2 = (font_width+7) shr 3 |
||
32 | end if |
||
33 | file fontname:3Eh + font_bmp_scanline*(font_height*(16-((%-1) shr 4))-cur_scan) + ((((%-1) and 0xF)*font_width) shr 3), a2 |
||
34 | dd 0 |
||
35 | load a1 dword from 0 |
||
36 | a1 = ((a1 and 0x55555555) shl 1) or ((a1 and 0xAAAAAAAA) shr 1) |
||
37 | a1 = ((a1 and 0x33333333) shl 2) or ((a1 and 0xCCCCCCCC) shr 2) |
||
38 | a1 = ((a1 and 0x0F0F0F0F) shl 4) or ((a1 and 0xF0F0F0F0) shr 4) |
||
39 | end virtual |
||
40 | a1 = (a1 shr (((%-1)*font_width) and 7)) and ((1 shl font_width) - 1) |
||
41 | a1 = a1 xor ((1 shl font_width) - 1) |
||
42 | if font_width > 8 |
||
43 | dw a1 |
||
44 | else |
||
45 | db a1 |
||
46 | end if |
||
47 | end repeat |
||
48 | end repeat>>> |