TSR (Terminate and Stay Resident, 16-bit)
Page 1 of 1

Author:  XCHG [ Tue Nov 06, 2007 11:38 am ]
Post subject:  TSR (Terminate and Stay Resident, 16-bit)

I have a program with the COM format (One Code segment). I do have the ORG 100h at the beginning of the file. The program is being assembled by TASM and linked by TLINK. TASM is able to assemble the source file but I get the following error from TLINK:

C:\TASM>tlink /t a
Turbo Link  Version 5.1 Copyright (c) 1992 Borland International
Fatal: Cannot generate COM file : data below initial CS:IP defined

So if anybody could tell me what I must have done wrong, I would appreciate it. The other problem that I have is on how to make this program a TSR. I have read a little bit about it and unfortunately, I don't have time to read tons of pages of information. So if anybody could give me a simple example on how to calculate the number of paragraphs for the TSR to leave in the memory, where the beginning of the resident area is and perhaps other stuff, I would really appreciate it.

Author:  XCHG [ Tue Nov 06, 2007 2:27 pm ]
Post subject: 

Okay, I finally figured it out. Thanks guys for considering reading this thread. For those who have had problems with the TSR and how the program should return to DOS:

1) Put the whole program in a PARA segment called CODESEGG or something similar. TASM complains if you set it to CODESEG because it is a reserved word,
2) The above segment should be the wrapper around the whole code that you are writing. The segment then should be ended at the end of the program with CODESEGG ENDS.
3) Then at the end of the program, instead of a normal exit, set AH to 0x31. Then set DX to the starting point of your program that does not need to stay in the memory.
4) Issue the INT 0x21 trap.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group