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: