Fonts in real mode? Is it possible?

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
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

Fonts in real mode? Is it possible?

Post by Bender »

Fonts?
Can I print text to screen by my custom font in real mode? I don't want to use that
ugly stupid BIOS-like-font, I like the Ubuntu-Terminal Font, Wanted to port it but I want to
access the BIOS calls along with the ubuntu font, (I am too lazy to implement drivers and stuff)
I know this is ridiculous but still I want to access BIOS calls in 2013. =D>
Alright(I think) since that 80x25 text mode doesn't support fonts I guess using INT 0x10 to
switch it to a different mode like :

Code: Select all

mov ah,0x9
int 0x10
But I have NO idea on how to use fonts?
Do I have to implement a special Video-Driver or BIOS Calls would be enough?
I read this post on the wiki but my head goes crazy :
http://wiki.osdev.org/VGA_Fonts
How do I use that? It says in:es:di, Isn't that a seg-reg? #-o
Can somebody explain me what does all that mean and how to use them, ? :wink:
And do I have to modify my print_string functions?
I am very sorry for asking this stupid question, but can someone explain me how to do that?, like what I need to first implement
BTW I am in 80x25 text mode, and my print_string uses the 0x10 Teletype Function (AH=0EH)
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: Fonts in real mode? Is it possible?

Post by zhiayang »

I'm no expert in this field, but IMO you have a few options:

1. Use a bitmap font (8x16 or what have you) and plot your pixels
2. Figure out the VGA font for 80x25 or whatever mode you're using (IIRC this is not impossible)

3. If you're looking at something like TrueType or some other non-bitmap font, you've first got to load the thing from disk (most likely). Then you'd have to write an actual renderer for the font, which is no easy feat. And it most likely cannot be done in real mode or ASM, unless you really know your magic (which, no offence, but judging by your signature isn't the case)

Of course i may be wrong, use this information at your own discretion.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Fonts in real mode? Is it possible?

Post by Love4Boobies »

You should first find out what the things you are talking about are. Real mode is an x86 CPU operating mode---it has nothing to do with graphics output whatsoever. That is handled by a separate piece of hardware.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
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: Fonts in real mode? Is it possible?

Post by Combuster »

If you can make it a fixed-width non-antialiased font of 8 pixels wide and 8/16 pixels high, you can load it into a VGA card and be done with it. You'll just bundle the bitmap with your OS.

Anything that needs fewer restrictions means a driver of at least some sort.
"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 ]
User avatar
VolTeK
Member
Member
Posts: 815
Joined: Sat Nov 15, 2008 2:37 pm
Location: The Fire Nation

Re: Fonts in real mode? Is it possible?

Post by VolTeK »

Love4Boobies wrote:You should first find out what the things you are talking about are.
Pathetic response, even you should know newbies assume this isn't possible in realmode.
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

Re: Fonts in real mode? Is it possible?

Post by Bender »

So you mean say this stuff is possible in text mode,
How do I use that BIOS Interrupt given on that wiki page? (Examples?)
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Fonts in real mode? Is it possible?

Post by Love4Boobies »

VolTeK wrote:
Love4Boobies wrote:You should first find out what the things you are talking about are.
Pathetic response, even you should know newbies assume this isn't possible in realmode.
So what in my answer (i.e., that the OP should read up on the things (s)he's mentioned) is made invalid by their ignorance? If anything, it makes my point stronger.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

Re: Fonts in real mode? Is it possible?

Post by Bender »

Wait!
When I enable Graphics Mode (AX=0x13)
I get some stupid weird screen, where in I could not even read things properly, I want to know HOW TO get a custom font in 80x25 REAL mode? Is that possible that's the question, (And yeah I am n00b at this... I am really sorry for my ignorance, I tried to look things up at the wiki, But I found about VGA Hardware and some tuts BUT they are all for PROTECTED mode, No real mode :cry: )
EDIT :
I switched to 640x480 Mode through :

Code: Select all

mov ax,0x12
xor bx,bx
int 0x10
mov ah,0x0B ;----This is for setting a Green-Backcolor!
mov bh,0x00
mov bl,0x58
int 0x10
and then I loled :
Image
Now what's the problem of switching to 640x480 mode (BTW I use AH=0EH for printing text)
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)
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: Fonts in real mode? Is it possible?

Post by Combuster »

But I found about VGA Hardware and some tuts BUT they are all for PROTECTED mode, No real mode
VGA Hardware? Nonsense. Learn about the real differences between real and protected mode first.
"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 ]
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Fonts in real mode? Is it possible?

Post by Love4Boobies »

As I've mentioned before, the CPU is not in charge of the machine's video capabilities---it doesn't even know such a thing exists. You are probably confusing the latter with BIOS service calls (e.g., INT 10h), which were designed for use with real mode.

The BIOS, however, does not offer font support---it merely provides a few routines useful for bootstrapping boot loaders on PC's that have BIOS firmware. I'm talking about things like loading the contents of disk sectors into memory, providing a memory map, changing the video mode, etc. Then, the kernel and drivers take over.

In a nutshell, protected mode offers protection, as far as other address spaces and I/O are concerned. This is a gross oversimplification but it should at least give you an idea of its purpose.

Now read up and be quiet.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Fonts in real mode? Is it possible?

Post by egos »

Video BIOS supports some font functions, but I never used them. I prefer to load font bitmaps directly (search for "font loading" on this forum for details).
If you have seen bad English in my words, tell me what's wrong, please.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: Fonts in real mode? Is it possible?

Post by Love4Boobies »

Well, for simplicity's sake, I didn't mention that. I considered the point that the CPU doesn't do video was more important.

The BIOS API was, in fact, not only designed for boot loaders but also DOS. It provides facilities like reading from and writing to serial and parallel ports, switching to protected mode, etc. However, they were never popular so no one cared about properly implementing then. Hence, they are unreliable (often buggy or missing altogether).
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
kutkloon7
Member
Member
Posts: 98
Joined: Fri Jan 04, 2013 6:56 pm

Re: Fonts in real mode? Is it possible?

Post by kutkloon7 »

I've seen some tutorials on it. That was years back when I just started programming in qbasic. Links are here(most tutorials listed there explain what you want).

I don't know how much of it is based on the OS and how much on the BIOS, didn't really look into it.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: Fonts in real mode? Is it possible?

Post by jal »

sid123 wrote:Can I print text to screen by my custom font in real mode?
Yes you can. For that, you need to switch to the preferred video mode (e.g. 80x25), then load the font you want. Examples can be found in the Wiki here.


JAL
Post Reply