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 - __regs processor word register value array http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 __regs              Processor word register value array
------------------------------------------------------------------------------
 Declaration
   system.hdr

 Syntax
   _REGS __regs

 Default
   All members initialized to zero.

 Description
   The __regs structure stores word register values for using in conjunction
   with the intx86(), getregs() and setregs() functions.

 Example
   #define EXAMPLE_SYSTEM
   #include example.hdr

   /*
   This example does not utilizee Force's indigenous mouse support
   functions, instead communicates with the mouse driver directly, using
   the intx86() function and the __regs system structure variable.
   */
   
   proc Test_regs
   clear
   @ 0, 0 ?? "Move the mouse... (any key exits)"
   // initialize mouse
   __regs.ax := 0x00
   __regs.bx := 0x03
   intx86( 0x33 )
   if __regs.ax == 0x00
      ? "No mouse!"
   else
      cursor( .f. )
      __regs.ax := 0x01
      intx86( 0x33 )
      // read mouse position
      do while inkey() == 0
         __regs.ax := 0x03
         intx86( 0x33 )
         @ __max_row, 0 ?? "Mouse at " + ;
            padl( istr( __regs.cx / 8 ), 2, '0' ) + ", " + ;
            padl( istr( __regs.dx / 8 ), 2, '0' ) + "  Any buttons?"
         // check buttons
         if __regs.bx != 0
            @ __max_row, 30 ?? "Yes"
         else
            @ __max_row, 30 ?? "No "
         endif
      enddo
      // turn mouse off
      __regs.ax := 0x00
      __regs.bx := 0x00
      intx86( 0x33 )
      cursor( .t. )
   endif
   endproc

   proc main
   Test_regs()
   endproc

See Also: __bregs doscall() getregs() intx86() setregs()

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