I am struggling with very stupid issue. Hope you can help me.
I disable interrupts, and sense CTRL-STOP myself. As soon as I detect it, I set INTFLG to 03h, restore slots and exit.
And I run application in batch file. Therefore I would expect when DOS gets control through BDOS 00h, it immediately checks for CTRL-STOP press flag, and ask "terminate batch file?".
But it does not happen - in time. Application happily exits, then next application is being run, and the earliest time flag is checked when next application tries to print something onto the screen with BDOS 09h.
I have made a test - when exiting after setting INTFLG to do BDOS 09h, but with empty string "$". No difference. Ensured that interrupts are enabled before I perform "final" BDOS 09h with empty string, and even wait for next VDP interrupt - no difference. The ONLY difference is when I try to output some character, at least one, then DOS immediately says "terminate batch file"?
But I do not want to display anything 'real' on app exit. Is there any right way to give DOS a chance to check for CTRL-STOP flag and ask for batch file (execution) termination?
Edit: I also found out that file I/O operations do not trigger this sense, because application which is being started after exit manages to load file (open/read/close) before outputting to the screen. Therefore it is not just as simple as call any BDOS function.