CGA programming

This is an old revision of this page, as edited by 130.243.70.90 (talk) at 16:42, 21 November 2002. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Details about programming for CGA.

I will put a more detailed spec about programming CGA here.

The video memory for the CGA framebuffer is supposed to be placed at real-mode segment 0xB800. 1 bit per pixel means that every byte packs 8 pixels, one for each bit respectively. The most significant bit controls the left-most pixel.


The video memory layout in my poqet for 640x200x1bpp is a bit weird. Firstly, the screen is partitioned into odd and even scanlines, and odd (if you start numbering them at 1) lines comes first in video memory, and even lines comes last:

0: (0,0) ... (639,0) 80: (0,2) ... (639,2)

 ...

7920: (0,198) ... (639,198) 8000: Pixels 0 - 639 of the indicator-bar (which is 4 pixels high, but only addressable per column)

Here are 72 bytes that does I dont know what.

8152: (0,1) ... (639,1) 8232: (0,3) ... (639,3)

...

I dont know what those "missing" 72 bytes are yet. I also dont know how CGA is normally arranged in memory.

Disclaimer: I am still not sure about very much when it comes to CGA, but I will try to find more out.