Solved

Fatal exception when calling interrupts using inline assembler.

Posted on 1998-06-22
13
248 Views
Last Modified: 2010-04-01
I am trying to call int 13h functions using the inline assembler with MS Visual C++ 4.  However, when I run a progam which calls the interrupt, it crashes, showing that infamous blue screen with a FATAL EXCEPTION 0D error message.

Take the following example.  I am calling the "GET STATUS OF LAST OPERATION" function.  My documentation states that AH should be loaded with 01h and DL with the drive number (01h for drive A).  So here goes...

void main()
{
      _asm
      {
            mov ah, 01h
            mov dl, 01h
            int 13h
      }
}

But when the code fragment is run, all I get is a fatal exception 0D.  What should I be doing to make it work and get rid of the fatal exception?  I've tried this technique out with several different interrupt calls, but still get the same problem.
0
Comment
Question by:Richard_Thompson
  • 7
  • 6
13 Comments
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 1166457
Are you doing this from a DOS program?  This will not work from a 32 bit console program.  This will only work from a 16 bit DOS program.  There are other ways to get this information from a 32 bit console program
0
 
LVL 11

Expert Comment

by:alexo
ID: 1166458
>> I am trying to call int 13h functions using the inline assembler with MS Visual C++ 4.
MSVC4 can only generate Win32 code.  Under the Win32 protection model, a client program is not allowed to call OS software interrupts directly.

In order to use INT 13h from your code you will have to delegate the task either to a VxD (VWIN32.VXD will do some of the work under Win95) or to a 16-bit DLL.  I think both options will fail under NT but then you can obtain a handle to the drive and call DeviceIoControl() to perform the functions you need.

Drop me a note if you need more help.
Meanwhile, search your online help for KB articles Q125712 and Q137176 or just do a global help search for "VWIN32"


0
 
LVL 22

Expert Comment

by:nietod
ID: 1166459
Alex, I believe that VC4 can produced DOS programs.  (5 definitly can't.)  That is why I wasn't 100% sure that was the problem.  

>> Drop me a note if you need more help.
What's wrong with this question?  
0
 
LVL 11

Expert Comment

by:alexo
ID: 1166460
>> Alex, I believe that VC4 can produce DOS programs.
Nope, it definitely cannot.  In order to compile DOS or Win16 apps one needs 1.52 or earlier.

>> What's wrong with this question?
Huh?
0
 
LVL 22

Expert Comment

by:nietod
ID: 1166461
1.52.  Wow that long ago.  I didn't realize.

The "drop me a note" sounds like an invitation for e-mail.  Maybe not?  If so,  I was wondering why?
0
 
LVL 11

Expert Comment

by:alexo
ID: 1166462
Richard, we're waiting for your input, comments, anything...

Todd,
>> The "drop me a note" sounds like an invitation for e-mail.

A note here, a note by email, it really does not matter since I take care to summarize here any solution that was negotiated via email while avoiding unnecessary clutter ("it doesn't work"; "here's a minor bugfix"; "it still doesn't work"; "here's another"; "thanx") and keeping the discussion free for alternative suggestions by others.

As your experience with John500 showed, this forum is highly suitable for exchanging abstract ideas and small code snippets, not for sharing longer sources.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 11

Expert Comment

by:alexo
ID: 1166463
Oh well, you win some, you lose some...
0
 
LVL 22

Expert Comment

by:nietod
ID: 1166464
>> you win some you lose some
what is that referring to?
0
 
LVL 11

Expert Comment

by:alexo
ID: 1166465
It was referring to the fact that R.T. solveed the problem using the KB articles mentioned in my comment followed by a brief exchange on the marvellous invention referred to above as "email" to solve a minor bug.

I usually add this comment when I think that my answer was superior (in content or details) to the accepted one.  It means roughly "at least I tried".
0
 
LVL 22

Expert Comment

by:nietod
ID: 1166466
That does seem a bit unfair then.  

But then again, I answered the question and was not made part of the resolution discussion, so It would not be fair for you to get the points either.  

I know what to do, we give the points to RONSLOW.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1166467
>> That does seem a bit unfair then.
Why?  Because a minor implementation bug was solved via email?
How would you classify your correspondence with John500 then?

>> I answered the question
I consider your answers most helpful and complete.  However, in this particular case, it was lacking.  Compare your answer to my comment from "June 23 1998 - 12:08AM PDT" then tell me I'm wrong.

>>  and was not made part of the resolution discussion
The email I got from RT said something like "Thank you for pointing me to the references.  But my code doesn't work." along with source.  The reply was "Use 0x100 instead of 0x1000".  Not much of a discussion, is it?

0
 
LVL 22

Expert Comment

by:nietod
ID: 1166468
Unfair that you didn't get the points since you solved it.  But I was also pointing out that I wasn't really given a chance to.   In the case of the john500 stuff, I solved it via e-mail (hundreds of them), but also answered it.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1166469
This is getting ridiculous.  Let's drop the subject, OK?
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now