diff options
author | Volker Ruppert <info@vruppert.de> | 2004-05-05 19:23:53 +0000 |
---|---|---|
committer | Volker Ruppert <info@vruppert.de> | 2004-05-05 19:23:53 +0000 |
commit | 44c3dff5a6dd29704c0b47cf280745edd1dbb9d9 (patch) | |
tree | 639957997efb0ffe47be18701df3d613a2c8af2b | |
parent | 566f5a77d84178d6c1c2bd945c13512634070cb7 (diff) | |
download | vgabios-44c3dff5a6dd29704c0b47cf280745edd1dbb9d9.tar.gz |
- 8 bit DAC capability flag set
- vbe_biosfn_set_get_dac_palette_format implemented
- VBE api description updated
- C definitions from header files now used assembler code
-rw-r--r-- | vbe.c | 52 | ||||
-rw-r--r-- | vbe.h | 2 | ||||
-rw-r--r-- | vbe_display_api.txt | 3 | ||||
-rw-r--r-- | vgabios.c | 223 |
4 files changed, 149 insertions, 131 deletions
@@ -449,7 +449,7 @@ Bit16u *AX;Bit16u ES;Bit16u DI; vbe_info_block.OemStringPtr_Off = &vbebios_copyright; // Capabilities - vbe_info_block.Capabilities[0] = 0; + vbe_info_block.Capabilities[0] = VBE_CAPABILITY_8BIT_DAC; vbe_info_block.Capabilities[1] = 0; vbe_info_block.Capabilities[2] = 0; vbe_info_block.Capabilities[3] = 0; @@ -885,14 +885,54 @@ Bit16u *AX;Bit16u BX;Bit16u CX;Bit16u DX; * * Input: * AX = 4F08h + * BL = 00h set DAC palette width
+ * = 01h get DAC palette width
+ * BH = If BL=00h: desired number of bits per primary color
* Output: * AX = VBE Return Status - * - * FIXME: incomplete API description, Input & Output + * BH = current number of bits per primary color (06h = standard VGA)
*/ -void vbe_biosfn_set_get_dac_palette_format(AX) -{ -} +ASM_START +vbe_biosfn_set_get_dac_palette_format: + push dx + mov dx, # VBE_DISPI_IOPORT_INDEX + mov ax, # VBE_DISPI_INDEX_ENABLE + out dx, ax + cmp bl, #0x01 + je get_dac_palette_format + ja vbe_08_unknown + mov dx, # VBE_DISPI_IOPORT_DATA + in ax, dx + cmp bh, #0x08 + je set_8bit_dac + cmp bh, #0x06 + jne vbe_08_unsupported + and ax, #~ VBE_DISPI_8BIT_DAC + out dx, ax + jmp get_dac_palette_format +set_8bit_dac: + or ax, # VBE_DISPI_8BIT_DAC + out dx, ax +get_dac_palette_format: + mov bh, #0x06 + mov dx, # VBE_DISPI_IOPORT_DATA + in ax, dx + and ax, # VBE_DISPI_8BIT_DAC + jz vbe_08_ok + mov bh, #0x08 +vbe_08_ok: + mov ax, #0x004f + pop dx + ret +vbe_08_unknown: + mov ax, #0x0100 + pop dx + ret +vbe_08_unsupported: + mov ax, #0x014f + pop dx + ret +ASM_END /** Function 09h - Set/Get Palette Data @@ -21,7 +21,6 @@ void vbe_biosfn_save_restore_state(AX, DL, CX, ES, BX); void vbe_biosfn_display_window_control(AX,BX,DX); void vbe_biosfn_set_get_logical_scan_line_length(AX,BX,CX,DX); void vbe_biosfn_set_get_display_start(AX,BX,CX,DX); -void vbe_biosfn_set_get_dac_palette_format(AX); void vbe_biosfn_set_get_palette_data(AX); void vbe_biosfn_return_protected_mode_interface(AX); @@ -297,6 +296,7 @@ typedef struct ModeInfoBlock #define VBE_DISPI_DISABLED 0x00 #define VBE_DISPI_ENABLED 0x01 #define VBE_DISPI_GETCAPS 0x02 + #define VBE_DISPI_8BIT_DAC 0x20 #define VBE_DISPI_LFB_ENABLED 0x40 #define VBE_DISPI_NOCLEARMEM 0x80 diff --git a/vbe_display_api.txt b/vbe_display_api.txt index 86322b4..9ca9afc 100644 --- a/vbe_display_api.txt +++ b/vbe_display_api.txt @@ -38,7 +38,7 @@ API History 0xb0c3 supports 0xb0c2 VBE_DISPI_ interfaces, interfaces updated for additional features: - VBE_DISPI_INDEX_ENABLE supports new flag VBE_DISPI_GETCAPS + VBE_DISPI_INDEX_ENABLE supports new flags VBE_DISPI_GETCAPS and VBE_DISPI_8BIT_DAC History @@ -203,6 +203,7 @@ API * VBE_DISPI_INDEX_ENABLE : WORD {R,W} If the new flag VBE_DISPI_GETCAPS is enabled, the xres, yres and bpp registers return the gui capabilities. + The new flag VBE_DISPI_8BIT_DAC switches the DAC to 8 bit mode. Displaying GFX (banked mode) -------------- @@ -117,32 +117,6 @@ static void biosfn_restore_video_state(); ASM_START -biosmem_seg = 0x40 -biosmem_initial_mode = 0x10 -biosmem_current_mode = 0x49 -biosmem_nb_cols = 0x4a -biosmem_current_page = 0x62 -biosmem_crtc_address = 0x63 -biosmem_current_msr = 0x65 -biosmem_char_height = 0x85 -biosmem_video_ctl = 0x87 -biosmem_switches = 0x88 -biosmem_modeset_ctl = 0x89 -biosmem_dcc_index = 0x8a - -vgareg_mda_crtc_address = 0x03b4 -vgareg_actl_address = 0x03c0 -vgareg_actl_read_data = 0x03c1 -vgareg_write_misc_output = 0x03c2 -vgareg_sequ_address = 0x03c4 -vgareg_pel_mask = 0x03c6 -vgareg_dac_read_address = 0x03c7 -vgareg_dac_write_address = 0x03c8 -vgareg_dac_data = 0x03c9 -vgareg_read_misc_output = 0x03cc -vgareg_grdc_address = 0x03ce -vgareg_actl_reset = 0x03da - MACRO SET_INT_VECTOR push ds xor ax, ax @@ -327,9 +301,20 @@ int10_test_101B: cmp ax, #0x101b je int10_normal cmp ah, #0x10 +#ifndef VBE jne int10_normal +#else + jne int10_test_4F08 +#endif call biosfn_group_10 jmp int10_end +#ifdef VBE +int10_test_4F08: + cmp ax, #0x4f08 + jne int10_normal + call vbe_biosfn_set_get_dac_palette_format + jmp int10_end +#endif int10_normal: push es @@ -389,11 +374,11 @@ ASM_END ASM_START init_bios_area: push ds - mov ax, #biosmem_seg + mov ax, # BIOSMEM_SEG mov ds, ax ;; init detected hardware BIOS Area - mov bx, #biosmem_initial_mode + mov bx, # BIOSMEM_INITIAL_MODE mov ax, [bx] and ax, #0xffcf mov [bx], ax @@ -401,27 +386,27 @@ init_bios_area: ;; Just for the first int10 find its children ;; the default char height - mov bx, #biosmem_char_height + mov bx, # BIOSMEM_CHAR_HEIGHT mov al, #0x10 mov [bx], al ;; Clear the screen - mov bx, #biosmem_video_ctl + mov bx, # BIOSMEM_VIDEO_CTL mov al, #0x60 mov [bx], al ;; Set the basic screen we have - mov bx, #biosmem_switches + mov bx, # BIOSMEM_SWITCHES mov al, #0xf9 mov [bx], al ;; Set the basic modeset options - mov bx, #biosmem_modeset_ctl + mov bx, # BIOSMEM_MODESET_CTL mov al, #0x51 mov [bx], al ;; Set the default MSR - mov bx, #biosmem_current_msr + mov bx, # BIOSMEM_CURRENT_MSR mov al, #0x09 mov [bx], al @@ -715,14 +700,6 @@ static void int10_func(DI, SI, BP, SP, BX, DX, CX, AX, DS, ES, FLAGS) case 0x07: vbe_biosfn_set_get_display_start(&AX,BX,CX,DX); break; - case 0x08: - //FIXME -#ifdef DEBUG - unimplemented(); -#endif - // function failed - AX=0x100; - break; case 0x09: //FIXME #ifdef DEBUG @@ -1343,7 +1320,7 @@ Bit8u car;Bit8u attr;Bit8u xcurs;Bit8u ycurs;Bit8u nbcols;Bit8u cheight; } } ASM_START - mov dx, #vgareg_grdc_address + mov dx, # VGAREG_GRDC_ADDRESS mov ax, 0xff08 out dx, ax mov ax, 0x0005 @@ -1594,9 +1571,9 @@ biosfn_set_border_color: push bx push cx push dx - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, #0x00 out dx, al mov al, bl @@ -1609,14 +1586,14 @@ set_low_border: mov cl, #0x01 and bl, #0x10 set_intensity_loop: - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, cl out dx, al - mov dx, #vgareg_actl_read_data + mov dx, # VGAREG_ACTL_READ_DATA in al, dx and al, #0xef or al, bl - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS out dx, al inc cl cmp cl, #0x04 @@ -1633,19 +1610,19 @@ biosfn_set_palette: push bx push cx push dx - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx mov cl, #0x01 and bl, #0x01 set_cga_palette_loop: - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, cl out dx, al - mov dx, #vgareg_actl_read_data + mov dx, # VGAREG_ACTL_READ_DATA in al, dx and al, #0xfe or al, bl - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS out dx, al inc cl cmp cl, #0x04 @@ -1901,21 +1878,21 @@ Bit8u car;Bit8u page;Bit8u attr;Bit8u flag; ASM_START biosfn_get_video_mode: push ds - mov ax, #biosmem_seg + mov ax, # BIOSMEM_SEG mov ds, ax push bx - mov bx, #biosmem_current_page + mov bx, # BIOSMEM_CURRENT_PAGE mov al, [bx] pop bx mov bh, al push bx - mov bx, #biosmem_video_ctl + mov bx, # BIOSMEM_VIDEO_CTL mov ah, [bx] and ah, #0x80 - mov bx, #biosmem_current_mode + mov bx, # BIOSMEM_CURRENT_MODE mov al, [bx] or al, ah - mov bx, #biosmem_nb_cols + mov bx, # BIOSMEM_NB_COLS mov ah, [bx] pop bx pop ds @@ -1995,9 +1972,9 @@ biosfn_set_single_palette_reg: ja no_actl_reg1 push ax push dx - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, bl out dx, al mov al, bh @@ -2028,10 +2005,10 @@ biosfn_set_all_palette_reg: push cx push dx mov bx, dx - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx mov cl, #0x00 - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS set_palette_loop: mov al, cl out dx, al @@ -2062,18 +2039,18 @@ biosfn_toggle_intensity: push ax push bx push dx - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, #0x10 out dx, al - mov dx, #vgareg_actl_read_data + mov dx, # VGAREG_ACTL_READ_DATA in al, dx and al, #0xf7 and bl, #0x01 shl bl, 3 or al, bl - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS out dx, al mov al, #0x20 out dx, al @@ -2090,17 +2067,17 @@ biosfn_get_single_palette_reg: ja no_actl_reg2 push ax push dx - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, bl out dx, al - mov dx, #vgareg_actl_read_data + mov dx, # VGAREG_ACTL_READ_DATA in al, dx mov bh, al - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, #0x20 out dx, al pop dx @@ -2133,12 +2110,12 @@ biosfn_get_all_palette_reg: mov bx, dx mov cl, #0x00 get_palette_loop: - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, cl out dx, al - mov dx, #vgareg_actl_read_data + mov dx, # VGAREG_ACTL_READ_DATA in al, dx seg es mov [bx], al @@ -2146,18 +2123,18 @@ get_palette_loop: inc cl cmp cl, #0x10 jne get_palette_loop - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, #0x11 out dx, al - mov dx, #vgareg_actl_read_data + mov dx, # VGAREG_ACTL_READ_DATA in al, dx seg es mov [bx], al - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, #0x20 out dx, al pop dx @@ -2172,10 +2149,10 @@ ASM_START biosfn_set_single_dac_reg: push ax push dx - mov dx, #vgareg_dac_write_address + mov dx, # VGAREG_DAC_WRITE_ADDRESS mov al, bl out dx, al - mov dx, #vgareg_dac_data + mov dx, # VGAREG_DAC_DATA pop ax push ax mov al, ah @@ -2196,13 +2173,13 @@ biosfn_set_all_dac_reg: push bx push cx push dx - mov dx, #vgareg_dac_write_address + mov dx, # VGAREG_DAC_WRITE_ADDRESS mov al, bl out dx, al pop dx push dx mov bx, dx - mov dx, #vgareg_dac_data + mov dx, # VGAREG_DAC_DATA set_dac_loop: seg es mov al, [bx] @@ -2231,26 +2208,26 @@ biosfn_select_video_dac_color_page: push ax push bx push dx - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, #0x10 out dx, al - mov dx, #vgareg_actl_read_data + mov dx, # VGAREG_ACTL_READ_DATA in al, dx and bl, #0x01 jnz set_dac_page and al, #0x7f shl bh, 7 or al, bh - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS out dx, al jmp set_actl_normal set_dac_page: push ax - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, #0x14 out dx, al pop ax @@ -2275,12 +2252,12 @@ ASM_START biosfn_read_single_dac_reg: push ax push dx - mov dx, #vgareg_dac_read_address + mov dx, # VGAREG_DAC_READ_ADDRESS mov al, bl out dx, al pop ax mov ah, al - mov dx, #vgareg_dac_data + mov dx, # VGAREG_DAC_DATA in al, dx xchg al, ah push ax @@ -2300,13 +2277,13 @@ biosfn_read_all_dac_reg: push bx push cx push dx - mov dx, #vgareg_dac_read_address + mov dx, # VGAREG_DAC_READ_ADDRESS mov al, bl out dx, al pop dx push dx mov bx, dx - mov dx, #vgareg_dac_data + mov dx, # VGAREG_DAC_DATA read_dac_loop: in al, dx seg es @@ -2334,7 +2311,7 @@ ASM_START biosfn_set_pel_mask: push ax push dx - mov dx, #vgareg_pel_mask + mov dx, # VGAREG_PEL_MASK mov al, bl out dx, al pop dx @@ -2347,7 +2324,7 @@ ASM_START biosfn_read_pel_mask: push ax push dx - mov dx, #vgareg_pel_mask + mov dx, # VGAREG_PEL_MASK in al, dx mov bl, al pop dx @@ -2360,21 +2337,21 @@ ASM_START biosfn_read_video_dac_state: push ax push dx - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, #0x10 out dx, al - mov dx, #vgareg_actl_read_data + mov dx, # VGAREG_ACTL_READ_DATA in al, dx mov bl, al shr bl, 7 - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, #0x14 out dx, al - mov dx, #vgareg_actl_read_data + mov dx, # VGAREG_ACTL_READ_DATA in al, dx mov bh, al and bh, #0x0f @@ -2382,9 +2359,9 @@ biosfn_read_video_dac_state: jnz get_dac_16_page shr bh, 2 get_dac_16_page: - mov dx, #vgareg_actl_reset + mov dx, # VGAREG_ACTL_RESET in al, dx - mov dx, #vgareg_actl_address + mov dx, # VGAREG_ACTL_ADDRESS mov al, #0x20 out dx, al pop dx @@ -2432,7 +2409,7 @@ Bit16u start;Bit16u count; static void get_font_access() { ASM_START - mov dx, #vgareg_sequ_address + mov dx, # VGAREG_SEQU_ADDRESS mov ax, #0x0100 out dx, ax mov ax, #0x0402 @@ -2441,7 +2418,7 @@ ASM_START out dx, ax mov ax, #0x0300 out dx, ax - mov dx, #vgareg_grdc_address + mov dx, # VGAREG_GRDC_ADDRESS mov ax, #0x0204 out dx, ax mov ax, #0x0005 @@ -2454,7 +2431,7 @@ ASM_END static void release_font_access() { ASM_START - mov dx, #vgareg_sequ_address + mov dx, # VGAREG_SEQU_ADDRESS mov ax, #0x0100 out dx, ax mov ax, #0x0302 @@ -2463,14 +2440,14 @@ ASM_START out dx, ax mov ax, #0x0300 out dx, ax - mov dx, #vgareg_read_misc_output + mov dx, # VGAREG_READ_MISC_OUTPUT in al, dx and al, #0x01 shl al, 2 or al, #0x0a mov ah, al mov al, #0x06 - mov dx, #vgareg_grdc_address + mov dx, # VGAREG_GRDC_ADDRESS out dx, ax mov ax, #0x0004 out dx, ax @@ -2578,7 +2555,7 @@ ASM_START biosfn_set_text_block_specifier: push ax push dx - mov dx, #vgareg_sequ_address + mov dx, # VGAREG_SEQU_ADDRESS mov ah, bl mov al, #0x03 out dx, ax @@ -2693,16 +2670,16 @@ ASM_START biosfn_get_ega_info: push ds push ax - mov ax, #biosmem_seg + mov ax, # BIOSMEM_SEG mov ds, ax xor ch, ch - mov bx, #biosmem_switches + mov bx, # BIOSMEM_SWITCHES mov cl, [bx] and cl, #0x0f - mov bx, #biosmem_crtc_address + mov bx, # BIOSMEM_CRTC_ADDRESS mov ax, [bx] mov bx, #0x0003 - cmp ax, #vgareg_mda_crtc_address + cmp ax, # VGAREG_MDA_CRTC_ADDRESS jne mode_ega_color mov bh, #0x01 mode_ega_color: @@ -2765,9 +2742,9 @@ biosfn_enable_default_palette_loading: mov dl, al and dl, #0x01 shl dl, 3 - mov ax, #biosmem_seg + mov ax, # BIOSMEM_SEG mov ds, ax - mov bx, #biosmem_modeset_ctl + mov bx, # BIOSMEM_MODESET_CTL mov al, [bx] and al, #0xf7 or al, dl @@ -2788,11 +2765,11 @@ biosfn_enable_video_addressing: and bl, #0x01 xor bl, #0x01 shl bl, 1 - mov dx, #vgareg_read_misc_output + mov dx, # VGAREG_READ_MISC_OUTPUT in al, dx and al, #0xfd or al, bl - mov dx, #vgareg_write_misc_output + mov dx, # VGAREG_WRITE_MISC_OUTPUT out dx, al mov ax, #0x1212 pop dx @@ -2810,9 +2787,9 @@ biosfn_enable_grayscale_summing: and dl, #0x01 xor dl, #0x01 shl dl, 1 - mov ax, #biosmem_seg + mov ax, # BIOSMEM_SEG mov ds, ax - mov bx, #biosmem_modeset_ctl + mov bx, # BIOSMEM_MODESET_CTL mov al, [bx] and al, #0xfd or al, dl @@ -2833,9 +2810,9 @@ biosfn_enable_cursor_emulation: mov dl, al and dl, #0x01 xor dl, #0x01 - mov ax, #biosmem_seg + mov ax, # BIOSMEM_SEG mov ds, ax - mov bx, #biosmem_modeset_ctl + mov bx, # BIOSMEM_MODESET_CTL mov al, [bx] and al, #0xfe or al, dl @@ -2908,9 +2885,9 @@ biosfn_group_1A: biosfn_read_display_code: push ds push ax - mov ax, #biosmem_seg + mov ax, # BIOSMEM_SEG mov ds, ax - mov bx, #biosmem_dcc_index + mov bx, # BIOSMEM_DCC_INDEX mov al, [bx] mov bl, al xor bh, bh @@ -2922,10 +2899,10 @@ biosfn_set_display_code: push ds push ax push bx - mov ax, #biosmem_seg + mov ax, # BIOSMEM_SEG mov ds, ax mov ax, bx - mov bx, #biosmem_dcc_index + mov bx, # BIOSMEM_DCC_INDEX mov [bx], al #ifdef DEBUG mov al, ah |