NTDVM CPU has encountered an illegal instruction - please help.

Hello all,

Using Borland C++ 4.52 on a Windows Virtual PC in XP Mode.

I am writing what I thought to be a pretty simple DOS program.  It is basically opening files, filling up structures, printing structure information to a file and that's it.  The files are binary and are less than 32 Kbytes, most are 1K or less.   I am 75% of the way done, it has been running fine up to now.  I just added some code to finish it off, and now I am getting this error at runtime:

"The NTDVM CPU has encountered an illegal instruction.
CS:00cc IP:0106 OP:ff ff 00 00 00 Choose 'Close' to terminate the application."

The thing is, the code I added is just a repeat of the same code that was at the beginning but to different structures.  Seems to have something to do with the code size?  I don't know.  I am not that familiar with memory management.  However, when I removed the stuff I had added, it works again.  

I am attaching both the main code and the extra code I am trying to add.

I would appreciate any guidance.
Elena QuinnAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Elena QuinnAuthor Commented:
Some additional information - I put in some printfs to figure out where the failure is happening.  Its happening in printalltst, which is called prior to the additional lines I added.  This is why I think it has something to do with the size.
David Johnson, CD, MVPOwnerCommented:
from what I can remember as I haven't used Borland products in a LOOONG time..
What size are you compiling it to?  tiny, small, large ??
Elena QuinnAuthor Commented:
Borland C++ 4.52 is from 1995 and the first Borland c++ compiler that supported win95. but windows 95 has a preemptive multi-tasking and not all instructions still are supported by newer windows version including windows xp. windows xp was based on winnt and they replaced nearly all kernel DOS functions by new kernel functions.

there is no advantage to using such an old compiler beside you really would need to develop a dos program. if that is really your goal, you should create a VM with win95 or win98 and use Visual C++ 1.52 (IDE + compiler) which was the last visual c++ compiler that could create dos applications by using a DOS extender.

if you only want to create a console program that runs in a windows console (dos box), you could use the newest c++ compilers. for example you could download visual studio 2017 community which is free and create a new project for a win32 console application.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Elena QuinnAuthor Commented:
Actually never figured this out, but don't need it anymore.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.