delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/01/13:22:30

Date: Sat, 1 Nov 1997 10:16:18 -0800 (PST)
Message-Id: <199711011816.KAA18614@adit.ap.net>
Mime-Version: 1.0
To: "Mahadevan R." <mdevan AT md2 DOT vsnl DOT net DOT in>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Int 0x10 and pointers

At 12:01  11/1/1997 +0530, Mahadevan R. wrote:
>Hi.
>
>Could anyone help me out with this:
>
>I'm trying to load an EGA/VGA text font using Int 0x10/AX=0x1110.
>However, this call requires a pointer to the font data in ES:BP.  The
>int86() fn. docs does not list this BIOS fn. as "supported", and I don't
>know how to do this with __dpmi_int() (not sure whether this is possible
>-- is it?).  What do I do now ?
Yes it is possible to do it with __dpmi_int(). The only catch is that you
have to manually put your data in conventional memory, but that's not too
hard. Here's an example (untested and rather verbose):

/* Note: calls to assert() should be replaced with real error checking */
#include <dpmi.h>
#include <sys/movedata.h>

void load_font(void *font_data, int size_of_data)
{
   __dpmi_regs r;
   int dos_mem_selector;
   int paragraphs = (size_of_data + 15) >> 4; /* 1 paragraph = 16 bytes */
   int dos_mem_segment;
   dos_mem_segment = __dpmi_allocate_dos_memory(paragraphs, &dos_mem_selector);
                     /* We need the selector to free it */
   assert(dos_mem_segment != -1);
   /* Move data to DOS memory */
   dosmemput(font_data, size_of_data, dos_mem_segment << 4);
   r.x.es = dos_mem_segment;
   r.x.bp = 0; /* it's at the bottom of the segment */
   r.x.ax = 0x1110;
   /* Load any other registers you need to */
   __dpmi_int(0x10, &r);
   /* Do error check */
   __dpmi_free_dos_memory(dos_mem_selector);
}
>
>Will it be better/faster to write to the VRAM directly ?
I don't know. You could try it both ways and find out.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019