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