[MSVC++]Inline Assembly

G

Galbu

Hi All, please could you look at this code?
int main()
{
__asm
{
mov ah,01h
int 21h
}
return 0;
}
I've compiled it in msvc++; when I execute the program I get this
error:"Unhandled Exception".
The error is about the interrupt 'cos If I leave "int 21h", I won't
have the error anymore.
Does this mean I can't use the interrupts in the inline assembly?
Thanks
 
B

Bryan Parkoff

Galbu said:
Hi All, please could you look at this code?
int main()
{
__asm
{
mov ah,01h
int 21h
}
return 0;
}
I've compiled it in msvc++; when I execute the program I get this
error:"Unhandled Exception".
The error is about the interrupt 'cos If I leave "int 21h", I won't
have the error anymore.
Does this mean I can't use the interrupts in the inline assembly?
Thanks
You can use interrupts using inline assembly in C++ source code, but you
must use MS-DOS or Windows 98 because Windows 2000 and Windows XP use
protected mode to prevent someone from using interrupts unless they write
device drivers to access interrupts. You can't access interrupts directly
using assembly under NT core.

Bryan Parkoff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,477
Members
44,898
Latest member
BlairH7607

Latest Threads

Top