Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo Pascal - <b> intr perform software interrupt pp 214</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 INTR                     Perform Software Interrupt                  pp 214

 Syntax:  Intr (IntNumber, Regs) ;

 Type:    Record

 Form:    Procedure

 Purpose: Execute a software interrupt with specified registers.

 Notes:   An interrupt routine must first preserve AX,BX,CX,DX,SI,DI,DS,ES
          registers prior to calling the interrupt.  This is done by placing
          the following Inline statement as the first statement of the
          interrupt routine.

 Example: Inline ($50/$53/$51/$52/$56/$57/$1E/$06/$FB) ;  { Push the above }
          $FB is an optional statement for STI (enable interrupts).

          The termination of an interrupt routine requires the restoration of
          the above registers.  The last statement of the routine should be:

 Example: Inline ($07/$1F/$5F/$5E/$5A/$59/$5B/$58/$8B/$E5/$5D/$CF) ; { Pop }

          $CF is an IRET instruction that overrides the RET instruction that
          is automatically generated by the compiler.

          The Interrupt System is Not Re-Entrant.  This means that no
          system interrupt services should be called from an interrupt
          routine.  Do not employ any I/O operations using the standard
          procedures and functions of Turbo Pascal during this routine.

          Intr requires the registers be set prior to the call.


 ----------------------------------------------------------------------------


 Usage:
      TYPE
         RegType = Record
                   AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags : Integer ;
                   End ;
      VAR
         Regs    : RegType ;  { Define regs as RegType         }
         M1, M2  : Integer ;  { User variables                 }
         M3, M4  : Integer ;

      BEGIN
         Inline ($50/$53/$51/$52/$56/$57/$1E/$06) ;
         With Regs Do
           Begin
           AX    := M1 ;      { Set AX to user                 }
           BX    := M2 ;      { Set BX to user                 }
           CX    := M3 ;      { Set CX to user                 }
           DX    := M4 ;      { Set DX to user                 }
           End ;

         Intr ($51,Regs) ;    { Call mouse interrupt with regs }

         With Regs Do
           Begin
           M1    := AX ;      { Get result to M1               }
           M2    := BX ;      { Get result to M2               }
           M3    := CX ;      { Get result to M3               }
           M4    := DX ;      { Get result to M4               }
           End ;
         Inline ($07/$1F/$5F/$5E/$5A/$59/$5B/$58/$8B/$E5/$5D/$CF) ;
       END.

See Also: Lo Hi Inline MsDos With

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson