Page 1 of 1

Extracting font from BIOS?

Posted: Thu May 05, 2011 6:28 am
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?

Re: Extracting font from BIOS?

Posted: Thu May 05, 2011 6:37 am
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.

Re: Extracting font from BIOS?

Posted: Thu May 05, 2011 6:51 am
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.

Re: Extracting font from BIOS?

Posted: Thu May 05, 2011 7:03 am
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?

Re: Extracting font from BIOS?

Posted: Thu May 05, 2011 12:07 pm
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

Re: Extracting font from BIOS?

Posted: Fri May 06, 2011 4:52 am
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

Re: Extracting font from BIOS?

Posted: Fri May 06, 2011 5:28 am
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?

Re: Extracting font from BIOS?

Posted: Fri May 06, 2011 5:32 am
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?

Re: Extracting font from BIOS?

Posted: Fri May 06, 2011 5:49 am
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.

Re: Extracting font from BIOS?

Posted: Fri May 06, 2011 5:58 am
by charliesome
That's really cool - thanks :)