Click to See Complete Forum and Search --> : need conversion code form dos to C++


sam_sun_401
June 19th, 2002, 05:11 AM
hi everyone. I have a code in dos which is running perfectly. when i tried the same in C++ i am not getting the correct result.
i am giving my dos code here if any one can help in converting this from DOS to C++ i am very thankful

I am attching a zip file in which the DOS C file and related files are there.

sjeng
June 19th, 2002, 05:17 AM
Haya,

I had a quick view and I was wondering... are you trying to port a program that is accessing hardware to windows nt/2000/xp, because then you have to use the api to acces the hardware.

grtnx,

Sjeng

Paul McKenzie
June 19th, 2002, 03:13 PM
Originally posted by sam_sun_401
hi everyone. I have a code in dos which is running perfectly. when i tried the same in C++ i am not getting the correct result.
i am giving my dos code here if any one can help in converting this from DOS to C++ i am very thankful

I am attching a zip file in which the DOS C file and related files are there. There is no such thing as translating from DOS to C++. DOS is an operating system, C++ is a programming language.

If what you mean is that you wrote a program in C++ for the DOS operating system and now you want to compile and run the same program for some other operating system, then you are making sense. If this is what you mean, the code that you provided is making direct calls to the hardware. Once you do this, all bets are off as to how another operating system handles these things. For a 32-bit OS, you have to resort to other ways to read or write to hardware. This takes research on your end, since each OS does things differently. For Windows, there is DeviceIOControl, for Linux it is something else.

But in general, once you start to use BIOS or interrupts (as your program does), it it will more than likely *not* work on another OS, and in all likelihood, crash.

Regards,

Paul McKenzie

cup
June 26th, 2002, 08:30 AM
I wonder how your program actually works. It must be writing all over memory. Anyway the bug:

GetExactMatrix requires a 2D int array but in ReadDataBuffers, you are passing it a pointer to the 2D array. This is probably what is causing the crash.

Also the memmoves are specific to 16-bit integers. If it is rebuilt in 32-bits, only half the data will be copied. Might be better if you used sizeof(lo[0]) instead of 500. Then it will work even in 64-bits.

Anyway, correcting the bits (removal of huge, _far, graph.h and bios.h, adding forward decls) and rebuilding it on 32-bits I get

error3 -6