Page 1 of 1

printing 'μ' character

Posted: Tue Jan 07, 2014 5:00 am
by nickoas
Hi !

I'm a beginner to kernel development and I use the vga text mode.
I would like to print the character μ but I don't know how do that. I found on http://en.wikipedia.org/wiki/Code_page_437 this character exist but I don't know how to find it in vga-card.
I'm requesting your help for indicate me the easier way to do that.

Thank you

Re: printing 'μ' character

Posted: Tue Jan 07, 2014 6:56 am
by Combuster
If that character is embedded on the VGA, it will also be in the text mode font since it's a copy of the same thing. Basically the only thing you need to do to get a µ on screen is to do the equivalent of

Code: Select all

mov word [0xB8000], 0x0FE6
where E6 is the glyph index for µ and 0F is white-on-black, which is exactly the same as for drawing any other character to the screen.

What might be a problem however is that µ isn't part of ASCII, and has varying indexes in different text encodings, being E6 in VGA, B5 in ISO-8859-1 and windows, and 03BC (amongst others) in Unicode, so if you actually typed an µ in your text editor, chances are likely it's not stored as E6.

Re: printing 'μ' character

Posted: Tue Jan 07, 2014 7:45 am
by nickoas
It works !

Thank you very very very much ;)