How to get a list of available text modes

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
XStream

How to get a list of available text modes

Post by XStream »

Hi,

I am wondering if anyone knows how to get a list of available text modes using either the BIOS or the VGA Registers directly, I have been looking throught the Interrupt list but can only find functions to get the current mode details. I also had a look at the FreeVGA project but couldn't seem to find anything.

Cheers.
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Re:How to get a list of available text modes

Post by Colonel Kernel »

I've never tried using the BIOS functions for VGA, but I've used the info at FreeVGA to help me write code to set various text modes (80x25, 80x50, 90x60, etc.). I don't think the VGA hardware itself has any concept of "modes". You basically have to know what values to put in all the VGA registers for any given "mode".

This sample code by Chris Giese helped me a lot:

http://my.execpc.com/~geezer/osd/graphics/modes.c
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
XStream

Re:How to get a list of available text modes

Post by XStream »

Cool, that looks good.

Also, is it possible to change the location in memory that is mapped to the VGA ram?

Thanks.
User avatar
bubach
Member
Member
Posts: 1223
Joined: Sat Oct 23, 2004 11:00 pm
Location: Sweden
Contact:

Re:How to get a list of available text modes

Post by bubach »

Code: Select all

INT 10h, Service 0h
Set Screen Mode

Input:  AH = 0h
        AL = Mode Number (see below)
Output:  The video mode is changed.

Mode Number  Text Res.  Graphics Res.  Description  Adapters  Max. Pages
---------------------------------------------------------------------------
        0h      40x25        ------  B&W Text    CGA+              8
        1h      80x25        ------  B&W Text    MDPA+              8
        2h      40x25        ------  Color Text  CGA+          4 or 8
        3h      80x25        ------  Color Text  (MDPA?)/CGA+  4 or 8
        4h      40x25        320x200  4 colors    CGA+              1
        5h      40x25        320x200  2 colors    CGA+              1
        6h      80x25        640x200  2 colors    CGA+              1
        7h      80x25        ------  B&W          MDPA (CGA+?)      1
        8h to Ch -- PCjr or other adapters; no longer used
        Dh      40x25        320x200  16 colors    EGA+              8
        Eh      80x25        640x200  16 colors    EGA+              4
        Fh      80x25        640x350  2 colors    EGA+              2
        10h      80x25        640x350  16 colors    EGA+              2
        11h      80x25        640x480  2 colors    VGA+              1
        12h      80x25        640x480  16 colors    VGA+              1
        13h      40x25        320x200  256 colors  VGA+              1
"Simplicity is the ultimate sophistication."
http://bos.asmhackers.net/ - GitHub
Post Reply