Page 1 of 1

Display Text in Mode 12h

Posted: Sun Jan 30, 2005 4:46 am
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.

Re:Display Text in Mode 12h

Posted: Sun Jan 30, 2005 11:29 am
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.

Re:Display Text in Mode 12h

Posted: Sun Jan 30, 2005 12:05 pm
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 :)

Re:Display Text in Mode 12h

Posted: Sun Jan 30, 2005 12:17 pm
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);

Re:Display Text in Mode 12h

Posted: Sun Jan 30, 2005 5:12 pm
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.

Re:Display Text in Mode 12h

Posted: Sun Jan 30, 2005 6:54 pm
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.

Re:Display Text in Mode 12h

Posted: Mon Jan 31, 2005 2:42 am
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.