|Back to index|
Mode 13h is probably the easiest screen mode to display graphics in.
It's resolution is 320x200 and it has a 256 color palette.
It's memory is linear and starts at address a000:0000.
Offset 0 is the upper left corner and offset 63999 is in the lower right corner. Each pixel takes up 1 byte of memory so the whole screen takes up 64000 bytes.
It's simple to translate x,y into an offset
offset = y * 320 + x
To enter mode 13h just use the screen interupt
To exit mode 13h simply return the screen to textmode
To put a pixel on the screen simply you write something to the screen memory.
This is how you change one of the colors to a rgb value of your choice.
And this is how you read a color
Here is a sample program
Jesper L. Poulsen