Extracting font from BIOS?

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
charliesome
Posts: 8
Joined: Tue Jan 26, 2010 4:46 pm

Extracting font from BIOS?

Post by charliesome »

Is there any way to reliably read the BIOSes 8x8 font set?

I've looked into various mechanisms including interrupt vector 0x1F which is mentioned on RBIL, but I've had no luck.

Anybody know anything about this?
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: Extracting font from BIOS?

Post by Combuster »

The regular methods to do so are VGA-specific. You can probably use int 0x43 as it should point straight to the font.

For a portable solution: just get it from somewhere, then bundle it with your OS. The VGA font is void of copyright so nothing is preventing you from doing so. A shameless plug might help you even further.
"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 ]
charliesome
Posts: 8
Joined: Tue Jan 26, 2010 4:46 pm

Re: Extracting font from BIOS?

Post by charliesome »

Thanks for the int 0x43, looks like it's what I'm after.

Bundling the font isn't an option though, I need my code to fit in the bootsector so I need to try to conserve my bytes.
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: Extracting font from BIOS?

Post by Combuster »

In that case, why don't you use int 10 to have the video bios print the text for you instead of having to add custom code for it?
"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
turdus
Member
Member
Posts: 496
Joined: Tue Feb 08, 2011 1:58 pm

Re: Extracting font from BIOS?

Post by turdus »

The answer to your question is Int 10/AX=1130h/BH=6 (use RBIL for details). Will return a pointer to font bitmap in es:bp.
I use this code (query pointer and copy font from vga memory to a well known location):

Code: Select all

		mov			ax, 1130h
		mov			bh, 6
		int			10h
		push			es
		pop			ds
		xor			ax, ax
		mov			es, ax
		mov			si, bp
		mov			di, charmap
		mov			cx, 400h
		repnz			movsd
...
charmap: db			4096 dup 0
charliesome
Posts: 8
Joined: Tue Jan 26, 2010 4:46 pm

Re: Extracting font from BIOS?

Post by charliesome »

Combuster wrote:In that case, why don't you use int 10 to have the video bios print the text for you instead of having to add custom code for it?
I'm going to be running in graphics mode
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: Extracting font from BIOS?

Post by Combuster »

charliesome wrote:
Combuster wrote:In that case, why don't you use int 10 to have the video bios print the text for you instead of having to add custom code for it?
I'm going to be running in graphics mode
For what reason do you believe that to be relevant?
"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 ]
charliesome
Posts: 8
Joined: Tue Jan 26, 2010 4:46 pm

Re: Extracting font from BIOS?

Post by charliesome »

Combuster wrote:
charliesome wrote:
Combuster wrote:In that case, why don't you use int 10 to have the video bios print the text for you instead of having to add custom code for it?
I'm going to be running in graphics mode
For what reason do you believe that to be relevant?
Does the BIOS provide facilities for printing in graphics mode?
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: Extracting font from BIOS?

Post by Combuster »

VGADoc wrote:----------1009-------------------------------
INT 10 - VIDEO - WRITE CHARACTER AND ATTRIBUTE AT CURSOR POSITION
AH = 09h
AL = character to display
BH = page number (00h to number of pages - 1) (see AH=00h)
BL = attribute (text mode) or color (graphics mode)
if bit 7 set in graphics mode, character is xor'ed onto screen
CX = number of times to write character
Notes: all characters are displayed, including CR, LF, and BS
replication count in CX may produce an unpredictable result in graphics
modes if it is greater than the number of positions remaining in the
current row
I would deeplink Ralph Brown for the whole set, but it's down ATM :(


Edit: Alternative source - You may also want to bookmark the entire set.
"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 ]
charliesome
Posts: 8
Joined: Tue Jan 26, 2010 4:46 pm

Re: Extracting font from BIOS?

Post by charliesome »

That's really cool - thanks :)
Post Reply