How To? -- Switch to 80x50 with in/outs VGA registries
- StrangeBrew
- Posts: 7
- Joined: Tue Feb 01, 2011 6:37 pm
How To? -- Switch to 80x50 with in/outs VGA registries
Hello.
Disclaimer: I promise I'll RTFM/STFW later in life.
I'd like to use the 80x50 textmode resolution. I can't use BIOS interrupts because I'm in protected mode.
I'm sure there's a way of using in and out with the VGA registries so that the 80x50 mode is selected. Anybody have some free of charge code snippets I can use?
Thank you for reading.
Disclaimer: I promise I'll RTFM/STFW later in life.
I'd like to use the 80x50 textmode resolution. I can't use BIOS interrupts because I'm in protected mode.
I'm sure there's a way of using in and out with the VGA registries so that the 80x50 mode is selected. Anybody have some free of charge code snippets I can use?
Thank you for reading.
- Combuster
- 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: How To? -- Switch to 80x50 with in/outs VGA registries
I'll murder you now, but it doesn't matter because I promise I will stick to the rules after having done so.Disclaimer: I promise I'll RTFM/STFW later in life.
You only need one line: set the character height from 16 to 8 and your goal is achieved.Anybody have some free of charge code snippets I can use?
Re: How To? -- Switch to 80x50 with in/outs VGA registries
That's correct (if vertical resolution is equal to 400). There are some additional registers: CRT x0A, x0B and x14.
If you have seen bad English in my words, tell me what's wrong, please.
Re: How To? -- Switch to 80x50 with in/outs VGA registries
Well, uploading a font that fits your programmed character height helps too.
- StrangeBrew
- Posts: 7
- Joined: Tue Feb 01, 2011 6:37 pm
Re: How To? -- Switch to 80x50 with in/outs VGA registries
Only one line of code? Then my approach which half-works is definitely wrong...
Code: Select all
outb(0x3D4, 0x9);
outb(0x3D5, 0x7);
outb(0x3C4, 0x1);
outb(0x3C5, 0x0);
outb(0x3C4, 0x3);
outb(0x3C5, 0x3F);
-
- Member
- Posts: 255
- Joined: Tue Jun 15, 2010 9:27 am
- Location: Flyover State, United States
- Contact:
Re: How To? -- Switch to 80x50 with in/outs VGA registries
Look up a register dump for the mode you want. While there are some at the wiki at VGA Hardware, none of them are for the mode you want. As Combuster said all you need to do is change the character height. After this you do need to poke a new font into VGA memory. However, if you aren't willing to read the documentation that tells you what is required to do this, you will never get anywhere.
- StrangeBrew
- Posts: 7
- Joined: Tue Feb 01, 2011 6:37 pm
Re: How To? -- Switch to 80x50 with in/outs VGA registries
So I have to construct my own font? Combuster you lied to me about that one line of code.
- Combuster
- 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: How To? -- Switch to 80x50 with in/outs VGA registries
And I lied where? In fact, you have the correct resolution (720x400) on boot.I'd like to use the 80x50 textmode resolution.
And yes, I was well aware about the font, and to be honest it was I left it out to see if the message got across and a smart (lack of) question came back or if a bigger rant was required.
And no, you don't have to construct your own font.
Re: How To? -- Switch to 80x50 with in/outs VGA registries
Conventionally speaking, Combuster is right. Valid font/visible cursor is additional service for 80x50 char res
Here are reg dump values from my tables:
CRT x09: 47 (originally 4F)
CRT x0A: 06 (originally 0D or 0E)
CRT x0B: 07 (originally 0E or 0F)
CRT x14: 1F (I think it's simply max value)
For font loading: look here.
Here are reg dump values from my tables:
CRT x09: 47 (originally 4F)
CRT x0A: 06 (originally 0D or 0E)
CRT x0B: 07 (originally 0E or 0F)
CRT x14: 1F (I think it's simply max value)
For font loading: look here.
If you have seen bad English in my words, tell me what's wrong, please.
- StrangeBrew
- Posts: 7
- Joined: Tue Feb 01, 2011 6:37 pm
Re: How To? -- Switch to 80x50 with in/outs VGA registries
Thanks egos.
My version that I posted earlier doesn't set the CRT[0x09] bit for 200-400 line conversion but works the same as your code...
So to clarify, must I use a 8x8 font set of my own making, or is there a premade set in VGA?
My version that I posted earlier doesn't set the CRT[0x09] bit for 200-400 line conversion but works the same as your code...
So to clarify, must I use a 8x8 font set of my own making, or is there a premade set in VGA?
- Combuster
- 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: How To? -- Switch to 80x50 with in/outs VGA registries
If you haven't messed up with the real-mode settings, there is a font in the VGA rom and you can usually get to it, but it might be easier to just rip that font offline and then include it in your project - that way you also have a font for graphics mode. (The VGA fonts are public domain).
But as I said, you don't need to build a font: http://dimensionalrift.homelinux.net/co ... ont8_8.asm (unicode-based)
But as I said, you don't need to build a font: http://dimensionalrift.homelinux.net/co ... ont8_8.asm (unicode-based)
- StrangeBrew
- Posts: 7
- Joined: Tue Feb 01, 2011 6:37 pm
Re: How To? -- Switch to 80x50 with in/outs VGA registries
Thanks, but you just said one doesn't need to build his own font because the VGA ROM already has a set.
I found Chris Giese's examples but I'm having a tough time converting his code because he uses some alien functions, like set_plane().
Right now I have 80x50 textmode but the fonts are twice as big and if I try to use SEQ_REG[0x3] with the documented values every character gets transformed into a box colored in the foreground color. I imagine there's something else I have to set?
I found Chris Giese's examples but I'm having a tough time converting his code because he uses some alien functions, like set_plane().
Right now I have 80x50 textmode but the fonts are twice as big and if I try to use SEQ_REG[0x3] with the documented values every character gets transformed into a box colored in the foreground color. I imagine there's something else I have to set?
Re: How To? -- Switch to 80x50 with in/outs VGA registries
Did you see this?
I wrote:Font loading:
graph[0x05] = 0x00 (bit 4 = 0)
graph[0x06] = 0x0C (bit 1 = 0)
seq[0x02] = 0x04 (0100b)
seq[0x04] = 0x06/0x07 (bit 2 = 1)
Characters and attributes writing (normal mode):
graph[0x05] = 0x10 (bit 4 = 1)
graph[0x06] = 0x0E (bit 1 = 1)
seq[0x02] = 0x03 (0011b)
seq[0x04] = 0x02/0x03 (bit 2 = 0)
If you have seen bad English in my words, tell me what's wrong, please.