Search code examples
assemblyx86vgavesa

Switching to high-resolution text modes on PC


I would like to write a text editor running on text screen. In modern PC 1280x1024 (160x64 char) screen would be good for flat panel. For safety reason I am working on a i865 based P4 motherboard. VESA bios sets the resolution but in graphics mode; additionally, the VGA registers shows the original DOS screen values. I need help how to program i865 to text mode.


Solution

  • 1280x1024 is not a VGA resolution. You will need to use VESA/VBE if you want to use these high-resolution modes. And, with one exception (that does not meet your requirement), there are no standard modes defined by VESA. You need to interrogate the video card and pick one of the supported modes. Use VBE function 00h to get a full list of supported modes, and function 01h to check the attributes for each of these supported modes to see if it meets your requirements.

    Once you've found the mode you want, function 02h will set that mode, and then you are basically done. Well, except for the hard part of writing code that puts text on the screen!

    This is all documented in the standard. Sample code in C is available on the OSDev Wiki.