(Note: I'm no longer using the motherboard that I used to develop the following documentation, so I can't test anything. But the information is still as valid as it was, so don't hesitate to make use of it; just don't ask me to verify anything you do.)
Recently (around mid-February 2007), I became somewhat interested in the Award BIOS (4.51 PG) that exists on the motherboard of my system. (I had previously done a mod to fix the infamous 32 GB bug, but had otherwise left it alone.) While browsing the web on the subject, I ran across some material about replacing the logo that is displayed during the POST. The one included in the original (unhacked) BIOS is a version of the Energy Star logo.
It seems that there are a few freeware and shareware utilities out there that allow people to draw new logos, or to convert them from standard image formats. However, I could find no documentation whatsoever of the actual formats, beyond a couple of hints. Thus, I decided to find out for myself by examining the image file in my BIOS. It's actually quite simple, so I don't know why there is no such information out there. I present here what I have found out. Hopefully, if anyone decides to develop an open-source utility, this will help.
Note this is for version 1 only. There is also a version 2, but I know nothing of it right now. I would appreciate it if someone could help out with that, by sending me information or a link, or by sending me a copy of their V2 logo or Award BIOS that they know contains a V2 logo. Thanks.
Finally, a warning and disclaimer:
WARNING: Flashing a BIOS is a risky operation! If you flash an inapproriate BIOS for your chipset or alter your BIOS carelessly, or if something goes wrong during the flashing operation (such as a power outage), you can very well wind up with an inoperative system, and since you won't be able to boot your system to reflash the BIOS, you may be stuck. It might be possible to use a special recovery disk (assuming you can even boot from that); otherwise, you'll have to have it externally flashed (possibly expensive). Although changing the logo should be harmless (the worst that can happen as a result is garbage on the screen during the POST), you can still mess things up if you make a mistake in some other stage of the process. Although this page discusses only file formats, you should still understand that I cannot be held liable for any damage to your system resulting from you tampering with your BIOS.
In a sense, the EPA format is not really an image format. The BIOS actually displays the logo by temporarily changing part of the VGA font, one character for each 8x14 block in the image. The important consequence of this trick is a limitation in the distribution of colors. VGA text modes only allow two colors per character cell: one foreground and one background. The background can be one of 8 colors: black, blue, green, cyan, red, magenta, brown (or dark yellow), light gray; the foreground one of 16: the above list, plus "bright" versions of the same (except black becomes dark gray, and brown becomes yellow). If you disable blinking, then both foreground and background can be bright, but doing this for the logo would require hacking the BIOS code. Award later introduced a true graphical format without this limitation; presumably such a BIOS boots in a graphics mode instead of text.
Another consideration is that of aspect ratio: my system, at least, starts up at 640x350 (yielding the standard 80x25 layout with 8x14 cells), meaning the pixels are not square, unlike the modes used in normal operation. This yields a "pixel aspect ratio" (i.e. shape of the pixels, not the screen) of 35:48 = 0.729167:1. So bear this in mind if you intend to draw logos yourself.
Most of the contents of the BIOS (including the logo) are contained in singleton LHA archives of type "lh5". When extracting the logo, one must first extract this archive; and conversely, after getting a logo into this format, one must encode it in the archive format. There are utilities that do this (and utilities that handle the entire logo modding process). Of course, I hope that one day there are open-source implementations of the whole modding process.
The format itself is really quite simple: there are two bytes giving the dimensions in character cells, a color map, and two bitmaps (or a font, if you like). Here is the overall layout:
| Offset | Length | Content |
|---|---|---|
| 0 | 1 | width: width in cells (8 pixels each) |
| 1 | 1 | height: height in cells (14 pixels each) |
| 2 | width*height |
Color map: CGA foreground/background color codes per cell (see below) |
width*height + 2 |
width*height*14 |
EPA logo bitmap, organized in character cells (see more detailed layout below) |
width*height*15 + 2 |
70 | Award logo bitmap, same organization (more or less) |
Notice that the Award logo has no color map associated with it; it is always displayed as blue on black. Thanks to Benjamin Füldner for pointing out what the extra 70 bytes are.
The color map is just a sequence of foreground/background pairs, exactly as in text color memory. The color attribute format is well-documented (somewhere), but for convenience I will describe it here briefly.
The color map gives the colors for the character cells in the logo in normal text order. Each color pair is packed into a single byte laid out as follows:
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|
| Background | Foreground | ||||||
| Blink (?) | R | G | B | I | R | G | B |
The blink bit (when blinking is enabled, which I believe is the case at startup) tells the video card to toggle the foreground between foreground and background colors. "I" is the intense bit, which brightens all of the components. There are actually some extra details to this (e.g. the issue of dark yellow vs. brown, varying roles of bits 7 and 3 depending on settings, changing the CGA palette in VGA, etc.). You can see a simulation of the palette in the CGA article on Wikipedia.
Presumably, if blinking is enabled at startup, one should be able to make parts of the logo blink, with the same layout restrictions as for the colors. I haven't tested this (since I haven't tried to replace my logo yet), but I think it will work. It appears no one else has thought of this.
This is a true bitmap: each pixel is either foreground or background, but different colors are assigned according to the color map described above. As stated before, the bitmap is really a piece of a VGA font. As such, it is not laid out in the same way as most bitmaps are, line by line; instead, all of the pixels for one 8x14 cell are given, then those of the next. The following table should make this layout clear. The interior numbers refer to the order of the bytes within the data. The lines within the cells are encoded most-significant-bit first.
| Column 0 | Column 1 | ... | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Row 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 14 | 14 | 14 | 14 | 14 | 14 | 14 | 14 | ... |
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 15 | 15 | 15 | 15 | 15 | 15 | 15 | 15 | ... | |
| 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | ... | |
| 3 | 3 | 3 | 3 | 3 | 3 | 3 | 3 | 17 | 17 | 17 | 17 | 17 | 17 | 17 | 17 | ... | |
| 4 | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | 18 | ... | |
| 5 | 5 | 5 | 5 | 5 | 5 | 5 | 5 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | 19 | ... | |
| 6 | 6 | 6 | 6 | 6 | 6 | 6 | 6 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | 20 | ... | |
| 7 | 7 | 7 | 7 | 7 | 7 | 7 | 7 | 21 | 21 | 21 | 21 | 21 | 21 | 21 | 21 | ... | |
| 8 | 8 | 8 | 8 | 8 | 8 | 8 | 8 | 22 | 22 | 22 | 22 | 22 | 22 | 22 | 22 | ... | |
| 9 | 9 | 9 | 9 | 9 | 9 | 9 | 9 | 23 | 23 | 23 | 23 | 23 | 23 | 23 | 23 | ... | |
| 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 24 | 24 | 24 | 24 | 24 | 24 | 24 | 24 | ... | |
| 11 | 11 | 11 | 11 | 11 | 11 | 11 | 11 | 25 | 25 | 25 | 25 | 25 | 25 | 25 | 25 | ... | |
| 12 | 12 | 12 | 12 | 12 | 12 | 12 | 12 | 26 | 26 | 26 | 26 | 26 | 26 | 26 | 26 | ... | |
| 13 | 13 | 13 | 13 | 13 | 13 | 13 | 13 | 27 | 27 | 27 | 27 | 27 | 27 | 27 | 27 | ... | |
| Row 1 | 238 | 238 | 238 | 238 | 238 | 238 | 238 | 238 | 252 | 252 | 252 | 252 | 252 | 252 | 252 | 252 | ... |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
The above assumes the usual width of 17 cells.
The Award logo has the same basic layout, but is always 3 cells wide and 2 high and starts with the second column in the first row; there is no data for the upper-left cell, as Award obviously assumed no one would ever change it.
Converting out of this format is almost trivial. First, you need a table of
RGB values for the palette. You read the first two bytes, giving the width
followed by the height; then read in the color map (width*height
bytes) and the bitmap (width*height*14 bytes), rearranging
according to the cell-line order and assigning colors based on the palette and
color map. The format seems designed for this sort of thing.
One can also convert the Award logo by a similar process. But remember that the upper-left cell is skipped; plus, the whole logo is monochrome.
This is trickier. There are a number of ways to do this. From the user's perspective, we have these:
And from the programmer's perspective, there are these:
I suspect that producing the best possible color representation in this format is somewhere in NP, and that the only obvious algorithm is an iterative approximation.
Dealing with the Award logo is much simpler, as it is monochrome. I shouldn't need to say anything more about it.
I hope this information is useful to someone someday. Feel free to drop me comments. See the bottom of this page.
Last updated: Mon Aug 11, 2008
E-mail (anti-spam mangled): ddawson at icehouse dot net