TSR in Assembly Language TSR in Assembly Language

ssusera8c91a 26 views 5 slides May 20, 2024
Slide 1
Slide 1 of 5
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5

About This Presentation

TSR in Assembly Language


Slide Content

ISR means "Interrupt service routine". That means - it's a piece of code that is invoked when an interrupt occurs (normally hardware-driven, i . e. timer or keyboard, but not necessarily). ISRs in real mode systems (like MS-DOS) are listed in the interrupt table at address 0000:0000. There are 256 interrupt vectors - that is, far addresses of interrupt handlers. You can change one of them to an address in your own program. But there's the catch: normally, when the program terminates, the address range it used to occupy is returned to the OS and OS is free to use it for something else. Here's where the concept of TSR comes in.

TSR stands for "Terminate and stay resident". That means - a program is done running, but its code and data remains in memory. This is implemented in DOS via int 21h, function 31h. When a program hooks up an interrupt vector and does not restore it to the original value at the end, it better stay resident - otherwise the vector value will go invalid once the program is unloaded.

So, to recap: TSR is a method of terminating a program that doesn't unload it. Sometimes the word is used for the program itself. ISR is a routine (function, procedure, etc.) within that program that gains control when an interrupt is invoked, via an interrupt vector.

It's possible to have an ISR in a program that doesn't stay resident; but in this case, the vector hookup may only last while the program executes. Before termination, it should restore the vector to the original value; otherwise, the next attempt to execute that interrupt would crash the system.
Tags