source: trunk/bootcode/special/charset.asm@ 234

Last change on this file since 234 was 234, checked in by Ben Rietbroek, 7 years ago

Updated the charset loading logic [v1.1.5-testing]

This can now inject custom glyphs at any code-point and optionally
remap the original character somewhere else.

For Spanish, two custom CP850 glyphs, 0xb5 and 0xe0, are used.
And the original glyph at code-point 0xb5, which is a box-character that
AiR-BOOT uses, is remapped to code-point 0xd9.

Translator-build 'AiR-BOOT-v1.1.5-ES-TESTBUILD-20180705' was created
from this commit.

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.4-manual.pdf

File size: 7.3 KB
Line 
1; AiR-BOOT (c) Copyright 1998-2008 M. Kiewitz
2;
3; This file is part of AiR-BOOT
4;
5; AiR-BOOT is free software: you can redistribute it and/or modify it under
6; the terms of the GNU General Public License as published by the Free
7; Software Foundation, either version 3 of the License, or (at your option)
8; any later version.
9;
10; AiR-BOOT is distributed in the hope that it will be useful, but WITHOUT ANY
11; WARRANTY: without even the implied warranty of MERCHANTABILITY or FITNESS
12; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13; details.
14;
15; You should have received a copy of the GNU General Public License along with
16; AiR-BOOT. If not, see <http://www.gnu.org/licenses/>.
17;
18;---------------------------------------------------------------------------
19; AiR-BOOT / CHARSET SUPPORT
20;---------------------------------------------------------------------------
21
22; This file is only included, when compiling versions that are meant to
23; contain special characters that are not included in the Video ROM charset.
24
25
26
27; We are building for Spanish so enable simple glyph injection for a few CP850 glyphs
28IF BLD_LANG_TXT EQ 'es'
29
30; -----------------------------------------------------------------------------
31; Load the glyphs used for Spanish into the video-system
32; -----------------------------------------------------------------------------
33; Spanish actually currently only uses codepoint 0xb5 from CP850.
34; However, in CP437, which is used by the BIOS, 0xb5 is a box-char and used for
35; building the menus. This function remaps stuff so the 0xb5 glyph from CP850
36; can be displayed.
37; -----------------------------------------------------------------------------
38CHARSET_IncludeSpanish Proc Near
39
40 pusha
41
42 ; First we get the ROM charset from BIOS...
43 call CHARSET_GetRomGlyphs
44
45 ; Pointer to table with glyphs using simple injection format
46 mov si, offset CHARSET_Spanish
47
48 ; Load nr of glyphs to process in CL
49 cld
50 lodsb
51 mov cl,al
52 xor ch,ch
53
54 CHARSET_IncludeSpanish_NextGlyph:
55 lodsw ; AL=code-point, if AH<>0 then backup-point
56 test ah,ah ; Copy glyph to backup-point ?
57 jz CHARSET_IncludeSpanish_NoBackup
58
59 ; Backup glyph to other code-point so it can be used
60 push cx ; Save glyph counter
61 push si ; Save glyph pointer
62 mov si,offset CharsetTempBuffer
63 mov di,si
64 mov dl,al ; Glyph code-point
65 xor dh,dh
66 shl dx,4 ; Index in table assuming 16 scan-lines
67 add si,dx ; Make SI point to it
68 mov dl,ah ; Glyph code-point (backup)
69 xor dh,dh
70 shl dx,4 ; Index in table assuming 16 scan-lines
71 add di,dx ; Make DI point to it (backup)
72 mov cx,16 ; Each byte is a scan-line
73 rep movsb ; Backup the glyph
74 pop si ; Restore glyph pointer
75 pop cx ; Restore glyph counter
76
77 CHARSET_IncludeSpanish_NoBackup:
78 mov di,offset CharsetTempBuffer
79 mov dl,al ; Glyph code-point
80 xor dh,dh
81 shl dx,4 ; Index in table assuming 16 scan-lines
82 add di,dx ; Make DI point to glyph to be replaced
83 push cx ; Save glyph counter
84 mov cx,16 ; Each byte is a scan-line
85 rep movsb ; Insert the new glyph
86 pop cx
87 loop CHARSET_IncludeSpanish_NextGlyph ; Next glyph if any
88
89 ; Upload the custom charset to the video-adapter
90 call CHARSET_SetCutsomGlyphs
91
92 popa
93 ret
94CHARSET_IncludeSpanish EndP
95
96ENDIF
97
98
99; We are building for Russian so enable compressed glyph injection to load the CP866 glyphs
100IF BLD_LANG_TXT EQ 'ru'
101
102; -----------------------------------------------------------------------------
103; Load the glyphs used for Russian into the video-system
104; -----------------------------------------------------------------------------
105; Russian uses the Cyrillic glyphs from CP866.
106; CP866 is box-char compatible with CP437, which is used by the BIOS, so only
107; the Cyrillic glyps are overlaid the CP437 glyphs.
108; -----------------------------------------------------------------------------
109CHARSET_IncludeCyrillic Proc Near
110
111 pusha
112
113 ; First we get the ROM charset from BIOS...
114 call CHARSET_GetRomGlyphs
115
116 ; Pointer to table with glyphs using compressed format
117 mov si, offset CHARSET_Cyrillic
118 mov di, offset CharsetTempBuffer+2048
119
120 mov dl, 64 ; Decode 64 character bitmaps
121 xor al, al
122 xor ch, ch
123 DecodeLoop: ; This is an uncompressing-loop
124 mov ah, ds:[si]
125 inc si
126 mov cl, ah
127 and cl, 0Fh
128 rep stosb ; Write NULs, count: lower 4 bits
129 mov cl, ah
130 shr cl, 4
131 or cl, cl
132 jz EndOfStream
133 rep movsb
134 jmp DecodeLoop
135 EndOfStream:
136 cmp di, offset CharsetTempBuffer+3840
137 jae DecodeDone
138 add di, 768 ; Skip 3x16 char blocks
139 jmp DecodeLoop
140
141 DecodeDone:
142 ; Upload the custom charset to the video-adapter
143 call CHARSET_SetCutsomGlyphs
144
145 popa
146 ret
147CHARSET_IncludeCyrillic EndP
148
149ENDIF
150
151
152
153; -----------------------------------------------------------------------------
154; Load the glyphs to the video-bios assuming 400 scanlines
155; -----------------------------------------------------------------------------
156CHARSET_GetRomGlyphs Proc
157 mov ax, 1130h
158 mov bh, 6 ; Get ROM VGA 25x80 charset
159 int 10h ; VIDEO BIOS: Get charset table pointer
160 mov bx, ds ; ES:BP point to charset (in Video-ROM)
161 mov ax, es
162 mov es, bx
163 mov ds, ax
164 mov si, bp ; DS:SI - ROM Font 25x80 and ES==CS
165 mov di, offset CharsetTempBuffer
166 mov cx, 2048
167 rep movsw ; Copy ROM-charset to Temp-Buffer
168 mov ds, bx ; DS==CS
169 ret
170CHARSET_GetRomGlyphs EndP
171
172
173
174; -----------------------------------------------------------------------------
175; Load the glyphs to the video-bios assuming 400 scanlines
176; -----------------------------------------------------------------------------
177CHARSET_SetCutsomGlyphs Proc
178IFDEF FX_ENABLED
179 call FX_WaitRetrace ; Wait for retrace to reduce flickering
180ENDIF
181 mov ax, 1110h
182 mov bh, 16
183 xor bl, bl
184 mov cx, 0FFh
185 xor dx, dx
186 mov bp, offset CharsetTempBuffer ; ES:BP - New charset
187 int 10h ; VIDEO BIOS: Set new charset table
188 mov ah, 12h
189 mov bl, 30h
190 mov al, 2 ; 400 ScanLines
191 int 10h ; VIDEO BIOS: Set Scanlines
192 ret
193CHARSET_SetCutsomGlyphs EndP
Note: See TracBrowser for help on using the repository browser.