Thread: Interrupt Handling

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    5

    Interrupt Handling

    Hi,
    I want to know how to interface with DOS/BIOS interrupts
    e.g. INT10H,INT21H in VC++6.0 .
    In older Borland compiler(v2.01) I know how to interface with
    DOS/BIOS interrupts.e.g. following code was used:
    #include<dos.h>
    main()
    {int ascii,scan;
    union REGS i,o; /*i and o represent unions of type REGS*/
    while(!kbhit());
    i.h.ah=(some int value) /*to give input value*/
    int86(22,&i,&o); /*fn int86 invokes interrupt 22*/
    ascii=o.h.al; /*to get ascii value of key hited*/
    scan=o.h.ah; /*to get scan value*/
    }
    Now same doesn't work in microsoft vc++6.0 or in
    Borland command line 5.5 compiler.Because it doesn't
    recognises REGS unoin.Also when I checked dos.h header file
    I didn't found any REGS whereas in dos.h header file of Borland
    2.01 compiler I found union REGS.
    Can anyone tell what is correct code to interface with DOS/BIOS
    routines in microsoft vc++6.0/borland5.5.Also do I need another
    header file with dos.h. Please clarify.
    Manmohan Singh.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Can anyone tell what is correct code to interface with DOS/BIOS routines in microsoft vc++6.0/borland5.5.
    If you're using those two compilers then you aren't running DOS. You're running Windows in 32-bit protected mode with the command prompt that looks a bit like DOS. Chances are very good that you won't be able to compile and run a program designed for true DOS in Windows.
    My best code is written with the delete key.

  3. #3
    Quote Originally Posted by manmohan
    Hi,
    I want to know how to interface with DOS/BIOS interrupts
    e.g. INT10H,INT21H in VC++6.0 .
    You can't do that in Win 32. (Note that it's not a C-question)

    The stategy is completely different. You should learn more about the difference between the real mode and the protected mode on Wintel platforms.
    Emmanuel Delahaye

    "C is a sharp tool"

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Actually you can still do that even in XP. I've been messing around with the emulator and it seems like DOS is in there. Although there are several problems - namely it is slower than DOS really was...if you can believe that.

    But so far all interrupts have worked. Check into getting DJGPP from www.delorie.com, but all of the Turbo C++ versions thus far also have worked. I have not tried BC45 and I'm quite sure it does not work since it's startup.asm code relied on being in a DOS environment.

    As well Visual Basic for DOS and QBasic 7.1 and 4.5 also work inside of command under XP. So I take back some of the things I once said about the XP emulator. I truly think now that most of DOS is there and most things will still work in it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. event handling is serialized in MS Visual Studio C++ 2005 ??
    By mynickmynick in forum Windows Programming
    Replies: 3
    Last Post: 08-07-2008, 04:47 AM
  2. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 04:59 PM
  3. Interrupt handling in VC++(Windows)
    By ashu12 in forum Windows Programming
    Replies: 6
    Last Post: 12-17-2002, 05:57 AM
  4. Interrupt handling
    By Crash T in forum Linux Programming
    Replies: 5
    Last Post: 07-26-2002, 06:02 AM