On Sun, 11 Aug 2002, Per Jessen wrote:

> On Sun, 04 Aug 2002 19:15:21 +0200, Per Jessen wrote:
> 
> >On Sun, 4 Aug 2002 16:35:56 +0100 (BST), Bart Oldeman wrote:
> >
> >>So it's easy to write your own exitemu if this actually works -- I'm not
> >>sure why not yet. It can just call int21/ah=4d to get the DOS return
> >>code. Maybe this should be an option, also using "exitemu 2" to exit
> >>with code 2.
> 
> I've been trying to get this to work for the last few days - no luck. 
> Whenever I call int21 ah=4D, I always get al=00 back. However, IF ERRORLEVEL
> works fine. As far as I can tell, the call is processed by DOS itself,
> ie. DOSEMU doesn't really touch it. 

That's right. The problem is that - see RBIL:
"the word in which DOS stores the return code is cleared after being
read by this function, so the return code can only be retrieved once"

so you can only get it this way if you execute the program directly
using int21/ah=4b (DOS EXEC). Command.com has already stolen it in your
situation.

Hmm, now that I check it, FreeDOS does not clear the return code. That
might have confused me.

> Even the simplest setup - a program that sets the rc, and one that calls
> int21,4d to retrieve it doesn't work. Does anyone know where ERRORLEVEL
> gets the information from ? 

int21/ah=4d ;)
 
> As far as I can tell, DOSEMU itself makes no use of int21,4d ? 

No. What DOSEMU could do is to intercept int21,4d and "peek" the code
from DOS memory, at the SDA (obtained via int21/5d06), location 14h.
SDA=DOS Swappable Data Area, basically the current state of DOS,
combined with all its "static" variables and internal stacks.
The "Undocumented DOS" books attempt to do multitasking with DOS by
swapping the SDA. Of course multitasking with DOSEMU is trivial and not
nearly as dangerous and full of potholes :)

The SDA is already used by the redirector code, so DOSEMU knows its
location.

Bart

-
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to