home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / MSMOUSE2.ZIP / UTILS.ZIP / BMFUNC.BAS < prev    next >
Encoding:
BASIC Source File  |  1989-02-10  |  9.2 KB  |  287 lines

  1. 10000 '
  2. 10002 ' Interpreted BASIC mouse library interface subroutines
  3. 10004 '
  4. 10006 ' Copyright (c) 1988-1989 by Microsoft Corp.  All rights reserved.
  5. 10008 '
  6. 10010 ' Author:        Tom Hensel    11/13/88
  7. 10012 '
  8. 10014 ' Use a GOSUB 10000 + 100*(function number) to call subroutine
  9. 10016 '
  10. 10018 ' For example:  Show Cursor (function 1) would be GOSUB 10100
  11. 10020 '
  12. 10022 ' Variables are named M1%, M2%, M3%, and M4%.  Only variables affected
  13. 10024 ' need to be passed, the subroutines will take care of the rest.
  14. 10026 '
  15. 10028 ' The current segment will be set to BASIC's data segment on return
  16. 10030 '
  17. 10032 ' Function 0 - Mouse Reset and Status
  18. 10034 '
  19. 10036 DEF SEG=0                ' Point to segment 0
  20. 10038 MOUSESEG=256*PEEK(51*4+3) + PEEK(51*4+2) ' Get mouse vector segment
  21. 10040 MOUSEOFF=256*PEEK(51*4+1) + PEEK(51*4) + 2 ' Get mouse vector offset + 2
  22. 10045 M1%=0
  23. 10047 ' Check if vector = 0:0
  24. 10050 IF MOUSESEG=0 AND (MOUSEOFF - 2)=0 THEN DEFSEG : RETURN
  25. 10055 DEF SEG=MOUSESEG            ' Point to mouse driver segment
  26. 10057 ' Check if vector points to IRET
  27. 10060 IF PEEK(MOUSEOFF - 2)=207 THEN DEF SEG : RETURN
  28. 10065 CALL MOUSEOFF(M1%, M2%, M3%, M4%)
  29. 10067 DEF SEG                ' Restore BASIC data segment
  30. 10070 IF MOUSESEMAPHORE% THEN RETURN
  31. 10075 MOUSETMPM1%=M1% : MOUSETMPM2%=M2% : MOUSETMPM3%=M3% : MOUSETMPM4%=M4%
  32. 10080 GOSUB 13600            ' Get mouse driver version number
  33. 10085 MOUSEVERSION%=M2%            ' Save it for later
  34. 10090 M1%=MOUSETMPM1% : M2%=MOUSETMPM2% : M3%=MOUSETMPM3% : M4%=MOUSETMPM4%
  35. 10095 MOUSESEMAPHORE%=1 : RETURN
  36. 10100 '
  37. 10110 ' Function 1 - Show Cursor
  38. 10120 '
  39. 10130 M1%=1
  40. 10140 DEF SEG=MOUSESEG            ' Point to mouse driver segment
  41. 10150 CALL MOUSEOFF(M1%, M2%, M3%, M4%)
  42. 10160 DEF SEG                ' Restore BASIC data segment
  43. 10170 RETURN
  44. 10200 '
  45. 10210 ' Function 2 - Hide Cursor
  46. 10220 '
  47. 10230 M1%=2
  48. 10240 GOTO 10140            ' Common mouse library entry point
  49. 10300 '
  50. 10310 ' Function 3 - Get Button Status and Mouse Position
  51. 10320 '
  52. 10330 M1%=3
  53. 10340 GOTO 10140            ' Common mouse library entry point
  54. 10400 '
  55. 10410 ' Function 4 - Set Mouse Cursor Position
  56. 10420 '
  57. 10430 M1%=4
  58. 10440 GOTO 10140            ' Common mouse library entry point
  59. 10500 '
  60. 10510 ' Function 5 - Get Button Press Information
  61. 10520 '
  62. 10530 M1%=5
  63. 10540 GOTO 10140            ' Common mouse library entry point
  64. 10600 '
  65. 10610 ' Function 6 - Get Button Release Information
  66. 10620 '
  67. 10630 M1%=6
  68. 10640 GOTO 10140            ' Common mouse library entry point
  69. 10700 '
  70. 10710 ' Function 7 - Set Minimum and Maximum Horizontal Cursor Position
  71. 10720 '
  72. 10730 M1%=7
  73. 10740 GOTO 10140            ' Common mouse library entry point
  74. 10800 '
  75. 10810 ' Function 8 - Set Minimum and Maximum Vertical Cursor Position
  76. 10820 '
  77. 10830 M1%=8
  78. 10840 GOTO 10140            ' Common mouse library entry point
  79. 10900 '
  80. 10905 ' Function 9 - Set Graphics Cursor Block
  81. 10910 '
  82. 10915 ' M4% should contain a pointer to cursor block array
  83. 10920 '
  84. 10925 ' For example:  M4% = VARPTR(USERGCB(0, 0))
  85. 10930 '
  86. 10935 ' For backward compatibility (mouse drivers before 6.25), the graphics
  87. 10940 ' cursor block should be named USERGCB, or change name on line 10970
  88. 10945 '
  89. 10950 M1%=9
  90. 10955 IF MOUSEVERSION%>=1573 THEN GOTO 10140 ' Common mouse library entry point
  91. 10960 ' Backward compatible if previous to mouse driver version 6.25
  92. 10965 DEF SEG=MOUSESEG            ' Point to mouse driver segment
  93. 10970 CALL MOUSEOFF(M1%, M2%, M3%, USERGCB(0, 0))
  94. 10975 DEF SEG                ' Restore BASIC data segment
  95. 10980 RETURN
  96. 11000 '
  97. 11010 ' Function 10 - Set text Cursor
  98. 11020 '
  99. 11030 M1%=10
  100. 11040 GOTO 10140            ' Common mouse library entry point
  101. 11100 '
  102. 11110 ' Function 11 - Read Mouse Motion Counters
  103. 11120 '
  104. 11130 M1%=11
  105. 11140 GOTO 10140            ' Common mouse library entry point
  106. 11200 '
  107. 11205 ' Function 12 - Set Interrupt Subroutine Call Mask and Address
  108. 11210 '
  109. 11215 ' M4% should contain a pointer to subroutine address
  110. 11220 '
  111. 11225 ' For example:  M4% = VARPTR(USERSUB%)
  112. 11230 '
  113. 11235 ' Remove line 11260 and pass M2% = VARPTR(subroutineSegment)
  114. 11240 ' if subroutine doesn't reside in data segment
  115. 11245 '
  116. 11250 ' For backward compatibility (mouse drivers before 6.25), the subroutine
  117. 11255 ' address should be named USERSUB%, or change name on line 11290
  118. 11260 '
  119. 11265 M1%=12
  120. 11270 M2%=0                ' Use DS for code segment
  121. 11275 IF MOUSEVERSION%>=1573 THEN GOTO 10140 ' Common mouse library entry point
  122. 11280 ' Backward compatible if previous to mouse driver version 6.25
  123. 11285 DEF SEG=MOUSESEG            ' Point to mouse driver segment
  124. 11290 CALL MOUSEOFF(M1%, M2%, M3%, USERSUB%(0))
  125. 11295 DEF SEG                ' Restore BASIC data segment
  126. 11297 RETURN
  127. 11300 '
  128. 11310 ' Function 13 - Light Pen Emulation Mode On
  129. 11320 '
  130. 11330 M1%=13
  131. 11340 GOTO 10140            ' Common mouse library entry point
  132. 11400 '
  133. 11410 ' Function 14 - Light Pen Emulation Mode Off
  134. 11420 '
  135. 11430 M1%=14
  136. 11440 GOTO 10140            ' Common mouse library entry point
  137. 11500 '
  138. 11510 ' Function 15 - Set Mickey/Pixel Ratio
  139. 11520 '
  140. 11530 M1%=15
  141. 11540 GOTO 10140            ' Common mouse library entry point
  142. 11600 '
  143. 11610 ' Function 16 - Conditional Off
  144. 11620 '
  145. 11630 ' M4% should contain a pointer to conditional off array
  146. 11640 '
  147. 11650 ' For example:  M4% = VARPTR(CO(0))
  148. 11660 '
  149. 11670 M1%=16
  150. 11680 GOTO 10140            ' Common mouse library entry point
  151. 11900 '
  152. 11910 ' Function 19 - Set Double-Speed Threshold
  153. 11920 '
  154. 11930 M1%=19
  155. 11940 GOTO 10140            ' Common mouse library entry point
  156. 12000 '
  157. 12005 ' Function 20 - Swap Interrupt Subroutines
  158. 12010 '
  159. 12015 ' M4% should contain a pointer to subroutine address
  160. 12020 '
  161. 12025 ' For example:  M4% = VARPTR(subroutineOffset)
  162. 12030 '
  163. 12035 ' Remove line 12060 and pass M2% = VARPTR(subroutineSegment)
  164. 12040 ' if subroutine doesn't reside in data segment
  165. 12045 '
  166. 12050 ' For backward compatibility (mouse drivers before 6.25), the subroutine
  167. 12055 ' address should be named USERSUB%, or change name on
  168. 10257 ' lines 12087, 12090, 12092, and 12094
  169. 12060 '
  170. 12065 M1%=20
  171. 12070 M2%=0                ' Use DS for code segment
  172. 12075 IF MOUSEVERSION%>=1573 THEN GOTO 10140 ' Common mouse library entry point
  173. 12080 ' Backward compatible if previous to mouse driver version 6.25
  174. 12085 DEF SEG=MOUSESEG            ' Point to mouse driver segment
  175. 12087 MOUSETMP%=USERSUB%(0)        ' Save old value
  176. 12090 CALL MOUSEOFF(M1%, M2%, M3%, USERSUB%(0))
  177. 12092 M4%=USERSUB%(0)            ' Returned this way because of bug
  178. 12094 USERSUB%(0)=MOUSETMP%        ' Restore original value
  179. 12095 DEF SEG                ' Restore BASIC data segment
  180. 12097 RETURN
  181. 12100 '
  182. 12110 ' Function 21 - Get Mouse Driver State Storage Requirements
  183. 12120 '
  184. 12130 M1%=21
  185. 12140 GOTO 10140            ' Common mouse library entry point
  186. 12200 '
  187. 12210 ' Function 22 - Save Mouse Driver State
  188. 12220 '
  189. 12230 ' M4% should contain a pointer to state buffer array
  190. 12240 '
  191. 12250 ' For example:  M4% = VARPTR(buffer(0))
  192. 12260 '
  193. 12270 M1%=22
  194. 12280 GOTO 10140            ' Common mouse library entry point
  195. 12300 '
  196. 12310 ' Function 23 - Restore Mouse Driver State
  197. 12320 '
  198. 12330 ' M4% should contain a pointer to state buffer array
  199. 12340 '
  200. 12350 ' For example:  M4% = VARPTR(buffer(0))
  201. 12360 '
  202. 12370 M1%=23
  203. 12380 GOTO 10140            ' Common mouse library entry point
  204. 12400 '
  205. 12405 ' Function 24 - Set Alternate Subroutine Call Mask and Address
  206. 12410 '
  207. 12415 ' M4% should contain a pointer to subroutine address
  208. 12420 '
  209. 12425 ' For example:  M4% = VARPTR(subroutineOffset)
  210. 12430 '
  211. 12435 ' Remove line 12460 and pass M2% = VARPTR(subroutineSegment)
  212. 12440 ' if subroutine doesn't reside in data segment
  213. 12445 '
  214. 12450 M1%=24
  215. 12460 M2%=0                ' Use DS for code segment
  216. 12470 GOTO 10140            ' Common mouse library entry point
  217. 12500 '
  218. 12510 ' Function 25 - Get User Alternate Interrupt Address
  219. 12520 '
  220. 12530 M1%=25
  221. 12540 GOTO 10140            ' Common mouse library entry point
  222. 12600 '
  223. 12610 ' Function 26 - Set Mouse Sensitivity
  224. 12620 '
  225. 12630 M1%=26
  226. 12640 GOTO 10140            ' Common mouse library entry point
  227. 12700 '
  228. 12710 ' Function 27 - Get Mouse Sensitivity
  229. 12720 '
  230. 12730 M1%=27
  231. 12740 GOTO 10140            ' Common mouse library entry point
  232. 12800 '
  233. 12810 ' Function 28 - Set Mouse Interrupt Rate
  234. 12820 '
  235. 12830 M1%=28
  236. 12840 GOTO 10140            ' Common mouse library entry point
  237. 12900 '
  238. 12910 ' Function 29 - Set CRT Page Number
  239. 12920 '
  240. 12930 M1%=29
  241. 12940 GOTO 10140            ' Common mouse library entry point
  242. 13000 '
  243. 13010 ' Function 30 - Get CRT Page Number
  244. 13020 '
  245. 13030 M1%=30
  246. 13040 GOTO 10140            ' Common mouse library entry point
  247. 13100 '
  248. 13110 ' Function 31 - Disable Mouse Driver
  249. 13120 '
  250. 13130 M1%=31
  251. 13140 GOTO 10140            ' Common mouse library entry point
  252. 13200 '
  253. 13210 ' Function 32 - Enable Mouse Driver
  254. 13220 '
  255. 13230 M1%=32
  256. 13240 GOTO 10140            ' Common mouse library entry point
  257. 13300 '
  258. 13310 ' Function 33 - Software Reset
  259. 13320 '
  260. 13330 M1%=33
  261. 13340 GOTO 10140            ' Common mouse library entry point
  262. 13400 '
  263. 13410 ' Function 34 - Set Language For Messages
  264. 13420 '
  265. 13430 M1%=34
  266. 13440 GOTO 10140            ' Common mouse library entry point
  267. 13500 '
  268. 13510 ' Function 35 - Get Language Number
  269. 13520 '
  270. 13530 M1%=35
  271. 13540 GOTO 10140            ' Common mouse library entry point
  272. 13600 '
  273. 13610 ' Function 36 - Get Driver Version, Mouse Type, and IRQ #
  274. 13620 '
  275. 13630 M1%=36
  276. 13640 GOTO 10140            ' Common mouse library entry point
  277. 13700 '
  278. 13710 ' Function 37 - Set Video Mode Number
  279. 13720 '
  280. 13730 M1%=37
  281. 13740 GOTO 10140            ' Common mouse library entry point
  282. 13800 '
  283. 13810 ' Function 38 - Enumerate Video Mode Numbers
  284. 13820 '
  285. 13830 M1%=38
  286. 13840 GOTO 10140            ' Common mouse library entry point
  287.