home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / WIH.ZIP / README.OLD < prev    next >
Encoding:
Text File  |  1987-02-01  |  1.8 KB  |  40 lines

  1. Run these programs in the following order:
  2.     SIH
  3.     INTCALL
  4.     INTCALL
  5.      ...
  6.  
  7.     INTCALL
  8.  
  9. This test shows that software interupts can be handled in Turbo Pascal.
  10. The first program (SIH.COM) runs and stays resident.  It attaches
  11. itself to an unused software interupt (hex 41). The next program
  12. (INTCALL.COM) makes a Turbo INTR call that wakes up the first program. SIH
  13. prints a message, then returns contol to INTCALL.
  14.  
  15. Page 214 in the Version 3.0 Turbo Pascal Reference Manual has a very brief
  16. discussion of interupt handling.  Through trial and error, I have also
  17. discovered the following:
  18.  
  19.    1. There doesn't seem to be any way for a program to discover the
  20.       starting address of its own code.  However, by including a typed
  21.       constant just before the beginning of the program body, you can use
  22.       the SEG and OFS functions to obtain addresses.  In SIH.PAS, the
  23.       typed constant actually contains a section of inline code.
  24.  
  25.    2. When you leave code in memory and return to it you must reestablish
  26.       the code and data segment registers.  SIH.PAS does this by modifying
  27.       the code in the typed constant.
  28.  
  29.    3. You must not mess with the stack segment register.  In fact you should
  30.       remove some of the commands that the Turbo Manual says must be included.
  31.       Specifically, $8B/$E5/$5D should not be used in the in-line code to
  32.       exit your interupt handler.
  33.  
  34.    4. Turbo says you may not use any of the standard procedures and
  35.       functions within an interupt handler.  At least in this example, I
  36.       am getting away with using WriteLn.
  37.  
  38. Now, who is brave enough to write a Critical Error Interupt (hex 24)
  39. handler in Turbo Pascal?
  40.