interrupt within interrupt

Posted on 1998-10-30
Medium Priority
Last Modified: 2011-09-20
1. how do i issue an interrupt within an interrupt
2. i read omewhere it cant be done .if true why?
3. i tried changing registers directly(eg. _AX=0x3d;)
   and then calling the required interrupt function(eg.   (*int21)(); ) here int21 points to the 0x21 int. vector.
   but it didn't work possibly because the changed regidters   affect the rest of the program
4. if you advise me to copy back the reg. values please specify how?
Question by:the_shrink

Expert Comment

ID: 1253908
It is just not true that you can't call an interupt from another interupt. TSR's and interupt hooking modules hook interupts to call other interupts.

What experience do you have with Assembler? Setting AH=0x3D and calling INT 21 should open a file provided that you put the name of the file in DS:DX and the access type in AL.

Also, calling DOS functions from Windows can have spurious results. Windows emulates DOS and not all functionality is completely the same as if run in DOS alone.


Accepted Solution

bculver earned 100 total points
ID: 1253909
Technically issuing an interrupt from within an interrupt handler is just like calling a function from within another function, it can be done. The problems lie in the interrupt handlers themselfs. Int 0x21 is whats called non re-entrant. that is you can not make a  int 0x21 call while your in a  0x21 section of code. For example; if you wrote an interrupt handler, that say saves the ax register to a location, changes the ax reg value and  makes a call to itself, the original ax value will be lost. The same thing happens in a DOS 0x21 handler. But you say your not in an int 0x21 handler, so how can this be! Wrong! the operating system spends most of its life spinning around inside int 0x21 functions and like it or not 99 times outa 100 your interrupt handler was called while  in a  int 0x21 function. Luckily there are actually ways to tell this or TSR's would never have been invented. The problem is that there is no easy solution to what you are tring to do in the space available here. (There have been whole books written on this subject). A good place to start would to disect some TSR code and note the ways that they figure out if they came from within an int 0x21 function. Another is to get ahold of a book call "Undocumented DOS" (sorry don't remember the author) that will help you understand some of the undocumented functions called needed for TSR's to work correctly.

Author Comment

ID: 1253910
THanks to culver

Featured Post

The Lifecycle Approach to Managing Security Policy

Managing application connectivity and security policies can be achieved more effectively when following a framework that automates repeatable processes and ensures that the right activities are performed in the right order.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.

623 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