Solved

Fatal exception when calling interrupts using inline assembler.

Posted on 1998-06-22
13
261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Embarcadero C++ Builder XE2 TDateTime 8 90
Dynamically allocate memory 9 74
How to split this in C++ 4 127
Autosar OS Multicore Share Resources confusion ? 2 189
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

739 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