5748194 [rkeene@sledge /home/rkeene/devel/archive/quickbasic]$ cat -n mouse10.bas
   1: DECLARE SUB DrawIt (A!)
   2: DECLARE SUB Lightup (sm!, x%, y%)
   3: DECLARE SUB Pause ()
   4: DECLARE SUB MouseStatus (lb%, rb%, xMouse%, yMouse%)
   5: DECLARE SUB MouseRange (x1%, y1%, x2%, y2%)
   6: DECLARE SUB MousePut (x%, y%)
   7: DECLARE SUB MouseHide ()
   8: DECLARE SUB MouseDriver (ax%, bx%, cx%, dx%)
   9: DECLARE SUB MouseShow ()
  10: DECLARE FUNCTION MouseInit% ()
  11: DIM SHARED Mouse$
  12: Mouse$ = SPACE$(57)
  13: FOR I% = 1 TO 57
  14:   READ A$
  15:   H$ = CHR$(VAL("&H" + A$))
  16:   MID$(Mouse$, I%, 1) = H$
  17: NEXT I%
  18: DATA 55,89,E5,8B,5E,0C,8B,07,50,8B,5E,0A,8B,07,50,8B
  19: DATA 5E,08,8B,0F,8B,5E,06,8B,17,5B,58,1E,07,CD,33,53
  20: DATA 8B,5E,0C,89,07,58,8B,5E,0A,89,07,8B,5E,08,89,0F
  21: DATA 8B,5E,06,89,17,5D,CA,08,00                    
  22: CLS
  23: ms% = MouseInit%
  24: IF NOT ms% THEN
  25:   PRINT "Mouse is required"
  26:   END
  27: END IF
  28: SCREEN 12
  29: CLS
  30: Sa = 65
  31: 12 MousePut 25, 25
  32: MouseShow
  33: MouseRange 5, 5, 55, 50
  34: LINE (0, 0)-(57, 56), 15, B
  35: DrawIt Sa
  36: IF Sa > 64 AND Sa < 91 THEN Sa = Sa + 1: GOTO 12
  37: 
  38: SUB DrawIt (A)
  39: sx = 1
  40: LOCATE 9, 1: PRINT CHR$(A)
  41: 19 MouseStatus lb%, rb%, y%, x%
  42: IF lb% = -1 THEN CIRCLE (y%, x%), sx, x% + y%
  43: IF rb% = -1 THEN LOCATE 10, 1: PRINT "Press any key to continue": SLEEP: rb% = 0: MouseHide: CLS : MouseShow: LOCATE 11, 1: PRINT Roy.A: EXIT SUB
  44: Roy.A = Roy.A + y% + x%
  45: GOTO 19
  46: END SUB
  47: 
  48: SUB MouseDriver (ax%, bx%, cx%, dx%)
  49:   DEF SEG = VARSEG(Mouse$)
  50:   Mouse% = SADD(Mouse$)
  51:   CALL Absolute(ax%, bx%, cx%, dx%, Mouse%)
  52: END SUB
  53: 
  54: SUB MouseHide
  55:  ax% = 2
  56:  MouseDriver ax%, 0, 0, 0
  57: END SUB
  58: 
  59: FUNCTION MouseInit%
  60:   ax% = 0
  61:   MouseDriver ax%, 0, 0, 0
  62:   MouseInit% = ax%
  63: END FUNCTION
  64: 
  65: SUB MousePut (x%, y%)
  66:   ax% = 4
  67:   cx% = x%
  68:   dx% = y%
  69:   MouseDriver ax%, 0, cx%, dx%
  70: END SUB
  71: 
  72: SUB MouseRange (x1%, y1%, x2%, y2%)
  73:   ax% = 7
  74:   cx% = x1%
  75:   dx% = x2%
  76:   MouseDriver ax%, 0, cx%, dx%
  77:   ax% = 8
  78:   cx% = y1%
  79:   dx% = y2%
  80:   MouseDriver ax%, 0, cx%, dx%
  81: END SUB
  82: 
  83: SUB MouseShow
  84:   ax% = 1
  85:   MouseDriver ax%, 0, 0, 0
  86: END SUB
  87: 
  88: SUB MouseStatus (lb%, rb%, xMouse%, yMouse%)
  89:   ax% = 3
  90:   MouseDriver ax%, bx%, cx%, dx%
  91:   lb% = ((bx% AND 1) <> 0)
  92:   rb% = ((bx% AND 2) <> 0)
  93:   xMouse% = cx%
  94:   yMouse% = dx%
  95: END SUB
  96: 
  97: SUB Pause
  98:   'This sub used for demo, not needed for mouse calls
  99:   PRINT "Press any key to continue..."
 100:   G$ = INPUT$(1)
 101:   PRINT
 102: END SUB
 103: 
5748195 [rkeene@sledge /home/rkeene/devel/archive/quickbasic]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2000-05-09 21:05:15