Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
In VGA text mode, 8th bit of attribute byte has two meanings. In real mode, it is possible to toggle between them via Int 0x10/AX=1003h.
I try to do it in protected mode, so no BIOS is available. I think it should be possible to do it via Mode Control register (0x3C0/0x10). I tried to do it, but it resulted in black screen. Here's my code:
inb(0x3DA); // to index state
outb(0x3C0, 0x10); // register index
// if I stop at this point or beyond then black screen
uint8_t value = inb(0x3C1);
inb(0x3DA);
outb(0x3C0, 0x10);
outb(0x3C0, value & 0xF7); // disable 4th bit (numbering from 1) to go to 16 background colors
Did someone have this problem before? What am I really doing with this code? Am I misinterpreting the documentation? Can someone help me?
When you select an index via register 0x3C0, you'll want to set bit 5 (counting from 0). This means you'll be operating the attribute controller in "normal" mode instead of messing with the internal palette.
I just made it work. One thing I didn't know is Palette Address Source bit in Attribute Address Register. I also found some simple bugs after video began working again, but blinking wasn't disabled (spurious return in the middle of my code or extra tilde in my copy to /boot command)
Thanks for pointing that bit out
PS. QEMU doesn't support blinking at all. I had to reboot my physical computer to test this code.