TIP: Click on subject to list as thread! ANSI
echo: quik_bas
to: All
from: Greg Easthom
date: 2004-03-15 16:23:12
subject: Code FAQ [7 /15

'>>> Page  7  of Code FAQ begins here.

   DATA 74,07,C7,07,FF,FF,E9,A7,00,8B
   DATA 5E,06,8B,1F,2E,88,97,77,00,32
   DATA C0,80,FA,25,74,05,80,FA,26,75
   DATA 02,0C,02,50,1E,06,56,57,9C,8B
   DATA 76,0A,80,FA,20,7C,05,80,FA,30
   DATA 7C,0A,81,7C,08,FF,FF,74,03,8B
   DATA 6C,08,8B,44,0E,25,D5,0F,50,8B
   DATA 04,8B,5C,02,8B,4C,04,8B,54,06
   DATA 8B,7C,0C,FF,74,0A,81,7C,12,FF
   DATA FF,74,03,8E,44,12,81,7C,10,FF
   DATA FF,74,03,8E,5C,10,5E,9D,CD,00
   DATA 55,8B,EC,9C,83,C5,0E,F6,46,FE
   DATA 02,74,02,45,45,1E,56,8E,5E,FC
   DATA 8B,76,08,89,04,89,5C,02,89,4C
   DATA 04,89,54,06,8F,44,0A,89,7C,0C
   DATA 8F,44,10,8C,44,12,8F,44,0E,8F
   DATA 44,08,F6,46,FE,02,74,02,44,44
   DATA 9D,5F,5E,07,1F,58,5D,CA,08,00

   '---------------------------------------------------------------
   ' Example: get current video mode
   '---------------------------------------------------------------
   DIM r AS RegTypeX
   r.ax = &HF00
   InterruptX &H10, r, r
   VideoMode = (r.ax AND &HFF)
   PRINT "Video mode is "; VideoMode
   END

   SUB InterruptX (IntNo AS INTEGER, Inreg AS RegTypeX, OutReg AS_
RegTypeX) STATIC
   '---------------------------------------------------------------
   ' Interrupt procedure. Works in the same way as its QB 4.5
   ' counterpart.
   '---------------------------------------------------------------

   IF NOT MachineCode% THEN
     ' First time dimension string array to hold machine code
     RESTORE InterruptXASM
     READ nASMBYTES%
     REDIM ASMBuffer(0 TO nASMBYTES% - 1) AS STRING * 1
   END IF

   ' Get address of machine code
   DEF SEG = VARSEG(ASMBuffer(0))
   Offset% = VARPTR(ASMBuffer(0))
   IF NOT MachineCode% THEN
     ' First time load string array with machine code
     FOR i% = 0 TO nASMBYTES% - 1
       READ Code$
       POKE Offset% + i%, VAL("&H" + Code$)
     NEXT i%
     ' Indicate availability of machine code
     MachineCode% = TRUE
   END IF

   ' Call interrupt.
   ' The first Offset% parameter is used by the machine code
   ' modifying it self, so don't leave it out.
   CALL ABSOLUTE(IntNo%, Inreg, OutReg, Offset%, Offset%)

   DEF SEG
   END SUB
[end]

6) HOW DO I USE THE MOUSE IN QB?

   The most common (and most universal) approach is through
   INTERRUPTs.  Using INTERRUPT 33h, the following code will allow
   you to use a mouse in your programs.  Code by David Aukerman
   with the idea for limited mouse movement by Dave Shea.  Public
   domain; use at your own risk!

[begin]
   '$INCLUDE: 'qb.bi'   'these three lines go at the
   DEFINT A-Z           'beginning of your program..
   DIM SHARED HMin, HMax, VMin, VMax      'horiz. and vert. limits

   SUB Mouse (cx, dx, bx)
      DIM reg AS RegType
      reg.ax = 3        'get coordinates
      INTERRUPT &H33, reg, reg
      bx = reg.bx       '1=left button; 2=right; 3=both
                        '(on a two button mouse)
      cx = reg.dx       'horizontal coordinate in *pixels*
      dx = reg.cx       'vertical coordinate in *pixels*
   END SUB

'>>> Page  7  of Code FAQ ends here. Continued in next message.

 * Brought to you by Greg's Little QBasic Auto-Poster *

--- Maximus 3.01
* Origin: The BandMaster, Vancouver, B.C., Canada (1:153/7715)
SEEN-BY: 633/267 270
@PATH: 153/7715 140/1 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.