Page 1 of 1
Fonts in real mode? Is it possible?
Posted: Sun Sep 29, 2013 5:11 am
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.
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 :
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
di, Isn't that a seg-reg?
Can somebody explain me what does all that mean and how to use them, ?
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)
Re: Fonts in real mode? Is it possible?
Posted: Sun Sep 29, 2013 10:07 am
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.
Re: Fonts in real mode? Is it possible?
Posted: Sun Sep 29, 2013 11:26 am
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.
Re: Fonts in real mode? Is it possible?
Posted: Sun Sep 29, 2013 11:41 am
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.
Re: Fonts in real mode? Is it possible?
Posted: Sun Sep 29, 2013 12:05 pm
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.
Re: Fonts in real mode? Is it possible?
Posted: Sun Sep 29, 2013 7:00 pm
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?)
Re: Fonts in real mode? Is it possible?
Posted: Sun Sep 29, 2013 11:03 pm
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.
Re: Fonts in real mode? Is it possible?
Posted: Mon Sep 30, 2013 12:35 am
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
)
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 :
Now what's the problem of switching to 640x480 mode (BTW I use AH=0EH for printing text)
Re: Fonts in real mode? Is it possible?
Posted: Mon Sep 30, 2013 1:55 am
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.
Re: Fonts in real mode? Is it possible?
Posted: Mon Sep 30, 2013 2:31 am
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.
Re: Fonts in real mode? Is it possible?
Posted: Mon Sep 30, 2013 4:32 am
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).
Re: Fonts in real mode? Is it possible?
Posted: Mon Sep 30, 2013 5:02 am
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).
Re: Fonts in real mode? Is it possible?
Posted: Mon Sep 30, 2013 8:11 am
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.
Re: Fonts in real mode? Is it possible?
Posted: Tue Oct 01, 2013 9:53 am
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