www.digitalmars.com         C & C++   DMDScript  

c++ - Problem with inline assembly interrupts

reply Nac <Nac_member pathlink.com> writes:
I'm trying to do some basic interrupts in my inline assembly, but when I run the
program it performs an illegal operation. The inline assembly works fine when I
don't use interrupts.

Here's the code I'm using:

#include <stdlib.h>
int main()
{ 
asm {
mov dl,30h
mov ah,06
int 21h
}
system("PAUSE");
return 0;
}


It should print '0' to the screen. I've also tried some examples from the
Digital Mars FAQs, and the ones without interrupts work fine, but the others
crash.

Thanks for help!
Apr 14 2006
parent reply Jan Knepper <jan smartsoft.us> writes:
Don't think you really can do that in Win32 code...
How did you target the code? DOS 16 bits?



Nac wrote:
 I'm trying to do some basic interrupts in my inline assembly, but when I run
the
 program it performs an illegal operation. The inline assembly works fine when I
 don't use interrupts.
 
 Here's the code I'm using:
 
 #include <stdlib.h>
 int main()
 { 
 asm {
 mov dl,30h
 mov ah,06
 int 21h
 }
 system("PAUSE");
 return 0;
 }
 
 
 It should print '0' to the screen. I've also tried some examples from the
 Digital Mars FAQs, and the ones without interrupts work fine, but the others
 crash.
 
 Thanks for help!
 
 

-- ManiaC++ Jan Knepper But as for me and my household, we shall use Mozilla... www.mozilla.org
Apr 14 2006
parent Nac <Nac_member pathlink.com> writes:
Yes, I was compiling for Win32...I fiddled with command line args to change it
to DOS16 mode and now it works fine. Thanks!


In article <e1o9lj$2fvc$1 digitaldaemon.com>, Jan Knepper says...
Don't think you really can do that in Win32 code...
How did you target the code? DOS 16 bits?




-- 
ManiaC++
Jan Knepper

But as for me and my household, we shall use Mozilla...
www.mozilla.org

Apr 14 2006