Display Text in Mode 12h

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
XStream

Display Text in Mode 12h

Post by XStream »

Hey,

I am considering using video mode 12h and was wondering how to display text in this mode, it is meant to be a text and graphics mode. I would like to do it by directly writing to the video memory rather than use the BIOS.

Cheers.
mystran

Re:Display Text in Mode 12h

Post by mystran »

Well, you can print text in any graphics mode by having font, and then drawing (hint: bitblt) the characters to the screen as graphics.
crasha

Re:Display Text in Mode 12h

Post by crasha »

hehe you make it sound so simple (not lol)
i'm using mode 12h for my text/graphics and it looks fine (although it doesn't work in bochs and you have to refresh the video mode a few times in QEMU).
if anyone knows a tutorial or something for making your own fonts for text in graphics mode please tell me :)
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Display Text in Mode 12h

Post by Pype.Clicker »

you should find that in game development tutorials. (Very) basically, you'll use the character value to retrieve a bitmap telling how you must draw it...

e.g.

Code: Select all

font['A']="..****.."
              ".**..**."
              "**....**"
              "**....**"
              "********"
              "**....**"
              "**....**";

for (row=0;row<8;row++)
  for (col=0; col<8; col++)
     if (font[i++]=='*')
        putpixel(base+row*scrwidth+col);
XStream

Re:Display Text in Mode 12h

Post by XStream »

Yeah, I was aware that you need fonts however this mode is listed as being text and graphics so I thought there may have been a way to have it draw the font for you. Anyway, that is no big deal, so can anyone tell me where in memory I can find the standard font that is used in normal text modes, I would really like to avoid adding 4KB to my file just to have a font defined, especially at boot time when loading should be as quick as possible. I assume the font would be in the BIOS data area but how can I find it?

Cheers.
ASHLEY4

Re:Display Text in Mode 12h

Post by ASHLEY4 »

Why not use 50x80 text mode, you can still add logo and things, much easier than mode 12h for text.
http://myfilebucket.com/u/ASHLEY40/dir.PNG
Or if you want better graphics, why not do 32bpp, just as easy as mode 12h and easily fits in the boot sector ;-).
http://myfilebucket.com/u/ASHLEY40/ASHLEY4.jpg

\\\\||////
(@@)
ASHLEY4.

Batteries not included, Some assembly required.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Display Text in Mode 12h

Post by Pype.Clicker »

XStream wrote: Yeah, I was aware that you need fonts however this mode is listed as being text and graphics so I thought there may have been a way to have it draw the font for you.
There is: BIOS interrupt ... But i guess you'll not find it really useful since once in pmode, you cannot call it.
Anyway, that is no big deal, so can anyone tell me where in memory I can find the standard font that is used in normal text modes, I would really like to avoid adding 4KB to my file just to have a font defined, especially at boot time when loading should be as quick as possible. I assume the font would be in the BIOS data area but how can I find it?
Iirc, it is on the second bitplane in textmode. I dunno for that specific graphic mode and i don't think it will be at the same place between 2 different bios'es.

So what i'd suggest if you wish a font for free is that you switch to the fonts bitplane while in text mode and copy font data in some other area you'll use afterwards.
Post Reply