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.
KuzinAlexandr wrote:I'm wondering how video memory can be used in graphics mode. In text it is used like this:
You can access video memory the same way in graphics mode. The specifics depend on which mode you're using.
KuzinAlexandr wrote:I heard that the address 0xA0000 is already used for the graphic mode
Standard VGA modes 0xD, 0xE, 0xF, 0x10, 0x11, 0x12, and 0x13 use address 0xA0000. Standard VGA modes 0x4, 0x5, and 0x6 use address 0xB8000. Non-standard modes can use other addresses.
VGA has configuration registers. You can set the starting address of the framebuffer as you wish (within limits). The starting address can be set independent of whether you are in graphics or text mode.
When you use 16 colors per pixel, then writing a pixel is not so straight forward. You can only access 64 KB of the 256 KB. There is a configuration register where you tell the graphics circuit which of the four 64 KB parts should be accessible.
Those 4 parts (4x 64 KB) of the total memory (256 KB) are called "memory banks". Since you can only access 64 KB at any time you need to do bank switching (changing a value in a VGA configuration register).
A pixel is 4 bits in size (when using 16 colors). But every bit is stored in a different bank. So you store
[*] the bit 2^0 in bank 0
[*] the bit 2^1 in bank 1
[*] the bit 2^2 in bank 2 and
[*] the bit 2^3 in bank 3.
To sum it up and answer you question about a code snippet: You need at least a year of development time to write a proper VGA compatible driver. But I don't think that you can do it within a year.