From: Myknees AT aol DOT com Message-ID: 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 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit Precedence: bulk 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 #include 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); }