[MSVC++]Inline Assembly

Discussion in 'C++' started by Galbu, Aug 28, 2005.

  1. Galbu

    Galbu Guest

    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
     
    Galbu, Aug 28, 2005
    #1
    1. Advertising

  2. "Galbu" <> wrote in message
    news:...
    > 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
     
    Bryan Parkoff, Aug 29, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Abhi
    Replies:
    2
    Views:
    742
    E. Robert Tisdale
    Jul 3, 2003
  2. Alvin
    Replies:
    7
    Views:
    480
    E. Robert Tisdale
    May 6, 2005
  3. Replies:
    3
    Views:
    460
  4. Alf P. Steinbach
    Replies:
    7
    Views:
    610
    Paul Bibbings
    May 4, 2010
  5. Öö Tiib
    Replies:
    0
    Views:
    656
    Öö Tiib
    May 4, 2010
Loading...

Share This Page