diff options
author | Volker Ruppert <info@vruppert.de> | 2004-02-22 14:17:10 +0000 |
---|---|---|
committer | Volker Ruppert <info@vruppert.de> | 2004-02-22 14:17:10 +0000 |
commit | 79afcf31ab9b5582682bf74b3cd3976f502010dc (patch) | |
tree | c517f7f954f4e35397484bbae876d45c3b216a1d | |
parent | 26cd5dbb39625d0dc3dfcf3b008f1572b142e8ad (diff) | |
download | vgabios-79afcf31ab9b5582682bf74b3cd3976f502010dc.tar.gz |
- new function dispi_get_max_bpp() returns the bpp capabilities of the Bochs gui
- create the mode list depending on the supported bpp capability
- unused stuff removed
- documentation updated
-rw-r--r-- | README | 8 | ||||
-rw-r--r-- | vbe.c | 31 | ||||
-rw-r--r-- | vbe.h | 2 | ||||
-rw-r--r-- | vbe_display_api.txt | 35 |
4 files changed, 48 insertions, 28 deletions
@@ -97,12 +97,12 @@ vgabios-0.4b : Nov 04 2003 vgabios-0.4a : Aug 17 2003 - Volker - . LFB flagged VBE modes removed + . VBE mode search rewritten (VBE modes with LFB bit removed) . many bugfixes and optimizations - . write character function implemeted for graphic modes + . write character function implemented for graphics modes . support for 15bpp, 16bpp, 24bpp and 32bpp VBE modes added - . SVGA modes 0x6A added - . VBE mode 0x102, 0x117, 0x118, 0x142 (Bochs specific) + . SVGA mode 0x6A added + . VBE modes 0x102, 0x117, 0x118 and 0x142 (Bochs specific) vgabios-0.3b : Nov 23 2002 - Christophe @@ -47,16 +47,11 @@ // The current OEM Software Revision of this VBE Bios #define VBE_OEM_SOFTWARE_REV 0x0002; -#define VBEInfoData ((VbeInfoBlock *) 0) - extern char vbebios_copyright; extern char vbebios_vendor_name; extern char vbebios_product_name; extern char vbebios_product_revision; -// FIXME: find out why we cannot use the dynamic list generation (due to a bug somewhere) -//#define DYN_LIST - #ifndef DYN_LIST extern Bit16u vbebios_mode_list; #endif @@ -178,6 +173,19 @@ static Bit16u dispi_get_bpp() return inw(VBE_DISPI_IOPORT_DATA); } +static Bit16u dispi_get_max_bpp() +{ + Bit16u max_bpp; + + outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ENABLE); + outw(VBE_DISPI_IOPORT_DATA,VBE_DISPI_GETCAPS); + outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_BPP); + max_bpp = inw(VBE_DISPI_IOPORT_DATA); + outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ENABLE); + outw(VBE_DISPI_IOPORT_DATA,VBE_DISPI_DISABLED); + return max_bpp; +} + static Bit16u dispi_get_enable() { outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ENABLE); @@ -342,7 +350,7 @@ void vbe_init() if (dispi_id==VBE_DISPI_ID0) { write_byte(BIOSMEM_SEG,BIOSMEM_VBE_FLAG,0x01); - dispi_set_id(VBE_DISPI_ID2); + dispi_set_id(VBE_DISPI_ID3); } printf("VBE Bios $Id$\n"); } @@ -481,14 +489,15 @@ Bit16u *AX;Bit16u ES;Bit16u DI; #ifdef DYN_LIST do { + if (cur_info->info.BitsPerPixel <= dispi_get_max_bpp()) { #ifdef DEBUG - printf("VBE found mode %x => %x\n", cur_info->mode,cur_mode); + printf("VBE found mode %x => %x\n", cur_info->mode,cur_mode); #endif - write_word(ES, DI + cur_ptr, cur_info->mode); - + write_word(ES, DI + cur_ptr, cur_info->mode); + cur_mode++; + cur_ptr+=2; + } cur_info++; - cur_mode++; - cur_ptr+=2; } while (cur_info->mode != VBE_VESA_MODE_END_OF_LIST); // Add vesa mode list terminator @@ -292,9 +292,11 @@ typedef struct ModeInfoBlock #define VBE_DISPI_ID0 0xB0C0 #define VBE_DISPI_ID1 0xB0C1 #define VBE_DISPI_ID2 0xB0C2 + #define VBE_DISPI_ID3 0xB0C3 #define VBE_DISPI_DISABLED 0x00 #define VBE_DISPI_ENABLED 0x01 + #define VBE_DISPI_GETCAPS 0x02 #define VBE_DISPI_LFB_ENABLED 0x40 #define VBE_DISPI_NOCLEARMEM 0x80 diff --git a/vbe_display_api.txt b/vbe_display_api.txt index 787dc31..86322b4 100644 --- a/vbe_display_api.txt +++ b/vbe_display_api.txt @@ -30,12 +30,16 @@ API History VBE_DISPI_INDEX_X_OFFSET VBE_DISPI_INDEX_Y_OFFSET -0xb0c2 supports 0xb0c1 VBE_DISPI_ interfaces, interfaces updated for additional features: +0xb0c2 supports 0xb0c1 VBE_DISPI_ interfaces, interfaces updated for + additional features (present in Bochs 2.1): VBE_DISPI_INDEX_BPP supports >8bpp color depth (value = bits) VBE_DISPI_INDEX_ENABLE supports new flags VBE_DISPI_NOCLEARMEM and VBE_DISPI_LFB_ENABLED VBE i/o registers changed from 0xFF80/81 to 0x01CE/CF - +0xb0c3 supports 0xb0c2 VBE_DISPI_ interfaces, interfaces updated for + additional features: + VBE_DISPI_INDEX_ENABLE supports new flag VBE_DISPI_GETCAPS + History ------- @@ -195,26 +199,31 @@ API The new flag VBE_DISPI_NOCLEARMEM allows to preserve the VBE video memory. The new flag VBE_DISPI_LFB_ENABLED indicates the usage of the LFB. -Displaying GFX +[0xb0c3] + * 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. + +Displaying GFX (banked mode) -------------- - Currently Linear Frame Buffer support is not available yet. - The only other way of displaying (VBE) graphics is using banked modi. - What happens is that the total screen is devided in banks of 'VBE_DISPI_BANK_SIZE_KB' KiloByte in size. If you want to set a pixel you can calculate its bank by doing: - + offset = pixel_x + pixel_y * resolution_x; bank = offset / 64 Kb (rounded 1.9999 -> 1) - + bank_pixel_pos = offset - bank * 64Kb - - Now you can set the current bank and put the pixel at VBE_DISPI_BANK_ADDRESS + bank_pixel_pos + Now you can set the current bank and put the pixel at VBE_DISPI_BANK_ADDRESS + bank_pixel_pos + +Displaying GFX (linear frame buffer mode) +-------------- + NOT WRITTEN YET Notes ----- * Since the XRES/YRES/BPP may not be written when VBE is enabled, if you want to switch from one VBE mode to another, you will need to disable VBE first. - - * Note when the bios doesn't find a valid DISPI_ID, it can disable the VBE functions. This allows people to - use the same bios for both vbe enabled and disabled bochs executables.
\ No newline at end of file + + * Note when the bios doesn't find a valid DISPI_ID, it can disable the VBE functions. This allows people to + use the same bios for both vbe enabled and disabled bochs executables. |