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
|
---|
28 | IF 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 | ; -----------------------------------------------------------------------------
|
---|
38 | CHARSET_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
|
---|
94 | CHARSET_IncludeSpanish EndP
|
---|
95 |
|
---|
96 | ENDIF
|
---|
97 |
|
---|
98 |
|
---|
99 | ; We are building for Russian so enable compressed glyph injection to load the CP866 glyphs
|
---|
100 | IF 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 | ; -----------------------------------------------------------------------------
|
---|
109 | CHARSET_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
|
---|
147 | CHARSET_IncludeCyrillic EndP
|
---|
148 |
|
---|
149 | ENDIF
|
---|
150 |
|
---|
151 |
|
---|
152 |
|
---|
153 | ; -----------------------------------------------------------------------------
|
---|
154 | ; Get the standard CP437 glyphs from the video-bios -- (400 scanlines version)
|
---|
155 | ; -----------------------------------------------------------------------------
|
---|
156 | ; Returns ES:BP pointer to charset (in Video-ROM)
|
---|
157 | ; http://www.ctyme.com/intr/rb-0158.htm
|
---|
158 | ; -----------------------------------------------------------------------------
|
---|
159 | CHARSET_GetRomGlyphs Proc
|
---|
160 | mov ax, 1130h
|
---|
161 | mov bh, 6 ; Get ROM VGA 25x80 charset
|
---|
162 | int 10h ; VIDEO BIOS: Get charset table pointer
|
---|
163 | mov bx, ds
|
---|
164 | mov ax, es
|
---|
165 | mov es, bx ; ES now points to Data-Segment (dest)
|
---|
166 | mov ds, ax ; DS now points to Video-ROM (src)
|
---|
167 | mov si, bp ; SI now points to ROM Font 25x80
|
---|
168 | mov di, offset CharsetTempBuffer ; Located in BSS
|
---|
169 | mov cx, 2048
|
---|
170 | rep movsw ; Copy ROM-charset to Temp-Buffer in BSS
|
---|
171 | mov ds, bx ; Restore DS (DS==ES==CS)
|
---|
172 | ret
|
---|
173 | CHARSET_GetRomGlyphs EndP
|
---|
174 |
|
---|
175 |
|
---|
176 |
|
---|
177 | ; -----------------------------------------------------------------------------
|
---|
178 | ; Set the custom glyphs for the video-adapter assuming 400 scanlines
|
---|
179 | ; -----------------------------------------------------------------------------
|
---|
180 | ; rousseau.comment.201807071938 :: Changed call from 0x1110 to 0x1100
|
---|
181 | ; On a HP Pavilion dv9000 laptop, when pressing TAB to switch to preboot-menu,
|
---|
182 | ; the text did not start at 0,0 anymore but was moved some 50 odd characters
|
---|
183 | ; to the right. However, the preboot-menu was displayed correctly during the
|
---|
184 | ; scanning phase, so the quirk occurred when the preboot-menu was moved to the
|
---|
185 | ; second video-page. Information from Ralph Brown does state that for 0x1110h
|
---|
186 | ; video-page 0 needs to be active, which might not be the case when the custom
|
---|
187 | ; glyphs are loaded. Switching to 0x1100 solves the problem on the HP Pavilion
|
---|
188 | ; and the other test-laptop, which did not have this quirk, still works fine.
|
---|
189 | ; That leaves the question why 0x1110 was chosen by Martin in the first place.
|
---|
190 | ; http://www.ctyme.com/intr/rb-0136.htm <!-- 0x1100 -->
|
---|
191 | ; http://www.ctyme.com/intr/rb-0143.htm <!-- 0x1110 ~~ video page 0 remark -->
|
---|
192 | ; -----------------------------------------------------------------------------
|
---|
193 | CHARSET_SetCutsomGlyphs Proc
|
---|
194 | IFDEF FX_ENABLED
|
---|
195 | call FX_WaitRetrace ; Wait for retrace to reduce flickering
|
---|
196 | ENDIF
|
---|
197 | ;~ mov ax, 1110h ; Works quirky on HP Pavilion dv9000
|
---|
198 | mov ax, 1100h ; Works OK on HP Pavilion dv9000
|
---|
199 | mov bh, 16
|
---|
200 | xor bl, bl
|
---|
201 | mov cx, 0FFh
|
---|
202 | xor dx, dx
|
---|
203 | mov bp, offset CharsetTempBuffer ; ES:BP - New charset
|
---|
204 | int 10h ; VIDEO BIOS: Set new charset table
|
---|
205 | mov ah, 12h
|
---|
206 | mov bl, 30h
|
---|
207 | mov al, 2 ; 400 ScanLines
|
---|
208 | int 10h ; VIDEO BIOS: Set Scanlines
|
---|
209 | ret
|
---|
210 | CHARSET_SetCutsomGlyphs EndP
|
---|