www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/07/22/19:11:51

From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <199807222311.BAA04139@father.ludd.luth.se>
Subject: Re: info core dumps
To: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii)
Date: Thu, 23 Jul 1998 01:11:35 +0200 (MET DST)
Cc: djgpp-workers AT delorie DOT com (DJGPP-WORKERS)
In-Reply-To: <Pine.SUN.3.91.980720112458.3059K-100000@is> from Eli Zaretskii at "Jul 20, 98 11:25:23 am"
MIME-Version: 1.0

According to Eli Zaretskii:
> 
> On Sun, 19 Jul 1998, Nate Eldredge wrote:
> 
> > Looks like there's an XMS call, and also perhaps a BIOS call.  The BIOS
> > is INT 15h/AX=2401h, and XMS seems to be a far call with AH=03h or 05h
> > (not sure which one is appropriate).  See the INTLIST.
> 
> Martin, could you please see whether these eliminate the crashes in
> _set_screen_lines?

Ok. Here's the votes in the European Song Contest from Sweden:
BIOS zero points, <French> BIOS zero points <End French>.
XMS zero points, <French> XMS zero points <End French>.

Seriously, thanks to Nate for the description how to test the XMS variation.
But that one didn't stop the test program from crashing, either.

Here the output from the test program included last (it the same whether I
use 0x03 or 0x05 in the XMS call):

es:bx = 0x25d:0xce.
ax = 0x1, bl = 0x0.
es = 0xffff; bp = 0xbf32; font_seg = 0x17b2; src = 0x10bf22; dest = 0x17b20.
Exiting due to signal SIGSEGV
Page fault at eip=0000167b, error=0004
eax=0010bf22 ebx=00017b21 ecx=00000000 edx=00000000 esi=0010bf23 edi=00000000
ebp=0008d658 esp=0008d5f0 program=D:\COMPILIN\HMM\C3.EXE
cs: sel=00f7  base=102e0000  limit=0009ffff
ds: sel=00ff  base=102e0000  limit=0009ffff
es: sel=00ff  base=102e0000  limit=0009ffff
fs: sel=010f  base=00000000  limit=0010ffff
gs: sel=010f  base=00000000  limit=0010ffff
ss: sel=00ff  base=102e0000  limit=0009ffff
App stack: [0008d6cc..0000d6cc]  Exceptn stack: [0000d5b4..0000b674]

Call frame traceback EIPs:
  0x0000167b   _maybe_create_8x10_font+191, line 63 of c3.c
  0x00001790   _main+172, line 98 of c3.c
  0x00001d82   ___crt1_startup+174


The ax == 0x1 above indicate success from the call to XMS, which should mean
that A20 is successfully enabled. And as it's still crashing something is
amiss somewhere.


Silence,

							MartinS

The test program:
#include <errno.h>
#include <dpmi.h>
#include <go32.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/farptr.h>

/* Stretch a 8x8 font to the 8x10 character box.  This is required to
   use 80x40 mode on a VGA or 80x35 mode on an EGA, because the character
   box is 10 lines high, and the ROM BIOS doesn't have an appropriate font.
   So we create one from the 8x8 font by adding an extra blank line
   from each side.  */
static int font_seg = -1;

static void
maybe_create_8x10_font(void)
{
  unsigned char *p;
  unsigned long src, dest, i, j;

  if (font_seg == -1)
    {
      __dpmi_regs regs;
      int buf_pm_sel;

      /* Allocate buffer in conventional memory. */
      font_seg = __dpmi_allocate_dos_memory(160, &buf_pm_sel);

      if (font_seg == -1)
        return;

      /* Get the pointer to the 8x8 font table.  */
      p = (unsigned char *)malloc(2560); /* 256 chars X 8x10 pixels */
      if (p == (unsigned char *)0)
        {
          errno = ENOMEM;
          __dpmi_free_dos_memory(buf_pm_sel);
          font_seg = -1;
          return;
        }
      regs.h.bh = 3;
      regs.x.ax = 0x1130;
      __dpmi_int(0x10, &regs);
      src =  ( ( (unsigned)regs.x.es ) << 4 ) + regs.x.bp;
      dest = ( (unsigned)font_seg ) << 4;
      fprintf(stderr, "es = 0x%x; bp = 0x%x; font_seg = 0x%x; src = 0x%lx; dest
= 0x%lx.\n", regs.x.es, regs.x.bp, font_seg, src, dest);

      /* Now copy the font to our table, stretching it to 8x10. */
      _farsetsel(_dos_ds);
      for (i = 0; i < 256; i++)
        {
          /* Fill first extra scan line with zeroes. */
          _farnspokeb(dest++, 0);

          for (j = 0; j < 8; j++)
            {
              unsigned char val = _farnspeekb(src++);

              _farnspokeb(dest++, val);
            }

          /* Fill last extra scan line with zeroes. */
          _farnspokeb(dest++, 0);
        }
    }
}

int main()
{
  __dpmi_regs regs;

  regs.x.ax = 0x4310;
  if(__dpmi_int(0x2f, &regs) < 0)
  {
    fprintf(stderr, "__dpmi_int failed.\n");
  }
  fprintf(stderr, "es:bx = 0x%x:0x%x.\n", regs.x.es, regs.x.bx);

  regs.x.cs = regs.x.es;
  regs.x.ip = regs.x.bx;
  regs.h.ah = 0x05; /* 0x03 or 0x05 */
  regs.x.ss = 0;
  regs.x.sp = 0;
  regs.x.flags = 0;
  if(__dpmi_simulate_real_mode_procedure_retf(&regs) < 0)
  {
    fprintf(stderr, "__dpmi_int failed.\n");
  }
  fprintf(stderr, "ax = 0x%x, bl = 0x%x.\n", regs.x.ax, regs.h.bl);

  maybe_create_8x10_font();
  return(0);
}

- Raw text -


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