printing 'μ' character

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
nickoas
Posts: 2
Joined: Tue Jan 07, 2014 4:52 am

printing 'μ' character

Post 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
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: printing 'μ' character

Post 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.
"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 ]
nickoas
Posts: 2
Joined: Tue Jan 07, 2014 4:52 am

Re: printing 'μ' character

Post by nickoas »

It works !

Thank you very very very much ;)
Post Reply