Page 1 of 1

About video card text mode.

Posted: Fri Sep 12, 2008 1:17 am
by oizys
When I put a number into the video memory,there will be a char display on the monitor.
Then,how the video card konw which char will be display and how to show it? Is there any files in the video memory or pc memory control it ?


Because I want to write a OS can display Chinese in text mode,so it is important to me.
Thinks!



oizys

Re: About video card text mode.

Posted: Fri Sep 12, 2008 1:24 am
by thepowersgang
http://wiki.osdev.org/VGA_Hardware

The basic gist is that in Text Mode, Planes 0 and 1 are used for the character and attributes and Plane 2 is the font data.

Re: About video card text mode.

Posted: Fri Sep 12, 2008 4:12 am
by Combuster
The limit of text mode is that you can have only 256 (or 512 if you want to do VGA-specific stuff) different characters max on your screen. How do you intend to cope with the fact that chinese (as I recall it) has much more characters than that?

Re: About video card text mode.

Posted: Fri Sep 12, 2008 5:00 am
by jal
Combuster wrote:The limit of text mode is that you can have only 256 (or 512 if you want to do VGA-specific stuff) different characters max on your screen. How do you intend to cope with the fact that chinese (as I recall it) has much more characters than that?
About 20,000 in the Unified CJK section of Unicode, but I think one can get by with about 1000-4000 for daily use.


JAL

Re: About video card text mode.

Posted: Fri Sep 12, 2008 5:21 am
by Brendan
Hi,
Combuster wrote:The limit of text mode is that you can have only 256 (or 512 if you want to do VGA-specific stuff) different characters max on your screen. How do you intend to cope with the fact that chinese (as I recall it) has much more characters than that?
It might be theoretically possible to come slightly close - every time you draw a screen you find the 510 most frequently used characters, then auto-generate a new font that contains the 510 most frequently used characters. For the 2 remaining characters, one would be used for white-space. The last character would be a special "Sorry, can't display this properly at the moment" character.

With 40*25 text mode there's a maximum of 1000 characters on the screen at a time, so worst case would be 510 unique characters and 490 characters that can't be displayed. If 250 of those characters are whitespace and 250 of them are used twice, then it works without any characters that can't be displayed properly. Also, if you halve the resolution (e.g. only use even columns, where odd columns always contain whitespace) then you'd always be able to display all characters.

However, it'd be a lot easier to just use graphics mode instead. This would give better results too. Creating 8 * 8 or 8 * 16 bitmap fonts is hard enough for ASCII characters without trying to adequately represent the fine brush-strokes of Chinese (you can't use anti-aliasing for text mode fonts, or 32 * 32 fonts).


Cheers,

Brendan

Re: About video card text mode.

Posted: Fri Sep 12, 2008 8:33 am
by oizys
Combuster wrote:The limit of text mode is that you can have only 256 (or 512 if you want to do VGA-specific stuff) different characters max on your screen. How do you intend to cope with the fact that chinese (as I recall it) has much more characters than that?


I know that there is only 256 characters can be show in text mode,but the rule is set by someone who write and build it...

So I want to change it,and I just want to konw if it is possible.


oizys

Re: About video card text mode.

Posted: Fri Sep 12, 2008 8:48 am
by oizys
Brendan wrote:Hi,
Combuster wrote:The limit of text mode is that you can have only 256 (or 512 if you want to do VGA-specific stuff) different characters max on your screen. How do you intend to cope with the fact that chinese (as I recall it) has much more characters than that?
It might be theoretically possible to come slightly close - every time you draw a screen you find the 510 most frequently used characters, then auto-generate a new font that contains the 510 most frequently used characters. For the 2 remaining characters, one would be used for white-space. The last character would be a special "Sorry, can't display this properly at the moment" character.

With 40*25 text mode there's a maximum of 1000 characters on the screen at a time, so worst case would be 510 unique characters and 490 characters that can't be displayed. If 250 of those characters are whitespace and 250 of them are used twice, then it works without any characters that can't be displayed properly. Also, if you halve the resolution (e.g. only use even columns, where odd columns always contain whitespace) then you'd always be able to display all characters.

However, it'd be a lot easier to just use graphics mode instead. This would give better results too. Creating 8 * 8 or 8 * 16 bitmap fonts is hard enough for ASCII characters without trying to adequately represent the fine brush-strokes of Chinese (you can't use anti-aliasing for text mode fonts, or 32 * 32 fonts).


Cheers,

Brendan


You are rigth,use graphics mode instead is much more simple.


I got a bin file of VIDEO ROM from my linux memroy by use "cat /proc/iomem" cmd,and I found there is a ASCII character bitmaps in it(sorry,I can't descrip it clearly by useing english).

Do you konw who will use these bitmaps,the video or the linux os,and how can I change it?

Re: About video card text mode.

Posted: Fri Sep 12, 2008 9:00 am
by Combuster
The VGA can either use one font bank (for a total of 256 character slots) or two (for a total of 512 character slots) and that's the limit for text mode, period.

So you either use one of the methods Brendan mentioned to try and have enough free slots to describe all, or better, use graphics mode (which is more straightforward than hacking at the font banks which essentially is a braindamaged graphics mode already)

[additional post made]

The font bank stored in the video rom contains the default font for when the system is booted and a font is needed. The only point for the OS to use it is, is for when it doesn't come with its own font and consequently wants to reuse the one coming with the video card. (Which will work pretty well if you only plan on using the first 128 entries), But since you want to print in Chinese, you'll have no use in grabbing an english character set from the graphics card. :wink:

Re: About video card text mode.

Posted: Fri Sep 12, 2008 9:24 am
by Brendan
Hi,
oizys wrote:I got a bin file of VIDEO ROM from my linux memroy by use "cat /proc/iomem" cmd,and I found there is a ASCII character bitmaps in it(sorry,I can't descrip it clearly by useing english).

Do you konw who will use these bitmaps,the video or the linux os,and how can I change it?
The font data you found in the video card's ROM is copied to the video card's RAM and used as the default font whenever the video BIOS is used to set a text mode. It's extremely difficult to change the font data in ROM, but not that hard to change the font data after it's been copied into the video card's RAM.

I'm not sure of the exact method used to change the font data in the video card's RAM - for my OS I use graphics video modes only (even when I only need to display ASCII). I'd be tempted to try this video BIOS function though (and probably this one too)...
oizys wrote:You are rigth,use graphics mode instead is much more simple.
Yes - it also let's you draw windows, icons, pictures, etc (everything that a modern OS needs to draw, not just characters)...


Cheers,

Brendan