1 | ;; ============================================================================================
|
---|
2 | ;;
|
---|
3 | ;; Copyright (C) 2001,2002 the LGPL VGABios developers Team
|
---|
4 | ;;
|
---|
5 | ;; This library is free software; you can redistribute it and/or
|
---|
6 | ;; modify it under the terms of the GNU Lesser General Public
|
---|
7 | ;; License as published by the Free Software Foundation; either
|
---|
8 | ;; version 2 of the License, or (at your option) any later version.
|
---|
9 | ;;
|
---|
10 | ;; This library is distributed in the hope that it will be useful,
|
---|
11 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
13 | ;; Lesser General Public License for more details.
|
---|
14 | ;;
|
---|
15 | ;; You should have received a copy of the GNU Lesser General Public
|
---|
16 | ;; License along with this library; if not, write to the Free Software
|
---|
17 | ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
18 | ;;
|
---|
19 | ;; ============================================================================================
|
---|
20 | ;;
|
---|
21 | ;; This VGA Bios is specific to the plex86/bochs Emulated VGA card.
|
---|
22 | ;; You can NOT drive any physical vga card with it.
|
---|
23 | ;;
|
---|
24 | ;; ============================================================================================
|
---|
25 | ;;
|
---|
26 |
|
---|
27 |
|
---|
28 | ; Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
29 | ; other than GPL or LGPL is available it will apply instead, Oracle elects to use only
|
---|
30 | ; the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
31 | ; a choice of LGPL license versions is made available with the language indicating
|
---|
32 | ; that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
33 | ; of the LGPL is applied is otherwise unspecified.
|
---|
34 |
|
---|
35 | include vgadefs.inc
|
---|
36 |
|
---|
37 | public vgabios_int10_handler
|
---|
38 |
|
---|
39 | VGAROM segment public 'CODE'
|
---|
40 |
|
---|
41 | ; Implemented in C
|
---|
42 | extrn _int10_func:near
|
---|
43 | extrn _vgabios_init_func:near
|
---|
44 |
|
---|
45 | ifdef VBE
|
---|
46 | ; Implemented in separate assembly module
|
---|
47 | extrn vbe_biosfn_return_current_mode:near
|
---|
48 | extrn vbe_biosfn_display_window_control:near
|
---|
49 | extrn vbe_biosfn_set_get_logical_scan_line_length:near
|
---|
50 | extrn vbe_biosfn_set_get_display_start:near
|
---|
51 | extrn vbe_biosfn_set_get_dac_palette_format:near
|
---|
52 | extrn vbe_biosfn_set_get_palette_data:near
|
---|
53 | extrn vbe_biosfn_return_protected_mode_interface:near
|
---|
54 | endif
|
---|
55 |
|
---|
56 | ifdef VGA_DEBUG
|
---|
57 | extrn _int10_debugmsg:near
|
---|
58 | extrn _printf:near
|
---|
59 | extrn _unimplemented:near
|
---|
60 | extrn _unknown:near
|
---|
61 | endif
|
---|
62 |
|
---|
63 | vgabios_start:
|
---|
64 |
|
---|
65 | db 055h, 0AAh ; ROM signature, required for expansion ROMs
|
---|
66 | db 40h ; ROM module length in units of 512 bytes */
|
---|
67 |
|
---|
68 |
|
---|
69 | vgabios_entry_point:
|
---|
70 |
|
---|
71 | jmp _vgabios_init_func
|
---|
72 |
|
---|
73 | org 1Eh
|
---|
74 |
|
---|
75 | db 'IBM',0
|
---|
76 |
|
---|
77 | ;;
|
---|
78 | ;; int10 handled here
|
---|
79 | ;;
|
---|
80 |
|
---|
81 | .286
|
---|
82 |
|
---|
83 | vgabios_int10_handler:
|
---|
84 | pushf
|
---|
85 | ifdef VGA_DEBUG
|
---|
86 | push es
|
---|
87 | push ds
|
---|
88 | pusha
|
---|
89 | mov bx, 0C000h
|
---|
90 | mov ds, bx
|
---|
91 | call _int10_debugmsg
|
---|
92 | popa
|
---|
93 | pop ds
|
---|
94 | pop es
|
---|
95 | endif
|
---|
96 | cmp ah, 0Fh
|
---|
97 | jne int10_test_1A
|
---|
98 | call biosfn_get_video_mode
|
---|
99 | jmp int10_end
|
---|
100 | int10_test_1A:
|
---|
101 | cmp ah, 1Ah
|
---|
102 | jne int10_test_0B
|
---|
103 | call biosfn_group_1A
|
---|
104 | jmp int10_end
|
---|
105 | int10_test_0B:
|
---|
106 | cmp ah, 0Bh
|
---|
107 | jne int10_test_1103
|
---|
108 | call biosfn_group_0B
|
---|
109 | jmp int10_end
|
---|
110 | int10_test_1103:
|
---|
111 | cmp ax, 1103h
|
---|
112 | jne int10_test_12
|
---|
113 | call biosfn_set_text_block_specifier
|
---|
114 | jmp int10_end
|
---|
115 | int10_test_12:
|
---|
116 | cmp ah, 12h
|
---|
117 | jne int10_test_101B
|
---|
118 | cmp bl, 10h
|
---|
119 | jne int10_test_BL30
|
---|
120 | call biosfn_get_ega_info
|
---|
121 | jmp int10_end
|
---|
122 | int10_test_BL30:
|
---|
123 | cmp bl, 30h
|
---|
124 | jne int10_test_BL31
|
---|
125 | call biosfn_select_vert_res
|
---|
126 | jmp int10_end
|
---|
127 | int10_test_BL31:
|
---|
128 | cmp bl, 31h
|
---|
129 | jne int10_test_BL32
|
---|
130 | call biosfn_enable_default_palette_loading
|
---|
131 | jmp int10_end
|
---|
132 | int10_test_BL32:
|
---|
133 | cmp bl, 32h
|
---|
134 | jne int10_test_BL33
|
---|
135 | call biosfn_enable_video_addressing
|
---|
136 | jmp int10_end
|
---|
137 | int10_test_BL33:
|
---|
138 | cmp bl, 33h
|
---|
139 | jne int10_test_BL34
|
---|
140 | call biosfn_enable_grayscale_summing
|
---|
141 | jmp int10_end
|
---|
142 | int10_test_BL34:
|
---|
143 | cmp bl, 34h
|
---|
144 | jne int10_normal
|
---|
145 | call biosfn_enable_cursor_emulation
|
---|
146 | jmp int10_end
|
---|
147 | int10_test_101B:
|
---|
148 | cmp ax, 101Bh
|
---|
149 | je int10_normal
|
---|
150 | cmp ah, 10h
|
---|
151 | ifndef VBE
|
---|
152 | jne int10_normal
|
---|
153 | else
|
---|
154 | jne int10_test_4F
|
---|
155 | endif
|
---|
156 | call biosfn_group_10
|
---|
157 | jmp int10_end
|
---|
158 | ifdef VBE
|
---|
159 | int10_test_4F:
|
---|
160 | cmp ah, 4Fh
|
---|
161 | jne int10_normal
|
---|
162 | cmp al, 3
|
---|
163 | jne int10_test_vbe_05
|
---|
164 | call vbe_biosfn_return_current_mode
|
---|
165 | jmp int10_end
|
---|
166 | int10_test_vbe_05:
|
---|
167 | cmp al, 5
|
---|
168 | jne int10_test_vbe_06
|
---|
169 | call vbe_biosfn_display_window_control
|
---|
170 | jmp int10_end
|
---|
171 | int10_test_vbe_06:
|
---|
172 | cmp al, 6
|
---|
173 | jne int10_test_vbe_07
|
---|
174 | call vbe_biosfn_set_get_logical_scan_line_length
|
---|
175 | jmp int10_end
|
---|
176 | int10_test_vbe_07:
|
---|
177 | cmp al, 7
|
---|
178 | jne int10_test_vbe_08
|
---|
179 | call vbe_biosfn_set_get_display_start
|
---|
180 | jmp int10_end
|
---|
181 | int10_test_vbe_08:
|
---|
182 | cmp al, 8
|
---|
183 | jne int10_test_vbe_09
|
---|
184 | call vbe_biosfn_set_get_dac_palette_format
|
---|
185 | jmp int10_end
|
---|
186 | int10_test_vbe_09:
|
---|
187 | cmp al, 9
|
---|
188 | jne int10_test_vbe_0A
|
---|
189 | call vbe_biosfn_set_get_palette_data
|
---|
190 | jmp int10_end
|
---|
191 | int10_test_vbe_0A:
|
---|
192 | cmp al, 0Ah
|
---|
193 | jne int10_normal
|
---|
194 | call vbe_biosfn_return_protected_mode_interface
|
---|
195 | jmp int10_end
|
---|
196 | endif
|
---|
197 |
|
---|
198 | int10_normal:
|
---|
199 | push es
|
---|
200 | push ds
|
---|
201 | pusha
|
---|
202 |
|
---|
203 | ;; We have to set ds to access the right data segment
|
---|
204 | mov bx, 0C000h
|
---|
205 | mov ds, bx
|
---|
206 | call _int10_func
|
---|
207 |
|
---|
208 | popa
|
---|
209 | pop ds
|
---|
210 | pop es
|
---|
211 | int10_end:
|
---|
212 | popf
|
---|
213 | iret
|
---|
214 |
|
---|
215 | ;;--------------------------------------------------------------------------------------------
|
---|
216 |
|
---|
217 | biosfn_group_0B:
|
---|
218 | cmp bh, 0
|
---|
219 | je biosfn_set_border_color
|
---|
220 | cmp bh, 1
|
---|
221 | je biosfn_set_palette
|
---|
222 | ifdef VGA_DEBUG
|
---|
223 | call _unknown
|
---|
224 | endif
|
---|
225 | ret
|
---|
226 | biosfn_set_border_color:
|
---|
227 | push ax
|
---|
228 | push bx
|
---|
229 | push cx
|
---|
230 | push dx
|
---|
231 | push ds
|
---|
232 | mov dx, BIOSMEM_SEG
|
---|
233 | mov ds, dx
|
---|
234 | mov dx, VGAREG_ACTL_RESET
|
---|
235 | in al, dx
|
---|
236 | cmp byte ptr ds:[BIOSMEM_CURRENT_MODE], 3
|
---|
237 | jbe set_border_done
|
---|
238 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
239 | mov al, 00h
|
---|
240 | out dx, al
|
---|
241 | mov al, bl
|
---|
242 | and al, 0Fh
|
---|
243 | test al, 08h
|
---|
244 | jz set_low_border
|
---|
245 | add al, 08h
|
---|
246 | set_low_border:
|
---|
247 | out dx, al
|
---|
248 | mov cl, 1
|
---|
249 | and bl, 10h
|
---|
250 | set_intensity_loop:
|
---|
251 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
252 | mov al, cl
|
---|
253 | out dx, al
|
---|
254 | mov dx, VGAREG_ACTL_READ_DATA
|
---|
255 | in al, dx
|
---|
256 | and al, 0EFh
|
---|
257 | or al, bl
|
---|
258 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
259 | out dx, al
|
---|
260 | inc cl
|
---|
261 | cmp cl, 4
|
---|
262 | jne set_intensity_loop
|
---|
263 | set_border_done:
|
---|
264 | mov al, 20h
|
---|
265 | out dx, al
|
---|
266 | ifdef VBOX
|
---|
267 | mov dx, VGAREG_ACTL_RESET
|
---|
268 | in al, dx
|
---|
269 | endif ; VBOX
|
---|
270 | pop ds
|
---|
271 | pop dx
|
---|
272 | pop cx
|
---|
273 | pop bx
|
---|
274 | pop ax
|
---|
275 | ret
|
---|
276 | biosfn_set_palette:
|
---|
277 | push ax
|
---|
278 | push bx
|
---|
279 | push cx
|
---|
280 | push dx
|
---|
281 | mov dx, VGAREG_ACTL_RESET
|
---|
282 | in al, dx
|
---|
283 | mov cl, 01
|
---|
284 | and bl, 01
|
---|
285 | set_cga_palette_loop:
|
---|
286 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
287 | mov al, cl
|
---|
288 | out dx, al
|
---|
289 | mov dx, VGAREG_ACTL_READ_DATA
|
---|
290 | in al, dx
|
---|
291 | and al, 0FEh
|
---|
292 | or al, bl
|
---|
293 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
294 | out dx, al
|
---|
295 | inc cl
|
---|
296 | cmp cl, 4
|
---|
297 | jne set_cga_palette_loop
|
---|
298 | mov al, 20h
|
---|
299 | out dx, al
|
---|
300 | ifdef VBOX
|
---|
301 | mov dx, VGAREG_ACTL_RESET
|
---|
302 | in al, dx
|
---|
303 | endif ; VBOX
|
---|
304 | pop dx
|
---|
305 | pop cx
|
---|
306 | pop bx
|
---|
307 | pop ax
|
---|
308 | ret
|
---|
309 |
|
---|
310 | ;;--------------------------------------------------------------------------------------------
|
---|
311 |
|
---|
312 | biosfn_get_video_mode:
|
---|
313 | push ds
|
---|
314 | mov ax, BIOSMEM_SEG
|
---|
315 | mov ds, ax
|
---|
316 | push bx
|
---|
317 | mov bx, BIOSMEM_CURRENT_PAGE
|
---|
318 | mov al, [bx]
|
---|
319 | pop bx
|
---|
320 | mov bh, al
|
---|
321 | push bx
|
---|
322 | mov bx, BIOSMEM_VIDEO_CTL
|
---|
323 | mov ah, [bx]
|
---|
324 | and ah, 80h
|
---|
325 | mov bx, BIOSMEM_CURRENT_MODE
|
---|
326 | mov al, [bx]
|
---|
327 | or al, ah
|
---|
328 | mov bx, BIOSMEM_NB_COLS
|
---|
329 | mov ah, [bx]
|
---|
330 | pop bx
|
---|
331 | pop ds
|
---|
332 | ret
|
---|
333 |
|
---|
334 | ;--------------------------------------------------------------------------------------------
|
---|
335 |
|
---|
336 | biosfn_group_10:
|
---|
337 | cmp al, 0
|
---|
338 | jne int10_test_1001
|
---|
339 | jmp biosfn_set_single_palette_reg
|
---|
340 | int10_test_1001:
|
---|
341 | cmp al, 1
|
---|
342 | jne int10_test_1002
|
---|
343 | jmp biosfn_set_overscan_border_color
|
---|
344 | int10_test_1002:
|
---|
345 | cmp al, 2
|
---|
346 | jne int10_test_1003
|
---|
347 | jmp biosfn_set_all_palette_reg
|
---|
348 | int10_test_1003:
|
---|
349 | cmp al, 3
|
---|
350 | jne int10_test_1007
|
---|
351 | jmp biosfn_toggle_intensity
|
---|
352 | int10_test_1007:
|
---|
353 | cmp al, 7
|
---|
354 | jne int10_test_1008
|
---|
355 | jmp biosfn_get_single_palette_reg
|
---|
356 | int10_test_1008:
|
---|
357 | cmp al, 8
|
---|
358 | jne int10_test_1009
|
---|
359 | jmp biosfn_read_overscan_border_color
|
---|
360 | int10_test_1009:
|
---|
361 | cmp al, 9
|
---|
362 | jne int10_test_1010
|
---|
363 | jmp biosfn_get_all_palette_reg
|
---|
364 | int10_test_1010:
|
---|
365 | cmp al, 10h
|
---|
366 | jne int10_test_1012
|
---|
367 | jmp biosfn_set_single_dac_reg
|
---|
368 | int10_test_1012:
|
---|
369 | cmp al, 12h
|
---|
370 | jne int10_test_1013
|
---|
371 | jmp biosfn_set_all_dac_reg
|
---|
372 | int10_test_1013:
|
---|
373 | cmp al, 13h
|
---|
374 | jne int10_test_1015
|
---|
375 | jmp biosfn_select_video_dac_color_page
|
---|
376 | int10_test_1015:
|
---|
377 | cmp al, 15h
|
---|
378 | jne int10_test_1017
|
---|
379 | jmp biosfn_read_single_dac_reg
|
---|
380 | int10_test_1017:
|
---|
381 | cmp al, 17h
|
---|
382 | jne int10_test_1018
|
---|
383 | jmp biosfn_read_all_dac_reg
|
---|
384 | int10_test_1018:
|
---|
385 | cmp al, 18h
|
---|
386 | jne int10_test_1019
|
---|
387 | jmp biosfn_set_pel_mask
|
---|
388 | int10_test_1019:
|
---|
389 | cmp al, 19h
|
---|
390 | jne int10_test_101A
|
---|
391 | jmp biosfn_read_pel_mask
|
---|
392 | int10_test_101A:
|
---|
393 | cmp al, 1Ah
|
---|
394 | jne int10_group_10_unknown
|
---|
395 | jmp biosfn_read_video_dac_state
|
---|
396 | int10_group_10_unknown:
|
---|
397 | ifdef VGA_DEBUG
|
---|
398 | call _unknown
|
---|
399 | endif
|
---|
400 | ret
|
---|
401 |
|
---|
402 | biosfn_set_single_palette_reg:
|
---|
403 | cmp bl, 14h
|
---|
404 | ja no_actl_reg1
|
---|
405 | push ax
|
---|
406 | push dx
|
---|
407 | mov dx, VGAREG_ACTL_RESET
|
---|
408 | in al, dx
|
---|
409 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
410 | mov al, bl
|
---|
411 | out dx, al
|
---|
412 | mov al, bh
|
---|
413 | out dx, al
|
---|
414 | mov al, 20h
|
---|
415 | out dx, al
|
---|
416 | ifdef VBOX
|
---|
417 | mov dx, VGAREG_ACTL_RESET
|
---|
418 | in al, dx
|
---|
419 | endif ; VBOX
|
---|
420 | pop dx
|
---|
421 | pop ax
|
---|
422 | no_actl_reg1:
|
---|
423 | ret
|
---|
424 |
|
---|
425 | ;--------------------------------------------------------------------------------------------
|
---|
426 |
|
---|
427 | biosfn_set_overscan_border_color:
|
---|
428 | push bx
|
---|
429 | mov bl, 11h
|
---|
430 | call biosfn_set_single_palette_reg
|
---|
431 | pop bx
|
---|
432 | ret
|
---|
433 |
|
---|
434 | ;--------------------------------------------------------------------------------------------
|
---|
435 |
|
---|
436 | biosfn_set_all_palette_reg:
|
---|
437 | push ax
|
---|
438 | push bx
|
---|
439 | push cx
|
---|
440 | push dx
|
---|
441 | mov bx, dx
|
---|
442 | mov dx, VGAREG_ACTL_RESET
|
---|
443 | in al, dx
|
---|
444 | mov cl, 0
|
---|
445 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
446 | set_palette_loop:
|
---|
447 | mov al, cl
|
---|
448 | out dx, al
|
---|
449 | mov al, es:[bx]
|
---|
450 | out dx, al
|
---|
451 | inc bx
|
---|
452 | inc cl
|
---|
453 | cmp cl, 10h
|
---|
454 | jne set_palette_loop
|
---|
455 | mov al, 11h
|
---|
456 | out dx, al
|
---|
457 | mov al, es:[bx]
|
---|
458 | out dx, al
|
---|
459 | mov al, 20h
|
---|
460 | out dx, al
|
---|
461 | ifdef VBOX
|
---|
462 | mov dx, VGAREG_ACTL_RESET
|
---|
463 | in al, dx
|
---|
464 | endif ; VBOX
|
---|
465 | pop dx
|
---|
466 | pop cx
|
---|
467 | pop bx
|
---|
468 | pop ax
|
---|
469 | ret
|
---|
470 |
|
---|
471 | ;;--------------------------------------------------------------------------------------------
|
---|
472 |
|
---|
473 | biosfn_toggle_intensity:
|
---|
474 | push ax
|
---|
475 | push bx
|
---|
476 | push dx
|
---|
477 | mov dx, VGAREG_ACTL_RESET
|
---|
478 | in al, dx
|
---|
479 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
480 | mov al, 10h
|
---|
481 | out dx, al
|
---|
482 | mov dx, VGAREG_ACTL_READ_DATA
|
---|
483 | in al, dx
|
---|
484 | and al, 0F7h
|
---|
485 | and bl, 01
|
---|
486 | shl bl, 3
|
---|
487 | or al, bl
|
---|
488 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
489 | out dx, al
|
---|
490 | mov al, 20h
|
---|
491 | out dx, al
|
---|
492 | ifdef VBOX
|
---|
493 | mov dx, VGAREG_ACTL_RESET
|
---|
494 | in al, dx
|
---|
495 | endif ; VBOX
|
---|
496 | pop dx
|
---|
497 | pop bx
|
---|
498 | pop ax
|
---|
499 | ret
|
---|
500 |
|
---|
501 | ;;--------------------------------------------------------------------------------------------
|
---|
502 |
|
---|
503 | biosfn_get_single_palette_reg:
|
---|
504 | cmp bl, 14h
|
---|
505 | ja no_actl_reg2
|
---|
506 | push ax
|
---|
507 | push dx
|
---|
508 | mov dx, VGAREG_ACTL_RESET
|
---|
509 | in al, dx
|
---|
510 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
511 | mov al, bl
|
---|
512 | out dx, al
|
---|
513 | mov dx, VGAREG_ACTL_READ_DATA
|
---|
514 | in al, dx
|
---|
515 | mov bh, al
|
---|
516 | mov dx, VGAREG_ACTL_RESET
|
---|
517 | in al, dx
|
---|
518 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
519 | mov al, 20h
|
---|
520 | out dx, al
|
---|
521 | ifdef VBOX
|
---|
522 | mov dx, VGAREG_ACTL_RESET
|
---|
523 | in al, dx
|
---|
524 | endif ; VBOX
|
---|
525 | pop dx
|
---|
526 | pop ax
|
---|
527 | no_actl_reg2:
|
---|
528 | ret
|
---|
529 |
|
---|
530 | ;;--------------------------------------------------------------------------------------------
|
---|
531 |
|
---|
532 | biosfn_read_overscan_border_color:
|
---|
533 | push ax
|
---|
534 | push bx
|
---|
535 | mov bl, 11h
|
---|
536 | call biosfn_get_single_palette_reg
|
---|
537 | mov al, bh
|
---|
538 | pop bx
|
---|
539 | mov bh, al
|
---|
540 | pop ax
|
---|
541 | ret
|
---|
542 |
|
---|
543 | ;;--------------------------------------------------------------------------------------------
|
---|
544 |
|
---|
545 | biosfn_get_all_palette_reg:
|
---|
546 | push ax
|
---|
547 | push bx
|
---|
548 | push cx
|
---|
549 | push dx
|
---|
550 | mov bx, dx
|
---|
551 | mov cl, 0
|
---|
552 | get_palette_loop:
|
---|
553 | mov dx, VGAREG_ACTL_RESET
|
---|
554 | in al, dx
|
---|
555 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
556 | mov al, cl
|
---|
557 | out dx, al
|
---|
558 | mov dx, VGAREG_ACTL_READ_DATA
|
---|
559 | in al, dx
|
---|
560 | mov es:[bx], al
|
---|
561 | inc bx
|
---|
562 | inc cl
|
---|
563 | cmp cl, 10h
|
---|
564 | jne get_palette_loop
|
---|
565 | mov dx, VGAREG_ACTL_RESET
|
---|
566 | in al, dx
|
---|
567 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
568 | mov al, 11h
|
---|
569 | out dx, al
|
---|
570 | mov dx, VGAREG_ACTL_READ_DATA
|
---|
571 | in al, dx
|
---|
572 | mov es:[bx], al
|
---|
573 | mov dx, VGAREG_ACTL_RESET
|
---|
574 | in al, dx
|
---|
575 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
576 | mov al, 20h
|
---|
577 | out dx, al
|
---|
578 | ifdef VBOX
|
---|
579 | mov dx, VGAREG_ACTL_RESET
|
---|
580 | in al, dx
|
---|
581 | endif ; VBOX
|
---|
582 | pop dx
|
---|
583 | pop cx
|
---|
584 | pop bx
|
---|
585 | pop ax
|
---|
586 | ret
|
---|
587 |
|
---|
588 | ;;--------------------------------------------------------------------------------------------
|
---|
589 |
|
---|
590 | biosfn_set_single_dac_reg:
|
---|
591 | push ax
|
---|
592 | push dx
|
---|
593 | mov dx, VGAREG_DAC_WRITE_ADDRESS
|
---|
594 | mov al, bl
|
---|
595 | out dx, al
|
---|
596 | mov dx, VGAREG_DAC_DATA
|
---|
597 | pop ax
|
---|
598 | push ax
|
---|
599 | mov al, ah
|
---|
600 | out dx, al
|
---|
601 | mov al, ch
|
---|
602 | out dx, al
|
---|
603 | mov al, cl
|
---|
604 | out dx, al
|
---|
605 | pop dx
|
---|
606 | pop ax
|
---|
607 | ret
|
---|
608 |
|
---|
609 | ;;--------------------------------------------------------------------------------------------
|
---|
610 |
|
---|
611 | biosfn_set_all_dac_reg:
|
---|
612 | push ax
|
---|
613 | push bx
|
---|
614 | push cx
|
---|
615 | push dx
|
---|
616 | mov dx, VGAREG_DAC_WRITE_ADDRESS
|
---|
617 | mov al, bl
|
---|
618 | out dx, al
|
---|
619 | pop dx
|
---|
620 | push dx
|
---|
621 | mov bx, dx
|
---|
622 | mov dx, VGAREG_DAC_DATA
|
---|
623 | set_dac_loop:
|
---|
624 | mov al, es:[bx]
|
---|
625 | out dx, al
|
---|
626 | inc bx
|
---|
627 | mov al, es:[bx]
|
---|
628 | out dx, al
|
---|
629 | inc bx
|
---|
630 | mov al, es:[bx]
|
---|
631 | out dx, al
|
---|
632 | inc bx
|
---|
633 | dec cx
|
---|
634 | jnz set_dac_loop
|
---|
635 | pop dx
|
---|
636 | pop cx
|
---|
637 | pop bx
|
---|
638 | pop ax
|
---|
639 | ret
|
---|
640 |
|
---|
641 | ;;--------------------------------------------------------------------------------------------
|
---|
642 |
|
---|
643 | biosfn_select_video_dac_color_page:
|
---|
644 | push ax
|
---|
645 | push bx
|
---|
646 | push dx
|
---|
647 | mov dx, VGAREG_ACTL_RESET
|
---|
648 | in al, dx
|
---|
649 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
650 | mov al, 10h
|
---|
651 | out dx, al
|
---|
652 | mov dx, VGAREG_ACTL_READ_DATA
|
---|
653 | in al, dx
|
---|
654 | and bl, 01
|
---|
655 | jnz set_dac_page
|
---|
656 | and al, 07Fh
|
---|
657 | shl bh, 7
|
---|
658 | or al, bh
|
---|
659 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
660 | out dx, al
|
---|
661 | jmp set_actl_normal
|
---|
662 | set_dac_page:
|
---|
663 | push ax
|
---|
664 | mov dx, VGAREG_ACTL_RESET
|
---|
665 | in al, dx
|
---|
666 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
667 | mov al, 14h
|
---|
668 | out dx, al
|
---|
669 | pop ax
|
---|
670 | and al, 80h
|
---|
671 | jnz set_dac_16_page
|
---|
672 | shl bh, 2
|
---|
673 | set_dac_16_page:
|
---|
674 | and bh, 0Fh
|
---|
675 | mov al, bh
|
---|
676 | out dx, al
|
---|
677 | set_actl_normal:
|
---|
678 | mov al, 20h
|
---|
679 | out dx, al
|
---|
680 | ifdef VBOX
|
---|
681 | mov dx, VGAREG_ACTL_RESET
|
---|
682 | in al, dx
|
---|
683 | endif ; VBOX
|
---|
684 | pop dx
|
---|
685 | pop bx
|
---|
686 | pop ax
|
---|
687 | ret
|
---|
688 |
|
---|
689 | ;;--------------------------------------------------------------------------------------------
|
---|
690 |
|
---|
691 | biosfn_read_single_dac_reg:
|
---|
692 | push ax
|
---|
693 | push dx
|
---|
694 | mov dx, VGAREG_DAC_READ_ADDRESS
|
---|
695 | mov al, bl
|
---|
696 | out dx, al
|
---|
697 | pop ax
|
---|
698 | mov ah, al
|
---|
699 | mov dx, VGAREG_DAC_DATA
|
---|
700 | in al, dx
|
---|
701 | xchg al, ah
|
---|
702 | push ax
|
---|
703 | in al, dx
|
---|
704 | mov ch, al
|
---|
705 | in al, dx
|
---|
706 | mov cl, al
|
---|
707 | pop dx
|
---|
708 | pop ax
|
---|
709 | ret
|
---|
710 |
|
---|
711 | ;;--------------------------------------------------------------------------------------------
|
---|
712 |
|
---|
713 | biosfn_read_all_dac_reg:
|
---|
714 | push ax
|
---|
715 | push bx
|
---|
716 | push cx
|
---|
717 | push dx
|
---|
718 | mov dx, VGAREG_DAC_READ_ADDRESS
|
---|
719 | mov al, bl
|
---|
720 | out dx, al
|
---|
721 | pop dx
|
---|
722 | push dx
|
---|
723 | mov bx, dx
|
---|
724 | mov dx, VGAREG_DAC_DATA
|
---|
725 | read_dac_loop:
|
---|
726 | in al, dx
|
---|
727 | mov es:[bx], al
|
---|
728 | inc bx
|
---|
729 | in al, dx
|
---|
730 | mov es:[bx], al
|
---|
731 | inc bx
|
---|
732 | in al, dx
|
---|
733 | mov es:[bx], al
|
---|
734 | inc bx
|
---|
735 | dec cx
|
---|
736 | jnz read_dac_loop
|
---|
737 | pop dx
|
---|
738 | pop cx
|
---|
739 | pop bx
|
---|
740 | pop ax
|
---|
741 | ret
|
---|
742 |
|
---|
743 | ;;--------------------------------------------------------------------------------------------
|
---|
744 |
|
---|
745 | biosfn_set_pel_mask:
|
---|
746 | push ax
|
---|
747 | push dx
|
---|
748 | mov dx, VGAREG_PEL_MASK
|
---|
749 | mov al, bl
|
---|
750 | out dx, al
|
---|
751 | pop dx
|
---|
752 | pop ax
|
---|
753 | ret
|
---|
754 |
|
---|
755 | ;;--------------------------------------------------------------------------------------------
|
---|
756 |
|
---|
757 | biosfn_read_pel_mask:
|
---|
758 | push ax
|
---|
759 | push dx
|
---|
760 | mov dx, VGAREG_PEL_MASK
|
---|
761 | in al, dx
|
---|
762 | mov bl, al
|
---|
763 | pop dx
|
---|
764 | pop ax
|
---|
765 | ret
|
---|
766 |
|
---|
767 | ;;--------------------------------------------------------------------------------------------
|
---|
768 |
|
---|
769 | biosfn_read_video_dac_state:
|
---|
770 | push ax
|
---|
771 | push dx
|
---|
772 | mov dx, VGAREG_ACTL_RESET
|
---|
773 | in al, dx
|
---|
774 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
775 | mov al, 10h
|
---|
776 | out dx, al
|
---|
777 | mov dx, VGAREG_ACTL_READ_DATA
|
---|
778 | in al, dx
|
---|
779 | mov bl, al
|
---|
780 | shr bl, 7
|
---|
781 | mov dx, VGAREG_ACTL_RESET
|
---|
782 | in al, dx
|
---|
783 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
784 | mov al, 14h
|
---|
785 | out dx, al
|
---|
786 | mov dx, VGAREG_ACTL_READ_DATA
|
---|
787 | in al, dx
|
---|
788 | mov bh, al
|
---|
789 | and bh, 0Fh
|
---|
790 | test bl, 01
|
---|
791 | jnz get_dac_16_page
|
---|
792 | shr bh, 2
|
---|
793 | get_dac_16_page:
|
---|
794 | mov dx, VGAREG_ACTL_RESET
|
---|
795 | in al, dx
|
---|
796 | mov dx, VGAREG_ACTL_ADDRESS
|
---|
797 | mov al, 20h
|
---|
798 | out dx, al
|
---|
799 | ifdef VBOX
|
---|
800 | mov dx, VGAREG_ACTL_RESET
|
---|
801 | in al, dx
|
---|
802 | endif ; VBOX
|
---|
803 | pop dx
|
---|
804 | pop ax
|
---|
805 | ret
|
---|
806 |
|
---|
807 | ;;--------------------------------------------------------------------------------------------
|
---|
808 |
|
---|
809 | biosfn_set_text_block_specifier:
|
---|
810 | push ax
|
---|
811 | push dx
|
---|
812 | mov dx, VGAREG_SEQU_ADDRESS
|
---|
813 | mov ah, bl
|
---|
814 | mov al, 03
|
---|
815 | out dx, ax
|
---|
816 | pop dx
|
---|
817 | pop ax
|
---|
818 | ret
|
---|
819 |
|
---|
820 | ;;--------------------------------------------------------------------------------------------
|
---|
821 |
|
---|
822 | biosfn_get_ega_info:
|
---|
823 | push ds
|
---|
824 | push ax
|
---|
825 | mov ax, BIOSMEM_SEG
|
---|
826 | mov ds, ax
|
---|
827 | xor ch, ch
|
---|
828 | mov bx, BIOSMEM_SWITCHES
|
---|
829 | mov cl, [bx]
|
---|
830 | and cl, 0Fh
|
---|
831 | mov bx, BIOSMEM_CRTC_ADDRESS
|
---|
832 | mov ax, [bx]
|
---|
833 | mov bx, 0003h
|
---|
834 | cmp ax, VGAREG_MDA_CRTC_ADDRESS
|
---|
835 | jne mode_ega_color
|
---|
836 | mov bh, 01
|
---|
837 | mode_ega_color:
|
---|
838 | pop ax
|
---|
839 | pop ds
|
---|
840 | ret
|
---|
841 |
|
---|
842 | ;;--------------------------------------------------------------------------------------------
|
---|
843 |
|
---|
844 | biosfn_select_vert_res:
|
---|
845 |
|
---|
846 | ; res : 00 200 lines, 01 350 lines, 02 400 lines
|
---|
847 |
|
---|
848 | push ds
|
---|
849 | push bx
|
---|
850 | push dx
|
---|
851 | mov dl, al
|
---|
852 | mov ax, BIOSMEM_SEG
|
---|
853 | mov ds, ax
|
---|
854 | mov bx, BIOSMEM_MODESET_CTL
|
---|
855 | mov al, [bx]
|
---|
856 | mov bx, BIOSMEM_SWITCHES
|
---|
857 | mov ah, [bx]
|
---|
858 | cmp dl, 1
|
---|
859 | je vert_res_350
|
---|
860 | jb vert_res_200
|
---|
861 | cmp dl, 2
|
---|
862 | je vert_res_400
|
---|
863 | ifdef VGA_DEBUG
|
---|
864 | mov al, dl
|
---|
865 | xor ah, ah
|
---|
866 | push ax
|
---|
867 | mov bx, msg_vert_res
|
---|
868 | push bx
|
---|
869 | call _printf
|
---|
870 | add sp, 4
|
---|
871 | endif
|
---|
872 | jmp set_retcode
|
---|
873 | vert_res_400:
|
---|
874 |
|
---|
875 | ; reset modeset ctl bit 7 and set bit 4
|
---|
876 | ; set switches bit 3-0 to 09
|
---|
877 |
|
---|
878 | and al, 07Fh
|
---|
879 | or al, 010h
|
---|
880 | and ah, 0F0h
|
---|
881 | or ah, 009h
|
---|
882 | jnz set_vert_res
|
---|
883 | vert_res_350:
|
---|
884 |
|
---|
885 | ; reset modeset ctl bit 7 and bit 4
|
---|
886 | ; set switches bit 3-0 to 09
|
---|
887 |
|
---|
888 | and al, 06Fh
|
---|
889 | and ah, 0F0h
|
---|
890 | or ah, 009h
|
---|
891 | jnz set_vert_res
|
---|
892 | vert_res_200:
|
---|
893 |
|
---|
894 | ; set modeset ctl bit 7 and reset bit 4
|
---|
895 | ; set switches bit 3-0 to 08
|
---|
896 |
|
---|
897 | and al, 0EFh
|
---|
898 | or al, 080h
|
---|
899 | and ah, 0F0h
|
---|
900 | or ah, 008h
|
---|
901 | set_vert_res:
|
---|
902 | mov bx, BIOSMEM_MODESET_CTL
|
---|
903 | mov [bx], al
|
---|
904 | mov bx, BIOSMEM_SWITCHES
|
---|
905 | mov [bx], ah
|
---|
906 | set_retcode:
|
---|
907 | mov ax, 1212h
|
---|
908 | pop dx
|
---|
909 | pop bx
|
---|
910 | pop ds
|
---|
911 | ret
|
---|
912 |
|
---|
913 | ifdef VGA_DEBUG
|
---|
914 | msg_vert_res:
|
---|
915 | db "Select vert res (%02x) was discarded", 13, 10, 0
|
---|
916 | endif
|
---|
917 |
|
---|
918 |
|
---|
919 | biosfn_enable_default_palette_loading:
|
---|
920 | push ds
|
---|
921 | push bx
|
---|
922 | push dx
|
---|
923 | mov dl, al
|
---|
924 | and dl, 01
|
---|
925 | shl dl, 3
|
---|
926 | mov ax, BIOSMEM_SEG
|
---|
927 | mov ds, ax
|
---|
928 | mov bx, BIOSMEM_MODESET_CTL
|
---|
929 | mov al, [bx]
|
---|
930 | and al, 0F7h
|
---|
931 | or al, dl
|
---|
932 | mov [bx], al
|
---|
933 | mov ax, 1212h
|
---|
934 | pop dx
|
---|
935 | pop bx
|
---|
936 | pop ds
|
---|
937 | ret
|
---|
938 |
|
---|
939 |
|
---|
940 | biosfn_enable_video_addressing:
|
---|
941 | push bx
|
---|
942 | push dx
|
---|
943 | mov bl, al
|
---|
944 | and bl, 01
|
---|
945 | xor bl, 01
|
---|
946 | shl bl, 1
|
---|
947 | mov dx, VGAREG_READ_MISC_OUTPUT
|
---|
948 | in al, dx
|
---|
949 | and al, 0FDh
|
---|
950 | or al, bl
|
---|
951 | mov dx, VGAREG_WRITE_MISC_OUTPUT
|
---|
952 | out dx, al
|
---|
953 | mov ax, 1212h
|
---|
954 | pop dx
|
---|
955 | pop bx
|
---|
956 | ret
|
---|
957 |
|
---|
958 |
|
---|
959 | biosfn_enable_grayscale_summing:
|
---|
960 | push ds
|
---|
961 | push bx
|
---|
962 | push dx
|
---|
963 | mov dl, al
|
---|
964 | and dl, 01h
|
---|
965 | xor dl, 01h
|
---|
966 | shl dl, 1
|
---|
967 | mov ax, BIOSMEM_SEG
|
---|
968 | mov ds, ax
|
---|
969 | mov bx, BIOSMEM_MODESET_CTL
|
---|
970 | mov al, [bx]
|
---|
971 | and al, 0FDh
|
---|
972 | or al, dl
|
---|
973 | mov [bx], al
|
---|
974 | mov ax, 1212h
|
---|
975 | pop dx
|
---|
976 | pop bx
|
---|
977 | pop ds
|
---|
978 | ret
|
---|
979 |
|
---|
980 |
|
---|
981 | biosfn_enable_cursor_emulation:
|
---|
982 | push ds
|
---|
983 | push bx
|
---|
984 | push dx
|
---|
985 | mov dl, al
|
---|
986 | and dl, 01
|
---|
987 | xor dl, 01
|
---|
988 | mov ax, BIOSMEM_SEG
|
---|
989 | mov ds, ax
|
---|
990 | mov bx, BIOSMEM_MODESET_CTL
|
---|
991 | mov al, [bx]
|
---|
992 | and al, 0FEh
|
---|
993 | or al, dl
|
---|
994 | mov [bx], al
|
---|
995 | mov ax, 1212h
|
---|
996 | pop dx
|
---|
997 | pop bx
|
---|
998 | pop ds
|
---|
999 | ret
|
---|
1000 |
|
---|
1001 | ;;--------------------------------------------------------------------------------------------
|
---|
1002 |
|
---|
1003 | biosfn_group_1A:
|
---|
1004 | cmp al, 0
|
---|
1005 | je biosfn_read_display_code
|
---|
1006 | cmp al, 1
|
---|
1007 | je biosfn_set_display_code
|
---|
1008 | ifdef VGA_DEBUG
|
---|
1009 | call _unknown
|
---|
1010 | endif
|
---|
1011 | ret
|
---|
1012 | biosfn_read_display_code:
|
---|
1013 | push ds
|
---|
1014 | push ax
|
---|
1015 | mov ax, BIOSMEM_SEG
|
---|
1016 | mov ds, ax
|
---|
1017 | mov bx, BIOSMEM_DCC_INDEX
|
---|
1018 | mov al, [bx]
|
---|
1019 | mov bl, al
|
---|
1020 | xor bh, bh
|
---|
1021 | pop ax
|
---|
1022 | mov al, ah
|
---|
1023 | pop ds
|
---|
1024 | ret
|
---|
1025 | biosfn_set_display_code:
|
---|
1026 | push ds
|
---|
1027 | push ax
|
---|
1028 | push bx
|
---|
1029 | mov ax, BIOSMEM_SEG
|
---|
1030 | mov ds, ax
|
---|
1031 | mov ax, bx
|
---|
1032 | mov bx, BIOSMEM_DCC_INDEX
|
---|
1033 | mov [bx], al
|
---|
1034 | ifdef VGA_DEBUG
|
---|
1035 | mov al, ah
|
---|
1036 | xor ah, ah
|
---|
1037 | push ax
|
---|
1038 | mov bx, msg_alt_dcc
|
---|
1039 | push bx
|
---|
1040 | call _printf
|
---|
1041 | add sp, 4
|
---|
1042 | endif
|
---|
1043 | pop bx
|
---|
1044 | pop ax
|
---|
1045 | mov al, ah
|
---|
1046 | pop ds
|
---|
1047 | ret
|
---|
1048 |
|
---|
1049 | ifdef VGA_DEBUG
|
---|
1050 | msg_alt_dcc:
|
---|
1051 | db "Alternate Display code (%02x) was discarded", 13, 10, 0
|
---|
1052 | endif
|
---|
1053 |
|
---|
1054 | VGAROM ends
|
---|
1055 |
|
---|
1056 | end
|
---|