Drawing In Protected Mode: Difference between revisions

[unchecked revision][unchecked revision]
Line 147:
screen[where + 1] = (color >> 8) & 255; // GREEN
screen[where + 2] = (color >> 16) & 255; // RED
}
</source>
 
So a full "putpixel" function for VGA would be
<source lang="c">
/* example for 320x200 VGA */
void putpixel(int pos_x, int pos_y, unsigned char VGA_COLOR)
{
unsigned char* location = (unsigned char*)0xA0000 + 320 * pos_y + pos_x;
*location = VGA_COLOR;
}
</source>
Anonymous user