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