Mail Archives: djgpp/1997/02/22/04:21:54
John Eccleston (johne AT parallax DOT co DOT uk) wrote:
: Hi All,
: I am trying to get the bios font data so that I can write text to my
: double buffer. I have written a little piece of inline ASM to call
: int 10 function 11 to get the address of the font data but when I run
: the program, even though it works the data it brings back is not as
: expected.
: When I try using the data obtained the characters are all gibberish.
: On my PC even an 8x8 character set reports that it is stored as
: 16 bytes per character, and for font heights of 8, 14 and 16 they are
: all stored at the same address.
<SNIP>
The code below is from one of my programs. It makes a copy of the
character set in order to redefine it. For some reason the copy does not
look exactly like the original, but it's usable.
--- CUT HERE ---
void set_up_graphical_pointer() {
__dpmi_regs dpmiregs;
unsigned int orig_font_address;
/* Duplicate the default font for the graphical mouse pointer. In text mode,
all font definitions are 8 columns, and the 9th column behaves in a
rather odd way. For most characters, the 9th column appears as blank, but
for characters C0-DF the video adapter makes the 9th column a copy of the
8th column, to allow for continuous horizontal lines. */
font_segment_info.size = ((256 * 16) + 15) / 16;
// 256 chars, 16 bytes each
if (_go32_dpmi_allocate_dos_memory(&font_segment_info)) {
printf("Couldn't allocate conventional memory for font duplication.\n");
exit(EXIT_FAILURE);
}
copied_font_address = font_segment_info.rm_segment << 4;
dpmiregs.x.ax = 0x1130; // Get font pointer.
dpmiregs.h.bh = 0x6; // 8x16 font.
__dpmi_int(VIDEO_INTERRUPT, &dpmiregs);
orig_font_address = ((dpmiregs.x.es & 0xFFFF) << 4)
+ (dpmiregs.x.bp & 0xFFFF);
movedata(_dos_ds, orig_font_address, _dos_ds, copied_font_address,
256 * 16);
dpmiregs.x.ax = 0x1100; // Load user font patterns.
dpmiregs.x.bx = 0x1000; // 16 bytes per character.
dpmiregs.x.cx = 256; // Load 256 characters.
dpmiregs.x.dx = 0; // Load at character offset 0.
dpmiregs.x.es = copied_font_address >> 4; // Segment of font patterns.
dpmiregs.x.bp = 0; // Offset of font patterns.
__dpmi_int(VIDEO_INTERRUPT, &dpmiregs);
}
- Raw text -