BIOS-VGA
BIOS-VGA
My question is the following, could I modify an Award BIOS, so that the character output was different, for example the characters of another color?
Explain, I'm an OpenBSD user, I'm a bit frustrated that wscons only supports ANSI colors.
I have been reading good articles on this website, such as writing directly to the VGA memory address (0xb8000) with a few simple instructions and being in ring0, I could check the effectiveness.
Well, my bios boot when it executes all the character outputs does it send them to the VGA address?
I think I can understand. I have a Binary my bios Award, I was able to change simple things such as the logo.
Could you disassemble the binary and modify the character outputs? Yes, it works that way.
Where can I start?
Thanks.
Explain, I'm an OpenBSD user, I'm a bit frustrated that wscons only supports ANSI colors.
I have been reading good articles on this website, such as writing directly to the VGA memory address (0xb8000) with a few simple instructions and being in ring0, I could check the effectiveness.
Well, my bios boot when it executes all the character outputs does it send them to the VGA address?
I think I can understand. I have a Binary my bios Award, I was able to change simple things such as the logo.
Could you disassemble the binary and modify the character outputs? Yes, it works that way.
Where can I start?
Thanks.
Re: BIOS-VGA
Character colors are defined by the graphics card. The BIOS merely writes them into the memory area reserved for VGA, but it is the graphics card that interprets the bytes there and sends the signals to the monitor. If you wanted those bytes to be interpreted differently, you would have to change the way the graphics card works. Either by creating a new video BIOS or by just changing its settings. But that will require you to study your graphics card's documentation. Good luck!
These days, most people would just switch the graphics card to graphics mode and draw glyphs into the frame buffer. And then you can have any color you want. I also don't know what OpenBSD and BIOS have to do with any of this. BIOS is only needed to write characters in real mode, and OpenBSD is not using it for that if the developers have any sense.
These days, most people would just switch the graphics card to graphics mode and draw glyphs into the frame buffer. And then you can have any color you want. I also don't know what OpenBSD and BIOS have to do with any of this. BIOS is only needed to write characters in real mode, and OpenBSD is not using it for that if the developers have any sense.
Carpe diem!
Re: BIOS-VGA
You could simply modify the VGA DAC registers to use a different palette, simple as that. Palette works with text mode just as well as with 16 / 256 color graphics modes.
Otherwise yes, you can modify the VGA BIOS ROM and replace the default colors (vgatables.h line 532). The bochs source has the bios source too, you can modify that and recompile the vgabios.rom image...
Cheers,
bzt
Otherwise yes, you can modify the VGA BIOS ROM and replace the default colors (vgatables.h line 532). The bochs source has the bios source too, you can modify that and recompile the vgabios.rom image...
...but yes, this would be my suggestion too. With UEFI there's no text mode, only graphics mode, meaning on modern machines this is the only option.nullplan wrote:These days, most people would just switch the graphics card to graphics mode and draw glyphs into the frame buffer.
Cheers,
bzt
-
- Member
- Posts: 148
- Joined: Sun Aug 23, 2020 4:35 pm
Re: BIOS-VGA
You most likely could figure out a way to decompile (or at least jump out to some custom code and then jump back into) the AwardBIOS and modify it in order to change the VGA color palette. It would probably take a while, but it's most likely possible.
However, it has a much higher chance at bricking your computer (unless you've got something like dual-BIOS).
Also, when you're writing code for a BIOS, you've got to be SUPER careful about vendor-specific stuff, which things have been initialized yet, and so on.
In any case, it is probably easier to either
A) Modify the OpenBSD kernel that you are using to change the color palette on boot-up or
B) Create an intermediate loader that runs prior to either BIOSBOOT (the OpenBSD bootloader) or OpenBSD, changes the color palette, then loads BIOSBOOT/OpenBSD
However, it has a much higher chance at bricking your computer (unless you've got something like dual-BIOS).
Also, when you're writing code for a BIOS, you've got to be SUPER careful about vendor-specific stuff, which things have been initialized yet, and so on.
In any case, it is probably easier to either
A) Modify the OpenBSD kernel that you are using to change the color palette on boot-up or
B) Create an intermediate loader that runs prior to either BIOSBOOT (the OpenBSD bootloader) or OpenBSD, changes the color palette, then loads BIOSBOOT/OpenBSD
My OS: TritiumOS
https://github.com/foliagecanine/tritium-os
void warranty(laptop_t laptop) { if (laptop.broken) return laptop; }
I don't get it: Why's the warranty void?
https://github.com/foliagecanine/tritium-os
void warranty(laptop_t laptop) { if (laptop.broken) return laptop; }
I don't get it: Why's the warranty void?
Re: BIOS-VGA
I only referenced OpenBSD because the wscons driver only supports ANSI colors. These are the colors that it supports, and it is shocking to me that it can write in ring0 directly to the VGA memory with more colors.nullplan wrote:Character colors are defined by the graphics card. The BIOS merely writes them into the memory area reserved for VGA, but it is the graphics card that interprets the bytes there and sends the signals to the monitor. If you wanted those bytes to be interpreted differently, you would have to change the way the graphics card works. Either by creating a new video BIOS or by just changing its settings. But that will require you to study your graphics card's documentation. Good luck!
These days, most people would just switch the graphics card to graphics mode and draw glyphs into the frame buffer. And then you can have any color you want. I also don't know what OpenBSD and BIOS have to do with any of this. BIOS is only needed to write characters in real mode, and OpenBSD is not using it for that if the developers have any sense.
https://man.openbsd.org/wscons.4
https://github.com/openbsd/src/blob/mas ... splayvar.h
Code: Select all
/* fg / bg values. Made identical to ANSI terminal color codes. */
#define WSCOL_BLACK 0
#define WSCOL_RED 1
#define WSCOL_GREEN 2
#define WSCOL_BROWN 3
#define WSCOL_BLUE 4
#define WSCOL_MAGENTA 5
#define WSCOL_CYAN 6
#define WSCOL_WHITE 7
I think what you sent me is for an emulator called Bosch, I would like to apply it in a real BIOS, sorry if it is not like that and I misunderstood.bzt wrote:You could simply modify the VGA DAC registers to use a different palette, simple as that. Palette works with text mode just as well as with 16 / 256 color graphics modes.
Otherwise yes, you can modify the VGA BIOS ROM and replace the default colors (vgatables.h line 532). The bochs source has the bios source too, you can modify that and recompile the vgabios.rom image...
...but yes, this would be my suggestion too. With UEFI there's no text mode, only graphics mode, meaning on modern machines this is the only option.nullplan wrote:These days, most people would just switch the graphics card to graphics mode and draw glyphs into the frame buffer.
Cheers,
bzt
I would like to disassemble the BIOS and modify the color palette.foliagecanine wrote:You most likely could figure out a way to decompile (or at least jump out to some custom code and then jump back into) the AwardBIOS and modify it in order to change the VGA color palette. It would probably take a while, but it's most likely possible.
However, it has a much higher chance at bricking your computer (unless you've got something like dual-BIOS).
Also, when you're writing code for a BIOS, you've got to be SUPER careful about vendor-specific stuff, which things have been initialized yet, and so on.
In any case, it is probably easier to either
A) Modify the OpenBSD kernel that you are using to change the color palette on boot-up or
B) Create an intermediate loader that runs prior to either BIOSBOOT (the OpenBSD bootloader) or OpenBSD, changes the color palette, then loads BIOSBOOT/OpenBSD
I found this site, it is very interesting there you can find the structure of an AWARD BIOS.
https://sites.google.com/site/pinczakko ... -structure
I have the binaries, even the VGA ROM one, but I don't think I need it as my current BIOS doesn't have VGA built in. In this case the BIOS system writes the characters to the VGA and that is what I want to find.
Referencing the link, the file:
Code: Select all
0. System BIOS 20000h(128.00K) 13C31h(79.05K) 865IDC19.BIN
Forgive me if I'm saying something crazy, I'm getting started. I have the binaries and IDA to try to see the code in ASM, but there is where I am lost and I will not find that function if it exists.
Thanks guys.
-
- Member
- Posts: 5512
- Joined: Mon Mar 25, 2013 7:01 pm
Re: BIOS-VGA
Why do you need to modify the BIOS instead of modifying OpenBSD? Here is the function to initialize VGA. Insert code to override the palette however you like.
Also, don't forget that you can use WSATTR_HILIT to access 16 different colors, not just 8 colors.
Also, don't forget that you can use WSATTR_HILIT to access 16 different colors, not just 8 colors.
Re: BIOS-VGA
Nope, what I've sent you is the source of a GPL licensed VGA ROM (used by many emulators, bochs and qemu as well, but it is a VGA ROM not an emulator). On a real machine you'll have a manufacturer specific ROM, and chances are good you can't change that at all. The best you can do is change the VGA ROM used by the emulator.Fantasy94 wrote:I think what you sent me is for an emulator called Bosch, I would like to apply it in a real BIOS, sorry if it is not like that and I misunderstood.
Why do you want to change the default palette by the way, when you could simply modify the effective palette any time? Or even better, by using a modern video hardware use true color pixels without palette in the first place?
This doesn't mean it's using text mode at all. It could be that it uses a framebuffer, and emulates ANSI colors. Same with the Linux consoles (Ctrl+Alt+F1 .. Ctrl+Alt+F6; do not confuse with GUI terminal emulators like xterm, gnome-terminal, konsole etc.) Under the hood those consoles are pixel based framebuffers, yet they only supports ANSI colors via CSI sequences. I haven't checked, but wscons could do the same. Actually if OpenBSD boots on an UEFI machine, there's no other way.Fantasy94 wrote:I only referenced OpenBSD because the wscons driver only supports ANSI colors.
You won't find the palette in that. That's stored in the VGA ROM, which is physically a chip on the video card not on the mother board. Let's assume you have a motherboard with AWARD BIOS. You plug in a Cirrus video card, then the default palette will be provided by the Cirrus VGA ROM. Then you replace the card with a Trident card, then the AWARD BIOS remains the same, but now you'll have an entirely different VGA ROM with different VGA functions, and in theory with a different default palette (the palette is standardized so it's unlikely to have a different one, but could be).Fantasy94 wrote:I would like to disassemble the BIOS and modify the color palette.
I found this site, it is very interesting there you can find the structure of an AWARD BIOS.
No, that's in the VGA ROM. It's just the interface is standardized, so that the BIOS could use the same IO ports for VGA. But not for SVGA and above, there the compatibility is limited to the INT 10h interface, and not to the IO ports. Furthermore, most modern video cards does not emulate legacy IO ports either.Fantasy94 wrote:In the BIOS system it must have some VGA writing function, am I wrong? This is where I want to go.
No wonder, there's no such function in the system BIOS. Disassemble the VGA ROM, or take a look at the source I've linked. You'll find it there (vgabios.c, line 837 function load_dac_palette).Fantasy94 wrote:Forgive me if I'm saying something crazy, I'm getting started. I have the binaries and IDA to try to see the code in ASM, but there is where I am lost and I will not find that function if it exists.
Cheers,
bzt
-
- Member
- Posts: 5512
- Joined: Mon Mar 25, 2013 7:01 pm
Re: BIOS-VGA
Only if the VGA card is separate from the motherboard. The option ROMs for integrated devices, including VGA, are part of the BIOS ROM.bzt wrote:That's stored in the VGA ROM, which is physically a chip on the video card not on the mother board.
But you still don't need to modify any ROMs.
Re: BIOS-VGA
Even if the VGA card is integrated, they never write a specific combined BIOS+VGA software for it, they just put both the BIOS ROM image and the VGA ROM image on the motherboard next to each other. But that doesn't mean the manufacturer has implemented a completely new firmware from ground up with unseparateable BIOS and VGA functionality (I can assure you, they don't spend time and money on that, especially when adding both ROM images just works out-of-the-box).Octocontrabass wrote:Only if the VGA card is separate from the motherboard. The option ROMs for integrated devices, including VGA, are part of the BIOS ROM.
True.Octocontrabass wrote:But you still don't need to modify any ROMs.
Cheers,
bzt
Re: BIOS-VGA
Thank you for your answers, unfortunately I cannot take the time to understand the codes in depth, from here a few days I will comment on the possible doubts you may have.
Regards.
Regards.