Mail Archives: djgpp/1997/11/09/22:28:10
At 08:37 11/9/1997 -0200, Antonio Dias wrote:
>Hello all,
>
>I'm trying to redefine characters using DJGPP. For this I'm using the
>code snippet below without success. What is wrong here?
[deleted]
>void main(void)
>{
> union REGS pregs;
> struct SREGS sregs;
> void far *mptr = OurFont;
> pregs.x.ax = 0x1100;
> pregs.x.dx = 0x41; /* 65 'A' */
> pregs.x.cx = 0x02; /* two char's to change */
> pregs.h.bh = 0x0E;
> pregs.x.bp = FP_OFF(mptr);
> sregs.es = FP_SEG(mptr);
> int86x(0x10, &pregs, &pregs, &sregs);
>}
This is quite obviously written for real mode and won't work with DJGPP
without significant modification. Since INT 10h/AX=1100h isn't a supported
function for int86x to handle automagically, you'll have to move your data
into conventional memory manually and use __dpmi_int to issue the interrupt.
Here's an example:
#include <dpmi.h>
#include <sys/movedata.h>
#include <go32.h>
void putfont(void)
{
__dpmi_regs r;
/* This assumes that sizeof(OurFont) is the amount of data to move,
and that it fits in the transfer buffer (normally 16K but
can become as small as 2K) */
dosmemput(OurFont, sizeof(OurFont), __tb);
r.x.ax = 0x1100;
/* Set the other registers... */
r.x.bp = (__tb & 0x0f); /* low 4 bits of transfer buffer address = ofs.*/
r.x.es = ((__tb >> 4) & 0xffff); /* high 16 bits of address = seg. */
__dpmi_int(0x10,&r);
}
See the documentation for `dosmemput()', `__dpmi_int()' and FAQ section 18.2
for more information.
(Also, you should change "void main(void)" to "int main(void)" and add a
"return 0;" since this is required by the ANSI standard and a good idea anyway.)
Nate Eldredge
eldredge AT ap DOT net
- Raw text -