On 05/21/2015 10:04 AM, David Griffith wrote:
> I guess my next step is to bring one of my older machines home, clean it
> up, install FreeDOS, and get to work with Turbo C++'s debugger.

You could also try running it on Linux through valgrind, it's usually 
pretty decent when it comes to finding bad memory operations.

> Can anyone offer any explanation why a program would run fine in DOSbox
> and crash on real hardware?

I had a very similar problem two or three times in the past with my own 
programs. In my case, it was always related to illegal memory 
operations, like allocating an array of 10 bytes, and writing 11 bytes 
to it, or freeing a memory area and then writing garbage to it after 
some time.

Depending on where the trashed memory area is located, it might pass 
without crashing anything, but this will be different on every platform 
and compiler.

You might also want to review carefully your usage of int variables, 
that's one of the classics. Under real mode DOS, these will be 16 bit 
long, so they will wrap much sooner than you might expect, and 
potentially lead to the same problem as I described above, if you decide 
to write to array[z] where z is a signed int that you have set to, say, 
32800. A pretty easy test could be to replace all occurrences of "int" 
by "long", and see if the problem happens again.

Mateusz


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to