Setting VGA color palette dosn't give the right colors
Posted: Thu Jul 28, 2022 9:03 am
I was trying to make some art on the 0x13 screen, and set up some basic colors, but the colors wasn't the right one that I wanted, Is this some qemu bug or me doing it wrong?
I set up the color using this:
Draw function:
Output:
Wanted color:
I set up the color using this:
Code: Select all
void init_screen() {
outb(PALETTE_MASK, 0xFF);
outb(PALETTE_WRITE, 0);
outb(PALETTE_DATA, 0xFF);
outb(PALETTE_DATA, 0xFF);
outb(PALETTE_DATA, 0xFF);
outb(PALETTE_DATA, 0x00);
outb(PALETTE_DATA, 0x00);
outb(PALETTE_DATA, 0x00);
outb(PALETTE_DATA, 0xB3);
outb(PALETTE_DATA, 0x32);
outb(PALETTE_DATA, 0x27);
}
Code: Select all
void draw_mario(bool left) {
char * address = (char *) (VIDEO_ADDRESS + item.x + item.y * SC_WIDTH); // This isn't wrong
memset(address + 3, RED, 5); // RED = 2
UNUSED(left);
}
Wanted color: