Path: utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!cs.utexas.edu!uunet!samsung!sol.ctr.columbia.edu!bronze!yawei From: yawei@bronze.ucs.indiana.edu (mr. yawei) Newsgroups: comp.os.msdos.programmer Subject: Re: TSR PROGRAMMING PROBLEM Message-ID: <1991Jan29.173752.10045@bronze.ucs.indiana.edu> Date: 29 Jan 91 17:37:52 GMT References: <1991Jan26.195955.12946@ugle.unit.no> <1991Jan26.220820.7855@uwasa.fi> <8256@ucdavis.ucdavis.edu> Organization: Indiana University, Bloomington Lines: 36 In article <8256@ucdavis.ucdavis.edu> chiang@iris.ucdavis.edu (Tom Chiang) writes: > >following below is asm code for a tsr with a few lines added by me... >the tsr basically intercepts int 16 and changes the case of the >letter Y whenever it it is typed....now, i added code to send the >letter z to printer every time this int occured...but my system >crashes from those new lines...any help would be appreciated This is called the DOS re-entrancy problem which anyone who is teaching you to write TSRs should have told you about. Simply speaking, DOS cannot be entered twice. Since the int 16h request most likely comes from inside DOS, issuing another DOS call destroys the stack of the first call thus causing the system to crash. (Actual situation is more complicated since DOS uses several stacks. Try to get some books on this subject. Unfortunately, I can't think of any good books on writing TSRs. Has anyone seen one?) Changing your code to the following may work: ; push/pop ax/dx as needed... mov ah, 0 ;output char to printer function mov al, 'z' sub dx, dx ;(lpt1) int 17h ;BIOS printer output interrupt > push dx ----- > push ax | > mov dl,'z' | > mov ah,5H | ----- these are the instructions i added > int 21H | > pop ax | > pop dx ------ Good luck! yawei