interrupt within interrupt

Posted on 1998-10-30
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 50 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

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Which version of C should I use when Perl is too slow? 13 187
Passing command line arguments in C 10 100
outlook office 365 8 159
Adjust the codes 3 37
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

730 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