another doubt in vga

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
asdfgh
Member
Member
Posts: 42
Joined: Fri Apr 18, 2008 9:14 pm

another doubt in vga

Post 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
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: another doubt in vga

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: another doubt in vga

Post 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
Post Reply