OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 9:39 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: TSR (Terminate and Stay Resident, 16-bit)
PostPosted: Tue Nov 06, 2007 11:38 am 
Offline
Member
Member
User avatar

Joined: Sat Nov 25, 2006 3:55 am
Posts: 416
Location: Wisconsin
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:

Code:
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.

_________________
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 06, 2007 2:27 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 25, 2006 3:55 am
Posts: 416
Location: Wisconsin
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.

_________________
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 41 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group