Mail Archives: djgpp/1998/01/26/01:22:37
At 08:37 1/24/1998 -0700, David Whitlark wrote:
>how do I write a program to install a new font into the dos bios font, So
>that I change the default font of DOS?
This is a bit off-topic, but since you're here...
Snippet from Ralf Brown's Interrupt List:
INT 10 - VIDEO - TEXT-MODE CHARGEN - LOAD USER-SPECIFIED PATTERNS (PS,EGA,VGA)
AX = 1100h
ES:BP -> user table
CX = count of patterns to store
DX = character offset into map 2 block
BL = block to load in map 2
BH = number of bytes per character pattern
Return: nothing
Notes: This function will cause a mode set, completely resetting
the video environment, but without clearing the video buffer
the current block specifiers may be determined with INT 10/AH=1Bh,
looking at offsets 2Bh and 2Ch of the returned data (VGA only)
(see AH=1Bh,#0037)
SeeAlso: AX=1101h,AX=1102h,AX=1103h,AX=1104h,AX=1110h,AH=1Bh,AX=CD10h
Here's the code I would use. It assumes you are using an 8x16 font, which
normally you are.
#include <sys/movedata.h>
#include <dpmi.h>
#include <go32.h>
void set_font(void *font)
{
__dpmi_regs r;
/* Move font to transfer buffer */
dosmemput(font, 16 * 256, __tb & 0xfffff);
/* Set up registers */
r.x.ax = 0x1100;
r.x.es = (__tb >> 4) & 0xffff; /* segment part of transfer buffer address */
r.x.bp = __tb & 0xf;
r.x.cx = 256; /* Load all 256 characters... */
r.x.dx = 0; /* ... starting with the 0th */
r.h.bl = 0; /* block 0 */
r.h.bh = 16; /* an 8x16 font */
__dpmi_int(0x10, &r);
}
Note that this requires the transfer buffer to be at least 4K (it is
normally 16K but can be reduced with `stubedit' to as little as 2K).
The font is a bitmap of the font you want. 16 bytes per character,
characters in order.
Nate Eldredge
eldredge AT ap DOT net
- Raw text -