Also, if you wanted to pring a single pixel, mixing it with actual contents of video memory, I'd do this (Warning! Untested code!):
#define M0_PIXEL1_MASK 0xAA
#define M0_PIXEL2_MASK 0x55
// x,y: pixel coordinates in pixels
// pixel_color: PEN color for the pixel to be lightened
//
void putpixel(u8 x, u8 y, u8 pixel_color) {
u8* pvmem, pix1 = 0, pix2 = 0;
// Get a pointer to the byte where the pixel is
pvmem = cpct_getScreenPtr((u8*)0xC000, x / 2, y);
// Check if pixel is even (pixel 1) or odd (pixel 2)
if (x & 1) {
// Odd pixel = Pixel 2 = Right pixel of the byte
// Even pixel will stay, Odd pixel have to be removed
*pvmem &= M0_PIXEL1_MASK;
pix1 = pixel_color;
} else {
// Even pixel = Pixel 1 = Left pixel of the byte
// Odd pixel will stay, Even pixel have to be removed
*pvmem &= M0_PIXEL2_MASK;
pix2 = pixel_color;
}
// Set the color of the pixel
*pvmem |= cpct_px2byteM0 (pix1, pix2);
}