OSDev.org
https://forum.osdev.org/

VGA mode hack
https://forum.osdev.org/viewtopic.php?f=1&t=23631
Page 1 of 1

Author:  mariuszp [ Sun May 22, 2011 12:57 pm ]
Post subject:  VGA mode hack

There isn't much information on the internet about this, and I really want it quite simple. I've made a panic screen, and I think it may have trouble when the GUI is enabled. My question is: how can I switch to 80x25 16-color text mode by modifying a VGA register or something? I can't use the BIOS in Protected Mode, and setting up VM86 is pointless when I only want this one, simple procedure Any help?

Author:  Combuster [ Sun May 22, 2011 3:27 pm ]
Post subject:  Re: VGA mode hack

If you're using a VESA mode, forget it. You need VBE or a dedicated device-specific driver to tear it down as it is not in VGA mode. Most devices I have actually developed native drivers for will stick in graphics mode whatever VGA writes you do, with results varying between no change to garbled displays or even defective signals that can potentially blow up monitors or require epilepsy warnings.

If you're in a VGA mode, it is still some work to do it properly:
- Unlock VGA registers, disable screen
- Restore the font (it must come from somewhere, and your typical sources may not be reliable anymore)
- Write a register image corresponding to mode 3h
- Reload the DAC and palettes if they might be modified. (available regdumps occasionally include the palette by default)
- Enable screen again and write text.

In other words, there's no quick hack to do it and be fairly sure you get a visible coredump. If you want a simple and reliable method during crashes, you may want to consider setting up a serial connection instead.

Author:  turdus [ Sun May 22, 2011 4:13 pm ]
Post subject:  Re: VGA mode hack

When I faced the same problem, I searched the wiki, and found this in a minute:
http://files.osdev.org/mirrors/geezer/o ... cs/modes.c
quite useful.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/