home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / t / tcsel003.zip / CLKTSR.PAS < prev    next >
Pascal/Delphi Source File  |  1992-12-12  |  2KB  |  48 lines

  1. {$A+,B-,D-,E-,F-,I-,L-,N-,O-,R-,S-,V-}
  2. {$M 1024,0,0}
  3. uses dos,
  4.      clock;  { My clock ISR unit in next message. }
  5. const
  6.   IRet  : word = $cf;
  7.   IDStr : string[13]='TeeCee''s Clock';
  8. var
  9.   p : pointer;
  10. begin
  11.   GetIntVec($66,p);  { Int 66h is reserved for user defined interrupts }
  12.   inc(longint(p),2);
  13.   if string(p^) = IDStr then begin
  14.     writeln('TeeCee''s clock is already installed - you must be blind!');
  15.     halt;
  16.   end
  17.   else begin
  18.     writeln('TeeCee''s clock is now installed for demo purposes only');
  19.     SetIntVec($66,@IRet);   { IRet is obviously not an interrupt!      }
  20.     { What we are actually doing is storing a pointer to the IDStr     }
  21.     { in the vector table - much like the way the Video font addresses }
  22.     { are stored.                                                      }
  23.     SwapVectors;
  24.     Keep(0);
  25.   end;
  26. end.
  27.  
  28. (See the next message for the unit Clock. )
  29.  
  30. Now that is definintely for demonstration purposes only!  It will work but has 
  31. several serious shortcomings!
  32.  
  33. Firstly, it hooks the user defined interrupt $66 to allow any subsequent 
  34. executions to determine if the program is already installed.  It does this 
  35. without making any checks as to whether or not something else already "owns" 
  36. this vector. Not very smart!
  37.  
  38. Secondly, it provides no means to uninstall itself.  Mmmmm...  :-(
  39.  
  40. Thirdly, graphics mode will cause problems.  Again - not terribly smart!
  41.  
  42. Finally, TSRs are not for the faint-of-heart or beginner. They are an 
  43. extraordinarily complex and difficult part of DOS programming and if you are 
  44. serious about getting into TSRs then get as many good books as you can find 
  45. that authoritively discuss the subject.  Buying a good commercial toolbox, such 
  46. as Turbo Power's "TSRs Made Easy" is another smart move, as studying how the 
  47. masters do it is one of the best ways to learn.
  48.