I neep HELP with this TSR! 
Author Message
 I neep HELP with this TSR!

Not sure if this is correct, but .....
I can't remember off hand what int 28 does, but i have a vague feeling its a
DOS read/write file interrupt of some sort.  if this is the case then you
will surely have problems with DOS being non re-entrant.

What happens is that some program calls int 21h (the main DOS interrupt) to
do a file operation, eg writing a file to the disk.  int 21 then calls int
28h to do its dirty work ( <-- thats the bit im not sure about) which does
the actual writing of the file.  Next, your program wants to write a to a
log file the fact that this just happened. So TP's Append proc calls int
21h, thus overwriting the original data (about the original request) stored
in DOS's internal data structures. When your program returns control, it
IRET's back to int 21h which doesnt know whats going on, and consequently
crashes your program.

hope this helps.


Wed, 18 Jun 1902 08:00:00 GMT  
 I neep HELP with this TSR!
Get those writelns out of there!  Don't even attemp file handling in TSRs
unless you *know*.  DOS is not reentrant.  What happens if DOS or another
program is using the standard DOS calls to write to the screen and in the
middle of that your TSR writes to the screen?  Whatever it is it isn't
good.  Your best bet is to write your own procs to write to screen memory.
To do file handling you have to make many "checks" to see if it is safe to
use DOS interupts to mess with a file.  TSR writing can be very difficult
and fun!  I don't think I could write a TSR that handles files without a
lot of reading and effort.

Rules to live by:
Keep vars to a min.
Don't call any interupts at all unless you know it is safe to.  
Keep procedure and functions to a min.

Otherwise your making a good start.

Best of luck,
Jack Neely

> I don't seem to be getting anywhere with this, so If you'll excuse me I'll
> post part of the source itself. I'm not asking anyone to make this work; but
> just to take some time and see if there are any mistakes from the
> "theoretical" point of view. Of course, If you *do* make it work, that's all
> the better! :)

> It *does* work for a few minutes provided that nothing is done at the DOS
> prompt (rather, that no DOS commands are entered. It doesn't seem to crash
> if you just press some keys).

> I have followed many different suggestions from many different people, yet
> I haven't been able to make it work correctly... All suggestions/corrections/

> Just in case, *Please do NOT run this program!*

> Sorry for your time,

Jack Neely  AKA  C4Man  AKA  The QuackMaster

Home Page:      http://www.ac.net/~hneely
My Machine:     http://excalibur.rh.ncsu.edu
ICQ UIN:        3738590

Wed, 18 Jun 1902 08:00:00 GMT  
 I neep HELP with this TSR!


>It *does* work for a few minutes provided that nothing is done at the DOS
>prompt (rather, that no DOS commands are entered. It doesn't seem to crash
>if you just press some keys).

Indeed, as others pointed, DOS is not reentrant, that's why you should
make all real job (which uses DOS calls) from within Int 28. Don't
writeln in Int 9. In Int 9 or 1c you may only set flag: some operation
should be done. In Int 28 you can check these flags and actually do

Besides, it is not good to suppress interrupts for so long periods of
time. Keep these periods as short as possible.

And another moment: Int 9, as any hardware interrupt, writes into some
ports special values, meaning: "return from hardware interrupt".
Therefore, I am not sure whether it is good to call old handler at the
very beginning of yours. As for myself, I wrote TSRs in assembler and
preferred not to call but to jump to old handlers at the very end.

It seems that everything is OK with your 1c handler, with the only
eception that cli and sti are absolutely unnecessary. Try to remove
them - maybe it will become better.

Best regards!

Wed, 18 Jun 1902 08:00:00 GMT  
 [ 4 post ] 

 Relevant Pages 

1. Please help with a TSR that emulates a 0moden-cabel

2. Help with my little TSR


4. Please help with PASCAL TSR!

5. need help with TSR uninstall!

6. Help!! TSR's

7. Help: Making a TSR

8. TSR: File IO help?

9. HELP! Shared TSR for DOS

10. Help on making a ScrollBack Buffer (TSR).

11. Help! Unloading a TSR

12. <<HELP>> Re-entrering TSR


Powered by phpBB® Forum Software