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
mov ax,0013h
To exit mode 13h simply return the screen to textmode
mov ax,0003h
To put a pixel on the screen simply you write something to the screen memory.
mov ax,0a000h
This is how you change one of the colors to a rgb value of your choice.
mov dx,3c8h
And this is how you read a color
mov dx,3c7h
Here is a sample program
|
Jesper L. Poulsen |