I want to share some of my experiments. I'm playing around with Bochs Graphics Adaptor for the moment. I've got most of it working. In 8, 15, 16, 24 and 32 BPP modes it behaved like I expected, but I stumbled upon a few funny things in 4 BPP mode.
Initially I believed the 4 BPP mode would have a memory layout like this:
Code: Select all
Color bit: 3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
,-------.-------. ,-------.-------. ,-------.-------. ,-------.-------.
|MSB X X|X X LSB| |X X X X|X X X X| |X X X X|X X X X| |X X X X|X X X X|
`-------'-------' `-------'-------' `-------'-------' `-------'-------'
Pixel 1 Pixel 0 Pixel 3 Pixel 2 Pixel 5 Pixel 4 Pixel 7 Pixel 6
Color bit: 3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0
,-------.-------. ,-------.-------. ,-------.-------. ,-------.-------.
|X X X X|X X X X| |X X X X|X X X X| |X X X X|X X X X| |X X X X|X X X X|
`-------'-------' `-------'-------' `-------'-------' `-------'-------'
Pixel 9 Pixel 8 Pixel11 Pixel10 Pixel13 Pixel12 Pixel15 Pixel14
Code: Select all
Color bit 0 Color bit 1 Color bit 2 Color bit 3
,---------------. ,---------------. ,---------------. ,---------------.
|MSB X X X X LSB| |X X X X X X X X| |X X X X X X X X| |X X X X X X X X|
`---------------' `---------------' `---------------' `---------------'
Pixel: 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
Color bit 0 Color bit 1 Color bit 2 Color bit 3
,---------------. ,---------------. ,---------------. ,---------------.
|X X X X X X X X| |X X X X X X X X| |X X X X X X X X| |X X X X X X X X|
`---------------' `---------------' `---------------' `---------------'
Pixel: 8 9 101112131415 8 9 101112131415 8 9 101112131415 8 9 101112131415
Is that normal behaviour or is it a bug in BGA? On the vgabios news site (updated some time in 2006??) they say they fixed a lot of bugs relating to 4 BPP, but maybe they newer really got it right?
When that worked I also wanted to play with the DAC palette. I already got it to work nicely in 8 BPP mode, where you have 256 colors. If you draw pixel with the value X you have to update DAC palette entry no. X. Plain and simple. But not in 4 BPP mode! Here is a table representing pixel values and their DAC palette entry, when using BGA in 4 BPP mode:
Code: Select all
Pixel value: DAC palette entry:
------------ ------------------
0 0
1 1
2 2
3 3
4 4
5 5
6 20 <-- how wierd is that?
7 7
8 56
9 57
10 58
11 59
12 60
13 61
14 62
15 63
Maybe I should add this info to the wiki on Bochs VBE extensions.