compile C code with in-line assmebly without errors and then execute it but the DOS shell crashes when it pops-up???
compile C code with in-line assmebly without errors and then execute it but the DOS shell crashes when it pops-up???
well this is it
is it wrong, because it compiles without a problem!Code:#include <stdio.h> void main() { char major,minor; _asm mov ah,30h _asm int 21h _asm mov major,al _asm mov minor,ah printf("This is DOS version %i, release %i\n",major,minor); }
Haha - C For Dummies...
It's correct, but it all has to do with MSVC stuff...try compiling it with something else (not DJGPP! They use AT&T Syntax! It's terrible!!)
Or you might want to try extended registers....
try tasm
??
Monday - what a way to spend a seventh of your life
tasm can't compile that...it has C in it. Plus, I think the point was to learn how to write INLINE asm oh well...I still say extended regs are the way to go.
> is it wrong, because it compiles without a problem!
Yes. VC compiles applications for Windows, and you've written a program that calls a DOS software interrupt. It's not DOS; how do you expect to read the DOS version?Code:#include <stdio.h> #include <windows.h> int main() { long version, major, minor; version = GetVersion(); // Get the Windows version. major = LOBYTE(LOWORD(version)); minor = HIBYTE(LOWORD(version)); printf("Windows version %d.%d\n", major, minor); return 0; }
Ess
Like a rat in a maze who says,
"Watch me choose my own direction"
Are you under the illusion
The path is winding your way? - Rush
Yup its from the extended Dummies book site thing!!!!
OK thank you for your input but i have fixed the asm problem (and other problems as well), F*** M$, i found Borland 3.1 and it works on it.... so life is good!