OSDev.org

The Place to Start for Operating System Developers
It is currently Sun May 16, 2021 5:58 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Extracting font from BIOS?
PostPosted: Thu May 05, 2011 6:28 am 
Offline

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


Top
 Profile  
 
 Post subject: Re: Extracting font from BIOS?
PostPosted: Thu May 05, 2011 6:37 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9291
Location: On the balcony, where I can actually keep 1½m distance
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 ]


Top
 Profile  
 
 Post subject: Re: Extracting font from BIOS?
PostPosted: Thu May 05, 2011 6:51 am 
Offline

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


Top
 Profile  
 
 Post subject: Re: Extracting font from BIOS?
PostPosted: Thu May 05, 2011 7:03 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9291
Location: On the balcony, where I can actually keep 1½m distance
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 ]


Top
 Profile  
 
 Post subject: Re: Extracting font from BIOS?
PostPosted: Thu May 05, 2011 12:07 pm 
Offline
Member
Member
User avatar

Joined: Tue Feb 08, 2011 1:58 pm
Posts: 496
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:
      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


Top
 Profile  
 
 Post subject: Re: Extracting font from BIOS?
PostPosted: Fri May 06, 2011 4:52 am 
Offline

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


Top
 Profile  
 
 Post subject: Re: Extracting font from BIOS?
PostPosted: Fri May 06, 2011 5:28 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9291
Location: On the balcony, where I can actually keep 1½m distance
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 ]


Top
 Profile  
 
 Post subject: Re: Extracting font from BIOS?
PostPosted: Fri May 06, 2011 5:32 am 
Offline

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


Top
 Profile  
 
 Post subject: Re: Extracting font from BIOS?
PostPosted: Fri May 06, 2011 5:49 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 18, 2006 3:45 am
Posts: 9291
Location: On the balcony, where I can actually keep 1½m distance
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 ]


Top
 Profile  
 
 Post subject: Re: Extracting font from BIOS?
PostPosted: Fri May 06, 2011 5:58 am 
Offline

Joined: Tue Jan 26, 2010 4:46 pm
Posts: 8
That's really cool - thanks :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group