delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/16/00:03:33

From: Myknees AT aol DOT com
Message-ID: <fa794f58.34e7c7f4@aol.com>
Date: Mon, 16 Feb 1998 00:00:33 EST
To: eliz AT is DOT elta DOT co DOT il
Cc: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: DOS mem command crashes after running prog

eliz AT is DOT elta DOT co DOT il (Eli Zaretskii) writes:
> On 15 Feb 1998, Myknees wrote:
> > After the program exits, if I type mem/c/p or even j
> > just mem, Windows shuts down
> > the DOS box and shows an error that says,
> > "This program has performed an illegal operation and w
> > will be terminated...
> > The program tried to execute an invalid instruction.  F
> > Fault location 0E2D:5C52 
> > Interrupts in service: None."
> 
> You might be screwing the DOS memory chain, or
> overwriting somebody's 
> PSP.
> 
> Try running your program in plain DOS under CWSDPMI, it
> might catch some 
> garbled pointer you dereference, before it actually does
> some harm.

In plain DOS with CWSDPMI, there is no such problem as I described before.

> If that doesn't help, you will have to selectively
> disable parts of your 
> program and zero in on the code that produces this
> atrocity.

That's what I wound up having to do.  Here is the remainder of the program
after whittling away everything that could be whittled without making the
crash go away.  

#include <stdio.h>
#include <allegro.h>

int main(int argc, char *argv[])
{
    allegro_init();
    install_keyboard(); 
    install_timer();

    /* install digital sound driver */
    /* Taking out this if block makes mem NOT crash. */
    if (install_sound(DIGI_AUTODETECT, MIDI_NONE, argv[0]) != 0) {
      printf("Error initialising sound system\n%s\n", allegro_error);
      exit(1);
    }
    
    printf("When you were young you were the king of carrot flowers.\n");
    
    exit(0);
}

- Raw text -


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