-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
int 24h handler (abort, retry, fail, ignore) #24
Comments
The critical error handler should temporarily set stdin and stdout to the stderr handle. Otherwise redirection may make it impossible to read or reply to the prompt. |
That's a good point, thanks for bringing it up! In fact, I did think about this issue at the very start and was going to use int 21/AH=3Fh and 40h calls to read/write directly to stderr, but then I noticed TechHelp does not list these calls as "safe" for the int 24h handler so I changed to the legacy calls and forgot about the redirection issue. Will look into that. |
hmm... for handling redirections I'd need to use int 21h,AH=46h - but this call also is not listed by TechHelp as safe for the int 24h handler :-/ RBIL provides a slightly different list, but still without any redirection functions. It says: "The only DOS calls the handler may make are INT 21/AH=01h-0Ch,30h,59h." Not sure what's the least worse approach here. |
I think you have to peek into your Process Handle Table. Stash away the original two handles and copy the stderr handle into both of them. Then restore the original handles again when you're done. |
Meaning I need to locate the original process' PSP (without asking DOS for it). Yet another challenge. :-) BTW Microsoft confirms the limited amount of functions usable from within int 24h handler: Also interesting to note that registers should be preserved when an error is to be ignored or retried. I should take care to restore all these registers. |
another option could be to use the BIOS for character input/output... might be actually both safer and easier. |
Function 51h and 62h both give the current PSP. Not sure why you want another one. |
Then say goodbye to using edlin over a serial line :D. Btw. do you plan to support the CTTY command? If that is the case it would not be good to use any BIOS routines for IO. |
While TechHelp lists these functions as safe from within the int 24h handler, RBIL does not... Which is the reason I'm slightly worried. ("The only DOS calls the handler may make are INT 21/AH=01h-0Ch,30h,59h.")
Not a huge fan of edlin ;-) but you are right that calling BIOS would not be a very elegant solution. Yes, CTTY is definitely a "nice to have" thing so I will probably implement it, eventually (#101). |
using int 62h from within the int 24h handler appears to work at least under EDR and FreeDOS, so it seems all good. |
Uhm, did you test this? Two problems here:
Moreover, you should use the PHT pointer in the PSP, not the hardcoded default PHT location. |
Other than that you can directly |
Yes I did! And, surprisingly, it works. :)
That's why I'm surprised it works. Will fix, thank you for the QA check.
Ugh, I did know some day about this being possibly relocatable to a larger table elsewhere, but completely forgot about this hack. Will do.
Yet another very good point. I tend to keep my assembly as "simple" as possible so it stays compatible with my limited brain power, so it's rarely optimal. But your suggestion is nonetheless very much worthy of looking into. Thanks again! |
If you do fix that I'd suggest testing with stdin and stdout redirected as well, just to see if it really works. |
I did test it with stdout redirected, and then with stdin redirected (amb b:\file < nul). Both scenarios work. Maybe EDR presets the entire JFT with stderr? Or it is smart enough to detect an invalid handle and falls back to console... Anyway, going to fix it all now. I'm really happy you're here with us. As you see both myself and Bernd aren't very good with basic additions, so your help is truly invaluable. ;-) |
Yeah I'd guess the latter. |
finally done. Positively tested with both EDR and FD (not that it means much). |
You can use |
You can directly |
Nice. Saves 4 bytes. :)
I actually did not know it's legal on a 8086 to push from memory. Saves 1 byte. Thanks! |
another byte saved! :) |
This is about adding an INT 24h handler to SvarCOM. This handler should probably be placed within the RMOD part (resident part) as it needs to be active not only during command prompt operations but also at application runtime when SvarCOM is "swapped out".
The text was updated successfully, but these errors were encountered: