Solved

interrupt within interrupt

Posted on 1998-10-30
3
488 Views
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?
0
Comment
Question by:the_shrink
3 Comments
 
LVL 2

Expert Comment

by:kinkajou
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.


0
 
LVL 1

Accepted Solution

by:
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.
0
 

Author Comment

by:the_shrink
ID: 1253910
THanks to culver
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

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…
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 recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

707 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

13 Experts available now in Live!

Get 1:1 Help Now