Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - interrupt() call a system interrupt http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 interrupt()         Call a system interrupt
------------------------------------------------------------------------------
 Declaration
   system.hdr

 Syntax
   func logical interrupt extern
   param value uint uInterrupt, ;
               uint uAX, ;
               uint uBX, ;
               uint uCX, ;
               uint uDX, ;
               uint uSI, ;
               uint uDI, ;
               uint uBP, ;
               uint uDS, ;
               uint uES

 Arguments
   uInterrupt is the interrupt number to call.
   uAX is the ax register value.
   uBX is the bx register value.
   uCX is the cx register value.
   uDX is the dx register value.
   uSI is the si register value.
   uDI is the di register value.
   uBP is the bp register value.
   uDS is the ds register value.
   uES is the es register value.

 Return
   A logical indicating if the carry flag was clear after the interrupt call.

 Description
   This function calls a DOS or BIOS interrupt. Before executing the
   specified interrupt, the function loads the various processor registers
   according to the matching parameters.

   After execution of the interrupt, the status of the processor registers
   is transferred into the respective parameters. The return value of the
   function indicates the status of the carry flag after interrupt
   execution, where .t. means that the carry flag is clear, and .f. that the
   carry flag is set. In most cases, an error which occured during the
   execution of the interrupt sets the carry flag, i. e. results in
   returning .f..

   Incorrect use of this function may cause unpredictable results, or
   loss of data. The intx86() supersedes the interrupt() function.

 Example
   #define EXAMPLE_SYSTEM
   #include example.hdr

   // Call mouse interrupt (int 33h) and determine the number of mouse buttons
   // if mouse is available
   
   proc Test_interrupt
   vardef
      uint ax, bx, cx, dx, ds, es, di, si, bp, flags
      char cFile
   enddef
   ax := 0                                // mouse status determination
   interrupt( 0x33, ax, bx, cx, dx, si, di, bp, ds, es ) // call mouse interrupt
   if ax == 0xffff                        // if mouse driver installed
      ? "Number of mouse buttons is", istr( bx ) // bx is number of buttons
   else
      ? "Mouse not available"
   endif
   ?
   cFile := "none.txt"           // a non-existant file name
   ax := 0x3d00                  // DOS open file function
   ds := segmentvalue( cFile )
   dx := offsetvalue( cFile )
   ? interrupt( 0x21, ax, bx, cx, dx, si, di, bp, ds, es ) // call DOS interupt
   ? ax                          // DOS error code 2: file not found
   endproc

   proc main
   Test_interrupt()
   endproc

See Also: doscall() intwflags() intx86()

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