Mail Archives: djgpp/1998/07/26/05:08:43
On 24 Jul 1998, ALMICHVL wrote:
> MOST OF THE CODE WORKS ITS JUST THE PART WHERE THE FP_SEG COMES IN. IF THERES
> ANYBODY THAT CAN HELP ME OUT WITH THIS PIECE OF IT I WOULD APPRECIATE IT
Please read Chapter 18 of the DJGPP FAQ list. It explains how to do
many of the things this code tries (and fails) to do.
> OldMode = _farpeekb(0x0040, 0x0049); // save user's video mode first
This won't work. _farpeekb needs to be called with _dos_ds as its
first argument, and 16*segment+offset (i.e. 0x449) as its second. See
section 18.4 in the FAQ.
> UserFont = MK_FP(peek(0x0000,0x010e), peek(0x0000,0x010c));
>
> // install our font
> poke(0x0000, 0x010e, FP_SEG(font));
> poke(0x0000, 0x010c, FP_OFF(font));
> }
> // OLDFONT //
> // ReInstalls user's original font pointer void OldFont()
> {
> poke(0x0000, 0x010e, FP_SEG(UserFont));
> poke(0x0000, 0x010c, FP_OFF(UserFont));
> }
There are two problems here: First, you need to convert the calls to
peek and poke to call _farpeekw instead, and use _dos_ds in them like
explained above (and in the FAQ).
And second, to install the font, you need first to copy it to a buffer
in conventional memory, below 1MB mark, because real-mode BIOS cannot
access addresses above 1MB where your DJGPP program lives.
So you will need to use `__dpmi_allocate_dos_memory' function to
allocate a buffer in conventional memory; then call `dosmemput' to
copy the font you read from a file into that buffer; then poke the
BIOS data area with the segment and offset of that buffer. And *then*
it will work.
- Raw text -