[comp.sys.ibm.pc] HELP! Screen memory organisation.

stevep@galadriel.UUCP (Steve Paine) (06/26/89)

I need help with the PC's screen memory. I am writing a program that needs to be portable amongst PC - clones, and must use standard graphics. (Not EGA etc.)
I gather that writing directly to screen memory is the standard way to do
hi-res on a pc, so i've found the sceen memory (a0000h - b0000h, yes?).
How is the memory configured in the graphics modes or can anyone point me to some good books on the subject.

From a 'wet-behind-the-ears' PC user - Thanks.

gharring@enprt.Wichita.NCR.COM (Gary Harrington) (06/29/89)

In article <278@galadriel.UUCP> stevep@galadriel.UUCP (Steve Paine) writes:
>I need help with the PC's screen memory...must use standard graphics...

A very quick view of CGA graphics memory:

----------------------------------------------------------------------------
|
|  CGA Graphics, 320 x 200 pixels, 4 colors, memory organization:
|  =================================================
|  |  7  |  6  |  5  |  4  |  3  |  2  |  1  |  0  |
|  =================================================
|   \         /                         \         /
|    \       /                           \       /
|    pixel 0,0                           pixel 3,0
|
| address 0B8000H - 0B9F3FH:  even scan lines (0,2,4,...198)
| address 0BA000H - 0BBF3FH:  odd  scan lines (1,3,5,...199)
|
|Of each bit pair, the most significant bit controls the red gun, the other
|controls the green gun.
|
|This gives:
|
|       Palette 0                           Palette 1
|    ---------------                     ---------------
|    MSB  LSB  Color                     MSB  LSB  Color
|    ---  ---  -----                     ---  ---  -----
|     0    1   Green                      0    1   Cyan
|     1    0   Red                        1    0   Magenta
|     1    1   Brown                      1    1   White
|
+---------------------------------------------------------------------------
|
|  CGA Graphics, 640 x 200 pixels, black & white, memory organization:
|  =================================================
|  |  7  |  6  |  5  |  4  |  3  |  2  |  1  |  0  |
|  =================================================
|     |                                         |
|     |                                         |
|  pixel 0,0                                 pixel 7,0
|
| addresses are the same as for 320 x 200 above.
|
---------------------------------------------------------------------------