Text Mode Switching

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
User avatar
Apophis
Posts: 8
Joined: Wed Nov 03, 2010 2:29 am

Text Mode Switching

Post by Apophis »

I've been searching and searching and have not found much consensus on the topic of switching video modes. What I'm looking for right now is just a way to switch to a different text mode (I want more rows/columns). What is the generally accepted way to do this in protected mode? Is it to just drop into real mode or "virtual" real mode and use INT 0x10? I know this is probably the easiest but I've been trying to avoid it since I just haven't done it yet. Should I just suck it up and add that feature to my OS?

I'm using GRUB Legacy currently to boot the OS and am thinking about switching to GRUB 2 for the improved VBE support.
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: Text Mode Switching

Post by neon »

Hello,

This is up to you - in protected mode you can either drop into v86 mode or with VGA/SVGA. I would personally recommend supporting both - but VBE would be the easier way to go.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Text Mode Switching

Post by Combuster »

First of all, there is no such thing as consensus in hobby OS development. That problem is even referred to in the list of beginner mistakes. I hope you have the ability to find and weigh off advantages and disadvantages and make an educated choice that suits you.

For the rest, the relevant FAQ is perfectly valid, and even contains the key arguments: http://wiki.osdev.org/How_do_I_set_a_graphics_mode
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Text Mode Switching

Post by egos »

To set specific text mode you should reprogram all vga registers. But if setting mode has a small difference from current then you can try to reset only some registers. For example I have following difference between 80x25 (720x400) and 80x30 (720x480) modes:

Code: Select all

  MSR: 67 E7
CRT06: BF 0B
CRT07: 1F 3E
CRT10: 9C EA
CRT11: 8E 8C
CRT12: 8F DF
CRT15: 96 E7
CRT16: B9 04
If you have seen bad English in my words, tell me what's wrong, please.
Post Reply