Solved

Fatal exception when calling interrupts using inline assembler.

Posted on 1998-06-22
13
265 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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. …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

615 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