omarrx024 wrote:
It's fine, but what is color depth? BTW, you are calculating the pointer to the character twice, which is going to decrease performance. In text modes, I guess the color depth is always 1 byte.
No, you don't need to draw a character at cursor position. You just need to have an attribute at the X/Y position of the cursor as if there was a character. Try clearing your screen but putting character 0x20 (space) in all character fields, and attribute 0x70 (just random color for testing) in all attribute fields. Then run this code:
Code:
outb(0x3D4, 0x0E);
outb(0x3D5, 0x00);
outb(0x3D4, 0x0F);
outb(0x3D5, 0x00);
You should see a cursor at the top-left corner. If not, then you need to tweak the VGA registers to make the cursor visible. I'll dig up the docs; I have them somewhere but haven't used them for a long time.
Color depth is two. I did it all exactly as you told me to do:
Code:
for(int i = 0; i < rows * columns; i++)
{
tty_buffer[i * 2] = 0x20;
tty_buffer[i * 2 + 1] = 0x70;
}
Outportb(0x3D4, 0x0E);
Outportb(0x3D5, 0x00);
Outportb(0x3D4, 0x0F);
Outportb(0x3D5, 0x00);
then I got a gray screen with nothing on it, that is really weird. No cursor at all.
VGA documents