The writing of TSR is just a matter of stealing interrupts, reassigning the address in the IVT to point to the function we want to execute and keeping the program resident in memory.The following C functions will be used to do the above.
getvect()
setvect()
keep()
The following example is a TSR which makes caps lock permanently high.
#includevoid interrupt(*old)(); void interrupt new(); char for *scr=(char far *)0x417; main() { old=getvect(0x08); setvect(0x08,new); keep(0,100); } void interrupt new() { *scr=64; (*old)(); }