China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-31 21:56
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » How to call a function in the main program that triggered the interrupt in a DOS interrupt resident program? View 1,704 Replies 1
Original Poster Posted 2010-07-06 10:51 ·  中国 北京 海淀区 联通
新手上路
Credits 19
Posts 6
Joined 2007-03-13 07:11
19-year member
UID 81575
Gender Male
Status Offline
Dear experts:

I wrote two programs:
1. A DOS program developed with Borland C++ 3.1
2. A terminating and staying resident (TSR) program. The development environment is the same.

In my program 1, I called the TSR, for example, interrupt number 1f.

Now the problem is: In the interrupt, I want to use a certain function in program 1, such as foo1(int arg1, int arg2, char **arg3). I don't want to directly write this function into the interrupt (this function triggers some other interrupts). I want to be able to call this function in program 1 when the interrupt is executed.

I don't have many ideas. Please give me some pointers, great experts.
Floor 2 Posted 2010-07-06 19:16 ·  中国 福建 厦门 电信
高级用户
★★★
Credits 741
Posts 366
Joined 2007-07-25 19:11
19-year member
UID 94024
Gender Male
Status Offline
Interrupt programs are at risk of reentrancy not only when directly using I/O and BIOS interrupt calls but also when making DOS calls.更何况calling user programs! If you want the interrupt service program to "communicate" with the user program, use register passing. If you think this function must be used, it's better to put it inside the interrupt rather than having the interrupt call the client program.

If you like to call user programs in an interrupt, you should use Windows, because Windows is designed that way, but its interrupt programs won't let you change them casually.

[ Last edited by netwinxp on 2010-7-6 at 19:22 ]
Forum Jump: