Page 1 of 1

another doubt in vga

Posted: Sun Jul 13, 2008 4:06 am
by asdfgh
when i use 600 * 480 * 2 color mode we use one bit for a pixel..
but how is it working in 600*480* 16 color mode.. ??

it exceeds 0xBFFFF

Re: another doubt in vga

Posted: Sun Jul 13, 2008 2:40 pm
by Combuster
the vga has 256K ram. Between A0000 and AFFFF goes only 64k. Read VGA Hardware to see how your video card gets away with that.

Re: another doubt in vga

Posted: Mon Jul 14, 2008 4:45 am
by jal
asdfgh wrote:when i use 600 * 480 * 2 color mode we use one bit for a pixel..
but how is it working in 600*480* 16 color mode.. ??
Exactly the same way. The VGA (and older EGA) has four layers of memory called 'planes'. Each plane is max. 64KB (640x480, the standard VGA mode, has 307200 or 300K pixels, with 1 pixel per bit that's 37,5KB of memory per plane). The pixel of one colour is, ultimately, determined by the 4 bits in each plane (2^4 = 16 possible colours per pixel). In 2 colour mode, the VGA is set up in such a way that a write will affect all 4 planes, so the only possible values are 1111b and 0000b. The standard pallet converts this into white and black, respectively.

Having said that, the VGA hardware is insanely complex to use efficiently. So unless you really go for obsolete hardware, try VESA instead. It'll give you millions of colours in a contigious frame buffer (in pmode at least). Far easier, far more usuable.


JAL