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