DOS TSR not returning to calling application

I have a DOS TSR written in assembly that is a printer driver to a 'C' application. This TSR has been working for a while and now needs to be modified to take the data going to the printer and put it into a file. When I open the file using the int 21h file handle method (I've also tried the FCB method), put in data, and close the file, the TSR routine doesn't return to the application and DOS crashes. After rebooting, I look at the file and it has the data in it. I've tried to push and pop everything I can think of but DOS still crashes. I've also tried to display the data using function 40h of int 21h instead of putting the data to file, and DOS still crashes. It seems I'm having problems getting back to the application's calling routine. Any suggestions? Pat

Comments

  • : I have a DOS TSR written in assembly that is a printer driver to a 'C' application. This TSR has been working for a while and now needs to be modified to take the data going to the printer and put it into a file. When I open the file using the int 21h file handle method (I've also tried the FCB method), put in data, and close the file, the TSR routine doesn't return to the application and DOS crashes. After rebooting, I look at the file and it has the data in it. I've tried to push and pop everything I can think of but DOS still crashes. I've also tried to display the data using function 40h of int 21h instead of putting the data to file, and DOS still crashes. It seems I'm having problems getting back to the application's calling routine. Any suggestions? Pat
    :

    Just a guess, but are you perhaps overwriting something in DOS or the main program's code memory when you are storing the data coming from the application?

    Any chance you can trace it with debug so that when your TSR hits its iret (or ret) back to the main program you can follow where it goes to?

    -jeff!

  • : : I have a DOS TSR written in assembly that is a printer driver to a 'C' application. This TSR has been working for a while and now needs to be modified to take the data going to the printer and put it into a file. When I open the file using the int 21h file handle method (I've also tried the FCB method), put in data, and close the file, the TSR routine doesn't return to the application and DOS crashes. After rebooting, I look at the file and it has the data in it. I've tried to push and pop everything I can think of but DOS still crashes. I've also tried to display the data using function 40h of int 21h instead of putting the data to file, and DOS still crashes. It seems I'm having problems getting back to the application's calling routine. Any suggestions? Pat
    : :
    :
    : Just a guess, but are you perhaps overwriting something in DOS or the main program's code memory when you are storing the data coming from the application?
    :
    : Any chance you can trace it with debug so that when your TSR hits its iret (or ret) back to the main program you can follow where it goes to?
    :
    : -jeff!
    :
    :
    Jeff, thanks for replying. I just found out why the TSR isn't returning to the application. The application is using int 21h to call the TSR routines. DOS interrupts are not re-entrant. It looks like I'm going to have to use the BIOS to write the data to file. As I read up on this subject, it looks very complicated and dangerous. I haven't found a way around DOS to access and write into the file directory or the FAT. Any suggestions?
    Pat
  • Maybe you could hook the timer interrupt and on each, check if INT 21h is in use (a simple hook can do the trick, or you could use the INDOS flag and all that other fun stuff) and if it's not in use, complete the request. This is of course assuming the command doesn't need to be completed JUST when the function is called. I truly hope this is the solution you've been looking for.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories