[net.micro.pc] Question about DOS int 21

starr@shell.UUCP (Bob Starr) (12/20/83)

Is  there  something  which  prevents  DOS function 21 from being
called recursively?

For example, let's say function 21 calls function  A.  I  replace
function  A with my own routine. Within function A, I need to use
a facility in function 21, so I invoke it via  an  interrupt  21.
After  invoking function 21 from within function A, I am returned
to function A (as I should be). Function A cannot seem to perform
a proper return  back  to  function  21,  though  (where  it  was
originally called from).

Perhaps  I  am	doing  something  wrong,  as this problem is more
complicated than presented above (i.e. when interrupt 21  invokes
(my)  function A, and function A invokes int 21, int 21 reinvokes
function A... but I think I am protected against internal  (func-
tion A, specifically) recursion problems).

Can  anyone  help?  I  have been struggling with this for several
days. My routine A works peachy until I invoke int 21.


P.S.	  I am using DOS 2.0, but want this to work  under  lower
	  versions too. Please respond via mail.



Thanks,
RF Starr

jph@whuxle.UUCP (12/21/83)

#R:shell:-15400:whuxle:22700010:000:265
whuxle!jph    Dec 20 21:39:00 1983

INT 21H has its own local stack that is switched to when it
is called (since you never know how large the caller's stack
is). Therefore if you invoke INT 21H without first returning
(i.e., recursively) you mess up the internal stack and can
never return correctly.

seaburg@uiucdcs.UUCP (seaburg ) (01/09/84)

#R:shell:-15400:uiucdcs:24700038:000:113
uiucdcs!seaburg    Jan  8 21:21:00 1984

That's correct.  Can't do it without messing around with the stacks first.

Have fun trying to find them too!!