Working with VGA Text Mode
Posted: Wed May 08, 2013 10:48 pm
So this I have everything working except when I do mode 90x60 and clear the console, and write "hello world" I only see half the text. Which is odd... So I looked over this code that I used as a base and noticed something:
They are informing the BIOS of the change, well I'm in long mode, so if this is the case I can't do that. But I think peekb and pokeb are just setting values in Memory. Am I correct? I tried this theory and nothing changes. So what do I do? Thanks, Matt
Original Source: http://files.osdev.org/mirrors/geezer/o ... cs/modes.c
Image:
Code: Select all
void set_text_mode(int hi_res)
{
unsigned rows, cols, ht, i;
if(hi_res)
{
write_regs(g_90x60_text);
cols = 90;
rows = 60;
ht = 8;
}
else
{
write_regs(g_80x25_text);
cols = 80;
rows = 25;
ht = 16;
}
/* set font */
if(ht >= 16)
write_font(g_8x16_font, 16);
else
write_font(g_8x8_font, 8);
/* tell the BIOS what we've done, so BIOS text output works OK */
pokew(0x40, 0x4A, cols); /* columns on screen */
pokew(0x40, 0x4C, cols * rows * 2); /* framebuffer size */
pokew(0x40, 0x50, 0); /* cursor pos'n */
pokeb(0x40, 0x60, ht - 1); /* cursor shape */
pokeb(0x40, 0x61, ht - 2);
pokeb(0x40, 0x84, rows - 1); /* rows on screen - 1 */
pokeb(0x40, 0x85, ht); /* char height */
/* set white-on-black attributes for all text */
for(i = 0; i < cols * rows; i++)
pokeb(0xB800, i * 2 + 1, 7);
}
Original Source: http://files.osdev.org/mirrors/geezer/o ... cs/modes.c
Image: