The stucture of the 320x200x256 VGA mode
| |
As you can see on the picture, the structure of this VGA screen is really
simple. We can have 256 different colors for each pixel and one byte can
contain the same number of different values, so it must be this simple: in
the memory each byte represents a pixel. The screen memory is linear. This
means that if the address of the first pixel is A, then the next pixel's
address is A+1, the next is A+2 and so on.
A scanline has 320 pixels, so the differene between 2 scanlines is always 320
bytes. Because the videomode is a standard VGA mode, and it is small enough,
we do not need protected mode to access this memory area. It is reachable
simply in the real mode memory segment $A000. Therefore, if you know,
how to access the memory directly from your favourite programming language,
drawing is really easy. For example in Borland Pascal we could do this:
mem[$a000:$0000]:=15; { set the first pixel in the screen to white }
I will tell more about the color codes later. For now it's enough if we know that
15 is the "code" for white.
Now tell me, could it be more simpler? Such a nice video mode.
Back