Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5412 lines
207 KiB

  1. ; Program: Installable Device Driver for Mouse.
  2. ;
  3. ; Purpose: to provide compatability with the
  4. ; Microsoft MOUSE.SYS device driver.
  5. ; the code here installs the driver and
  6. ; hooks the IVT in exactly the same
  7. ; way as the current Insignia MOUSE.COM.
  8. ;
  9. ; Version: 1.00 Date: 28th October 1992.
  10. ;
  11. ; Author: Andrew Watson
  12. ;
  13. ; Revisions:
  14. ;
  15. ; 23-June-1994 Williamh, made mode 4/5 and 12 work.
  16. ;
  17. ; 12-Sep-1992 Jonle, Merged with ntio.sys
  18. ; optimized loading of IVT
  19. ;
  20. ; 5-March-1993 Andyw, Moved fullscreen text pointer code
  21. ; from 32bit land to 16bit driver for
  22. ; for speed purposes.
  23. ;
  24. ; This obj module is intially loaded in a temporary memory location
  25. ; along with ntio.sys. Ntio.sys will copy the resident code (marked by
  26. ; SpcMseBeg, SpcMseEnd) into the permanent memory location which resides
  27. ; just below the normal device drivers loaded by config.sys.
  28. ;
  29. ; The nonresident intialization code is run with CS= temp seg
  30. ; and DS= final seg.
  31. ;
  32. ;
  33. ;****************************************************************
  34. .286
  35. include vint.inc
  36. ;================================================================
  37. ; Defined constants used in the driver.
  38. ;================================================================
  39. VERSIONID equ 0BEEFh
  40. MAXCMD equ 16
  41. UNKNOWN equ 8003h
  42. DONE equ 0100h
  43. MOUSEVER equ 0003h
  44. INT1_BOP equ 0BAh
  45. INT2_BOP equ 0BBh
  46. IO_LANG_BOP equ 0BCh
  47. IO_INTR_BOP equ 0BDh
  48. VIDEO_IO_BOP equ 0BEh
  49. UNSIMULATE_BOP equ 0FEh
  50. VIDEO equ 010h
  51. UNEXP_BOP equ 2
  52. FORCE_YODA equ 05bh
  53. ANDYS_BOP equ 060h
  54. STACKSIZE equ 200h-1
  55. TRUE equ 0
  56. FALSE equ 1
  57. STORED equ 0
  58. NOTSTORED equ 1
  59. ON equ 0
  60. OFF equ 1
  61. MAJOR_RELEASE_NUMBER equ 6
  62. MINOR_RELEASE_NUMBER equ 26
  63. ;MACROSMACROSMACROSMACROSMACROSMACROSMACROSMACROSMACROSMACROSMACROSMACROSMACROS
  64. bop MACRO callid
  65. db 0c4h,0c4h,callid
  66. endm
  67. ;=============================================================================
  68. ; Macro to reassign the stack segment register to point at the driver code
  69. ; segment and the stack pointer to point to the most significant word in an
  70. ; array reserved as the driver stack.
  71. ;=============================================================================
  72. ;; !!!! interrupt must be disabled before calling this function !!!!!!
  73. make_stack MACRO
  74. LOCAL reent ;; a local symbol to this macro
  75. ;; call DOCLI ;; turn off interrupts during this
  76. ;; macro's execution even if the CPU
  77. ;; does this for you when modifying SS
  78. inc cs:reentrant ;; has the interrupt been nested?
  79. jnz reent ;; not reentrant if == zero
  80. ;; The driver code is not reentrant, so start the stack at the beginning
  81. mov cs:top_of_stack,ss ;; save the entry SS
  82. mov cs:top_of_stack-2,sp ;; save SP on the stack
  83. push cs ;; the current code/data segment
  84. pop ss ;; point SS at CS
  85. ;; point SP at the next free stack location.
  86. mov sp,offset top_of_stack-2 ;; The current stack pointer position
  87. reent: ;; REENTRANT > 0 therefore reentrancy exists
  88. ;; The driver has gone reentrant due to a nested interrupt, so just
  89. ;; leave the stack alone because it is the same under reentrancy.
  90. ;; call DOSTI ;; reenable interrupts
  91. ENDM
  92. ;=============================================================================
  93. ; Macro to return the stack pointer and segment back to what it was when
  94. ; the driver was called.
  95. ;=============================================================================
  96. kill_stack MACRO
  97. LOCAL reent1
  98. ;; cli
  99. cmp cs:reentrant,0 ;; is the code currently reentrant?
  100. jg reent1 ;; yes it is
  101. mov sp,cs:top_of_stack-2 ;; pop SP
  102. mov ss,cs:top_of_stack ;; pop SS
  103. reent1:
  104. dec cs:reentrant ;; reduce the level of reentrancy
  105. ;; call DOSTI
  106. ENDM
  107. ;MACROSMACROSMACROSMACROSMACROSMACROSMACROSMACROSMACROSMACROSMACROSMACROSMACROS
  108. ;
  109. ; Segment definitions for ntio.sys,
  110. ;
  111. include biosseg.inc
  112. SpcMseSeg segment
  113. assume cs:SpcMseSeg, ds:nothing, es:nothing
  114. ;
  115. ; SpcMseBeg - SpcMseEnd
  116. ;
  117. ; Marks the resident code, anything outside of these markers
  118. ; is discarded after intialization
  119. ; 15-Sep-1992 Jonle
  120. ;
  121. public SpcMseBeg
  122. SpcMseBeg label byte
  123. ; CAUTION: for crazy apps mouse recognition
  124. ;
  125. ; The offset for int33h_vector must not be Zero for Borlands QuattroPro
  126. ; The segment must not be in ROM area for pctools
  127. ; to keep the int33h_vector from having an offset of ZERO
  128. ; I have moved the data above it
  129. ; 25-Sep-1992 Jonle
  130. ; describe the default screen and cursor masks
  131. ; remember that x86 machines are little-endian
  132. ;;; include pointer.inc
  133. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  134. ;;;; We'll Get this back to an include file soon but I'm including it like
  135. ;;;; this for 'diplomatic' reasons. (ie I want to check this in without
  136. ;;;; also doing an 'addfile' at this stage)!!! - Simon.
  137. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  138. ; This data will be accessed, on occasion, word by word, so
  139. ; be tidy and align to a word boundary
  140. align 2
  141. ; Describe the default mouse pointer image. This is used if the
  142. ; user decides to switch on the pointer without specifying an image.
  143. default_cursor dw 0011111111111111b
  144. dw 0001111111111111b
  145. dw 0000111111111111b
  146. dw 0000011111111111b
  147. dw 0000001111111111b
  148. dw 0000000111111111b
  149. dw 0000000011111111b
  150. dw 0000000001111111b
  151. dw 0000000000111111b
  152. dw 0000000000011111b
  153. dw 0000000111111111b
  154. dw 0001000011111111b
  155. dw 0011000011111111b
  156. dw 1111100001111111b
  157. dw 1111100001111111b
  158. dw 1111110001111111b
  159. dw 0000000000000000b
  160. dw 0100000000000000b
  161. dw 0110000000000000b
  162. dw 0111000000000000b
  163. dw 0111100000000000b
  164. dw 0111110000000000b
  165. dw 0111111000000000b
  166. dw 0111111100000000b
  167. dw 0111111110000000b
  168. dw 0111110000000000b
  169. dw 0110110000000000b
  170. dw 0100011000000000b
  171. dw 0000011000000000b
  172. dw 0000001100000000b
  173. dw 0000001100000000b
  174. dw 0000000000000000b
  175. ; Set up the memory where the working cursor is situated. It is
  176. ; initialised to the default cursor image
  177. ;****************** ALIGNED FOR PIXEL ZERO *******************************
  178. ; screen mask
  179. even
  180. current_cursor db 00111111b,11111111b,11111111b
  181. db 00011111b,11111111b,11111111b
  182. db 00001111b,11111111b,11111111b
  183. db 00000111b,11111111b,11111111b
  184. db 00000011b,11111111b,11111111b
  185. db 00000001b,11111111b,11111111b
  186. db 00000000b,11111111b,11111111b
  187. db 00000000b,01111111b,11111111b
  188. db 00000000b,00111111b,11111111b
  189. db 00000000b,00011111b,11111111b
  190. db 00000001b,11111111b,11111111b
  191. db 00010000b,11111111b,11111111b
  192. db 00110000b,11111111b,11111111b
  193. db 11111000b,01111111b,11111111b
  194. db 11111000b,01111111b,11111111b
  195. db 11111100b,01111111b,11111111b
  196. ; cursor mask
  197. db 00000000b,00000000b,00000000b
  198. db 01000000b,00000000b,00000000b
  199. db 01100000b,00000000b,00000000b
  200. db 01110000b,00000000b,00000000b
  201. db 01111000b,00000000b,00000000b
  202. db 01111100b,00000000b,00000000b
  203. db 01111110b,00000000b,00000000b
  204. db 01111111b,00000000b,00000000b
  205. db 01111111b,10000000b,00000000b
  206. db 01111111b,11000000b,00000000b
  207. db 01101100b,00000000b,00000000b
  208. db 01000110b,00000000b,00000000b
  209. db 00000110b,00000000b,00000000b
  210. db 00000011b,00000000b,00000000b
  211. db 00000011b,00000000b,00000000b
  212. db 00000000b,00000000b,00000000b
  213. ;****************** ALIGNED FOR PIXEL ONE *******************************
  214. ; screen mask
  215. AlignData1:
  216. db 10011111b,11111111b,11111111b
  217. db 10001111b,11111111b,11111111b
  218. db 10000111b,11111111b,11111111b
  219. db 10000011b,11111111b,11111111b
  220. db 10000001b,11111111b,11111111b
  221. db 10000000b,11111111b,11111111b
  222. db 10000000b,01111111b,11111111b
  223. db 10000000b,00111111b,11111111b
  224. db 10000000b,00011111b,11111111b
  225. db 10000000b,00001111b,11111111b
  226. db 10000000b,11111111b,11111111b
  227. db 10001000b,01111111b,11111111b
  228. db 10011000b,01111111b,11111111b
  229. db 11111100b,00111111b,11111111b
  230. db 11111100b,00111111b,11111111b
  231. db 11111110b,00111111b,11111111b
  232. ; cursor mask
  233. db 00000000b,00000000b,00000000b
  234. db 00100000b,00000000b,00000000b
  235. db 00110000b,00000000b,00000000b
  236. db 00111000b,00000000b,00000000b
  237. db 00111100b,00000000b,00000000b
  238. db 00111110b,00000000b,00000000b
  239. db 00111111b,00000000b,00000000b
  240. db 00111111b,10000000b,00000000b
  241. db 00111111b,11000000b,00000000b
  242. db 00111111b,11100000b,00000000b
  243. db 00110110b,00000000b,00000000b
  244. db 00100011b,00000000b,00000000b
  245. db 00000011b,00000000b,00000000b
  246. db 00000001b,10000000b,00000000b
  247. db 00000001b,10000000b,00000000b
  248. db 00000000b,00000000b,00000000b
  249. ;****************** ALIGNED FOR PIXEL TWO *******************************
  250. ; screen mask
  251. AlignData2:
  252. db 11001111b,11111111b,11111111b
  253. db 11000111b,11111111b,11111111b
  254. db 11000011b,11111111b,11111111b
  255. db 11000001b,11111111b,11111111b
  256. db 11000000b,11111111b,11111111b
  257. db 11000000b,01111111b,11111111b
  258. db 11000000b,00111111b,11111111b
  259. db 11000000b,00011111b,11111111b
  260. db 11000000b,00001111b,11111111b
  261. db 11000000b,00000111b,11111111b
  262. db 11000000b,01111111b,11111111b
  263. db 11000100b,00111111b,11111111b
  264. db 11001100b,00111111b,11111111b
  265. db 11111110b,00011111b,11111111b
  266. db 11111110b,00011111b,11111111b
  267. db 11111111b,00011111b,11111111b
  268. ; cursor mask
  269. db 00000000b,00000000b,00000000b
  270. db 00010000b,00000000b,00000000b
  271. db 00011000b,00000000b,00000000b
  272. db 00011100b,00000000b,00000000b
  273. db 00011110b,00000000b,00000000b
  274. db 00011111b,00000000b,00000000b
  275. db 00011111b,10000000b,00000000b
  276. db 00011111b,11000000b,00000000b
  277. db 00011111b,11100000b,00000000b
  278. db 00011111b,11110000b,00000000b
  279. db 00011011b,00000000b,00000000b
  280. db 00010001b,10000000b,00000000b
  281. db 00000001b,10000000b,00000000b
  282. db 00000000b,11000000b,00000000b
  283. db 00000000b,11000000b,00000000b
  284. db 00000000b,00000000b,00000000b
  285. ;****************** ALIGNED FOR PIXEL THREE *******************************
  286. ; screen mask
  287. AlignData3:
  288. db 11100111b,11111111b,11111111b
  289. db 11100011b,11111111b,11111111b
  290. db 11100001b,11111111b,11111111b
  291. db 11100000b,11111111b,11111111b
  292. db 11100000b,01111111b,11111111b
  293. db 11100000b,00111111b,11111111b
  294. db 11100000b,00011111b,11111111b
  295. db 11100000b,00001111b,11111111b
  296. db 11100000b,00000111b,11111111b
  297. db 11100000b,00000011b,11111111b
  298. db 11100000b,00111111b,11111111b
  299. db 11100010b,00011111b,11111111b
  300. db 11100110b,00011111b,11111111b
  301. db 11111111b,00001111b,11111111b
  302. db 11111111b,00001111b,11111111b
  303. db 11111111b,10001111b,11111111b
  304. ; cursor mask
  305. db 00000000b,00000000b,00000000b
  306. db 00001000b,00000000b,00000000b
  307. db 00001100b,00000000b,00000000b
  308. db 00001110b,00000000b,00000000b
  309. db 00001111b,00000000b,00000000b
  310. db 00001111b,10000000b,00000000b
  311. db 00001111b,11000000b,00000000b
  312. db 00001111b,11100000b,00000000b
  313. db 00001111b,11110000b,00000000b
  314. db 00001111b,11111000b,00000000b
  315. db 00001101b,10000000b,00000000b
  316. db 00001000b,11000000b,00000000b
  317. db 00000000b,11000000b,00000000b
  318. db 00000000b,01100000b,00000000b
  319. db 00000000b,01100000b,00000000b
  320. db 00000000b,00000000b,00000000b
  321. ;****************** ALIGNED FOR PIXEL FOUR *******************************
  322. ; screen mask
  323. AlignData4:
  324. db 11110011b,11111111b,11111111b
  325. db 11110001b,11111111b,11111111b
  326. db 11110000b,11111111b,11111111b
  327. db 11110000b,01111111b,11111111b
  328. db 11110000b,00111111b,11111111b
  329. db 11110000b,00011111b,11111111b
  330. db 11110000b,00001111b,11111111b
  331. db 11110000b,00000111b,11111111b
  332. db 11110000b,00000011b,11111111b
  333. db 11110000b,00000001b,11111111b
  334. db 11110000b,00011111b,11111111b
  335. db 11110001b,00001111b,11111111b
  336. db 11110011b,00001111b,11111111b
  337. db 11111111b,10000111b,11111111b
  338. db 11111111b,10000111b,11111111b
  339. db 11111111b,11000111b,11111111b
  340. ; cursor mask
  341. db 00000000b,00000000b,00000000b
  342. db 00000100b,00000000b,00000000b
  343. db 00000110b,00000000b,00000000b
  344. db 00000111b,00000000b,00000000b
  345. db 00000111b,10000000b,00000000b
  346. db 00000111b,11000000b,00000000b
  347. db 00000111b,11100000b,00000000b
  348. db 00000111b,11110000b,00000000b
  349. db 00000111b,11111000b,00000000b
  350. db 00000111b,11111100b,00000000b
  351. db 00000110b,11000000b,00000000b
  352. db 00000100b,01100000b,00000000b
  353. db 00000000b,01100000b,00000000b
  354. db 00000000b,00110000b,00000000b
  355. db 00000000b,00110000b,00000000b
  356. db 00000000b,00000000b,00000000b
  357. ;****************** ALIGNED FOR PIXEL FIVE *******************************
  358. ; screen mask
  359. AlignData5:
  360. db 11111001b,11111111b,11111111b
  361. db 11111000b,11111111b,11111111b
  362. db 11111000b,01111111b,11111111b
  363. db 11111000b,00111111b,11111111b
  364. db 11111000b,00011111b,11111111b
  365. db 11111000b,00001111b,11111111b
  366. db 11111000b,00000111b,11111111b
  367. db 11111000b,00000011b,11111111b
  368. db 11111000b,00000001b,11111111b
  369. db 11111000b,00000000b,11111111b
  370. db 11111000b,00001111b,11111111b
  371. db 11111000b,10000111b,11111111b
  372. db 11111001b,10000111b,11111111b
  373. db 11111111b,11000011b,11111111b
  374. db 11111111b,11000011b,11111111b
  375. db 11111111b,11100011b,11111111b
  376. ; cursor mask
  377. db 00000000b,00000000b,00000000b
  378. db 00000010b,00000000b,00000000b
  379. db 00000011b,00000000b,00000000b
  380. db 00000011b,10000000b,00000000b
  381. db 00000011b,11000000b,00000000b
  382. db 00000011b,11100000b,00000000b
  383. db 00000011b,11110000b,00000000b
  384. db 00000011b,11111000b,00000000b
  385. db 00000011b,11111100b,00000000b
  386. db 00000011b,11111110b,00000000b
  387. db 00000011b,01100000b,00000000b
  388. db 00000010b,00110000b,00000000b
  389. db 00000000b,00110000b,00000000b
  390. db 00000000b,00011000b,00000000b
  391. db 00000000b,00011000b,00000000b
  392. db 00000000b,00000000b,00000000b
  393. ;****************** ALIGNED FOR PIXEL SIX *******************************
  394. ; screen mask
  395. AlignData6:
  396. db 11111100b,11111111b,11111111b
  397. db 11111100b,01111111b,11111111b
  398. db 11111100b,00111111b,11111111b
  399. db 11111100b,00011111b,11111111b
  400. db 11111100b,00001111b,11111111b
  401. db 11111100b,00000111b,11111111b
  402. db 11111100b,00000011b,11111111b
  403. db 11111100b,00000001b,11111111b
  404. db 11111100b,00000000b,11111111b
  405. db 11111100b,00000000b,01111111b
  406. db 11111100b,00000111b,11111111b
  407. db 11111100b,01000011b,11111111b
  408. db 11111100b,11000011b,11111111b
  409. db 11111111b,11100001b,11111111b
  410. db 11111111b,11100001b,11111111b
  411. db 11111111b,11110001b,11111111b
  412. ; cursor mask
  413. db 00000000b,00000000b,00000000b
  414. db 00000001b,00000000b,00000000b
  415. db 00000001b,10000000b,00000000b
  416. db 00000001b,11000000b,00000000b
  417. db 00000001b,11100000b,00000000b
  418. db 00000001b,11110000b,00000000b
  419. db 00000001b,11111000b,00000000b
  420. db 00000001b,11111100b,00000000b
  421. db 00000001b,11111110b,00000000b
  422. db 00000001b,11111111b,00000000b
  423. db 00000001b,10110000b,00000000b
  424. db 00000001b,00011000b,00000000b
  425. db 00000000b,00011000b,00000000b
  426. db 00000000b,00001100b,00000000b
  427. db 00000000b,00001100b,00000000b
  428. db 00000000b,00000000b,00000000b
  429. ;****************** ALIGNED FOR PIXEL SEVEN *******************************
  430. ; screen mask
  431. AlignData7:
  432. db 11111110b,01111111b,11111111b
  433. db 11111110b,00111111b,11111111b
  434. db 11111110b,00011111b,11111111b
  435. db 11111110b,00001111b,11111111b
  436. db 11111110b,00000111b,11111111b
  437. db 11111110b,00000011b,11111111b
  438. db 11111110b,00000001b,11111111b
  439. db 11111110b,00000000b,11111111b
  440. db 11111110b,00000000b,01111111b
  441. db 11111110b,00000000b,00111111b
  442. db 11111110b,00000011b,11111111b
  443. db 11111110b,00100001b,11111111b
  444. db 11111110b,01100001b,11111111b
  445. db 11111111b,11110000b,11111111b
  446. db 11111111b,11110000b,11111111b
  447. db 11111111b,11111000b,11111111b
  448. ; cursor mask
  449. db 00000000b,00000000b,00000000b
  450. db 00000000b,10000000b,00000000b
  451. db 00000000b,11000000b,00000000b
  452. db 00000000b,11100000b,00000000b
  453. db 00000000b,11110000b,00000000b
  454. db 00000000b,11111000b,00000000b
  455. db 00000000b,11111100b,00000000b
  456. db 00000000b,11111110b,00000000b
  457. db 00000000b,11111111b,00000000b
  458. db 00000000b,11111111b,10000000b
  459. db 00000000b,11011000b,00000000b
  460. db 00000000b,10001100b,00000000b
  461. db 00000000b,00001100b,00000000b
  462. db 00000000b,00000110b,00000000b
  463. db 00000000b,00000110b,00000000b
  464. db 00000000b,00000000b,00000000b
  465. ; Data area reserved for the clipped cursor images. When the pointer
  466. ; reaches byte 78 in the current raster, the image needs to be clipped
  467. ; to prevent it from being wrapped to the left hand edge of the screen.
  468. ; The image below stops that from happening by loading the image with
  469. ; a 1's partial AND mask and a 0's partial XOR mask.
  470. ; Note that byte 79 also needs a clipped image set.
  471. even
  472. clip_cursor78 db 00111111b,11111111b,11111111b
  473. db 00011111b,11111111b,11111111b
  474. db 00001111b,11111111b,11111111b
  475. db 00000111b,11111111b,11111111b
  476. db 00000011b,11111111b,11111111b
  477. db 00000001b,11111111b,11111111b
  478. db 00000000b,11111111b,11111111b
  479. db 00000000b,01111111b,11111111b
  480. db 00000000b,00111111b,11111111b
  481. db 00000000b,00011111b,11111111b
  482. db 00000001b,11111111b,11111111b
  483. db 00010000b,11111111b,11111111b
  484. db 00110000b,11111111b,11111111b
  485. db 11111000b,01111111b,11111111b
  486. db 11111000b,01111111b,11111111b
  487. db 11111100b,01111111b,11111111b
  488. ; cursor mask
  489. db 00000000b,00000000b,00000000b
  490. db 01000000b,00000000b,00000000b
  491. db 01100000b,00000000b,00000000b
  492. db 01110000b,00000000b,00000000b
  493. db 01111000b,00000000b,00000000b
  494. db 01111100b,00000000b,00000000b
  495. db 01111110b,00000000b,00000000b
  496. db 01111111b,00000000b,00000000b
  497. db 01111111b,10000000b,00000000b
  498. db 01111111b,11000000b,00000000b
  499. db 01101100b,00000000b,00000000b
  500. db 01000110b,00000000b,00000000b
  501. db 00000110b,00000000b,00000000b
  502. db 00000011b,00000000b,00000000b
  503. db 00000011b,00000000b,00000000b
  504. db 00000000b,00000000b,00000000b
  505. ;****************** ALIGNED FOR PIXEL ONE *******************************
  506. ; screen mask
  507. AlignClip178:
  508. db 10011111b,11111111b,11111111b
  509. db 10001111b,11111111b,11111111b
  510. db 10000111b,11111111b,11111111b
  511. db 10000011b,11111111b,11111111b
  512. db 10000001b,11111111b,11111111b
  513. db 10000000b,11111111b,11111111b
  514. db 10000000b,01111111b,11111111b
  515. db 10000000b,00111111b,11111111b
  516. db 10000000b,00011111b,11111111b
  517. db 10000000b,00001111b,11111111b
  518. db 10000000b,11111111b,11111111b
  519. db 10001000b,01111111b,11111111b
  520. db 10011000b,01111111b,11111111b
  521. db 11111100b,00111111b,11111111b
  522. db 11111100b,00111111b,11111111b
  523. db 11111110b,00111111b,11111111b
  524. ; cursor mask
  525. db 00000000b,00000000b,00000000b
  526. db 00100000b,00000000b,00000000b
  527. db 00110000b,00000000b,00000000b
  528. db 00111000b,00000000b,00000000b
  529. db 00111100b,00000000b,00000000b
  530. db 00111110b,00000000b,00000000b
  531. db 00111111b,00000000b,00000000b
  532. db 00111111b,10000000b,00000000b
  533. db 00111111b,11000000b,00000000b
  534. db 00111111b,11100000b,00000000b
  535. db 00110110b,00000000b,00000000b
  536. db 00100011b,00000000b,00000000b
  537. db 00000011b,00000000b,00000000b
  538. db 00000001b,10000000b,00000000b
  539. db 00000001b,10000000b,00000000b
  540. db 00000000b,00000000b,00000000b
  541. ;****************** ALIGNED FOR PIXEL TWO *******************************
  542. ; screen mask
  543. AlignClip278:
  544. db 11001111b,11111111b,11111111b
  545. db 11000111b,11111111b,11111111b
  546. db 11000011b,11111111b,11111111b
  547. db 11000001b,11111111b,11111111b
  548. db 11000000b,11111111b,11111111b
  549. db 11000000b,01111111b,11111111b
  550. db 11000000b,00111111b,11111111b
  551. db 11000000b,00011111b,11111111b
  552. db 11000000b,00001111b,11111111b
  553. db 11000000b,00000111b,11111111b
  554. db 11000000b,01111111b,11111111b
  555. db 11000100b,00111111b,11111111b
  556. db 11001100b,00111111b,11111111b
  557. db 11111110b,00011111b,11111111b
  558. db 11111110b,00011111b,11111111b
  559. db 11111111b,00011111b,11111111b
  560. ; cursor mask
  561. db 00000000b,00000000b,00000000b
  562. db 00010000b,00000000b,00000000b
  563. db 00011000b,00000000b,00000000b
  564. db 00011100b,00000000b,00000000b
  565. db 00011110b,00000000b,00000000b
  566. db 00011111b,00000000b,00000000b
  567. db 00011111b,10000000b,00000000b
  568. db 00011111b,11000000b,00000000b
  569. db 00011111b,11100000b,00000000b
  570. db 00011111b,11110000b,00000000b
  571. db 00011011b,00000000b,00000000b
  572. db 00010001b,10000000b,00000000b
  573. db 00000001b,10000000b,00000000b
  574. db 00000000b,11000000b,00000000b
  575. db 00000000b,11000000b,00000000b
  576. db 00000000b,00000000b,00000000b
  577. ;****************** ALIGNED FOR PIXEL THREE *******************************
  578. ; screen mask
  579. AlignClip378:
  580. db 11100111b,11111111b,11111111b
  581. db 11100011b,11111111b,11111111b
  582. db 11100001b,11111111b,11111111b
  583. db 11100000b,11111111b,11111111b
  584. db 11100000b,01111111b,11111111b
  585. db 11100000b,00111111b,11111111b
  586. db 11100000b,00011111b,11111111b
  587. db 11100000b,00001111b,11111111b
  588. db 11100000b,00000111b,11111111b
  589. db 11100000b,00000011b,11111111b
  590. db 11100000b,00111111b,11111111b
  591. db 11100010b,00011111b,11111111b
  592. db 11100110b,00011111b,11111111b
  593. db 11111111b,00001111b,11111111b
  594. db 11111111b,00001111b,11111111b
  595. db 11111111b,10001111b,11111111b
  596. ; cursor mask
  597. db 00000000b,00000000b,00000000b
  598. db 00001000b,00000000b,00000000b
  599. db 00001100b,00000000b,00000000b
  600. db 00001110b,00000000b,00000000b
  601. db 00001111b,00000000b,00000000b
  602. db 00001111b,10000000b,00000000b
  603. db 00001111b,11000000b,00000000b
  604. db 00001111b,11100000b,00000000b
  605. db 00001111b,11110000b,00000000b
  606. db 00001111b,11111000b,00000000b
  607. db 00001101b,10000000b,00000000b
  608. db 00001000b,11000000b,00000000b
  609. db 00000000b,11000000b,00000000b
  610. db 00000000b,01100000b,00000000b
  611. db 00000000b,01100000b,00000000b
  612. db 00000000b,00000000b,00000000b
  613. ;****************** ALIGNED FOR PIXEL FOUR *******************************
  614. ; screen mask
  615. AlignClip478:
  616. db 11110011b,11111111b,11111111b
  617. db 11110001b,11111111b,11111111b
  618. db 11110000b,11111111b,11111111b
  619. db 11110000b,01111111b,11111111b
  620. db 11110000b,00111111b,11111111b
  621. db 11110000b,00011111b,11111111b
  622. db 11110000b,00001111b,11111111b
  623. db 11110000b,00000111b,11111111b
  624. db 11110000b,00000011b,11111111b
  625. db 11110000b,00000001b,11111111b
  626. db 11110000b,00011111b,11111111b
  627. db 11110001b,00001111b,11111111b
  628. db 11110011b,00001111b,11111111b
  629. db 11111111b,10000111b,11111111b
  630. db 11111111b,10000111b,11111111b
  631. db 11111111b,11000111b,11111111b
  632. ; cursor mask
  633. db 00000000b,00000000b,00000000b
  634. db 00000100b,00000000b,00000000b
  635. db 00000110b,00000000b,00000000b
  636. db 00000111b,00000000b,00000000b
  637. db 00000111b,10000000b,00000000b
  638. db 00000111b,11000000b,00000000b
  639. db 00000111b,11100000b,00000000b
  640. db 00000111b,11110000b,00000000b
  641. db 00000111b,11111000b,00000000b
  642. db 00000111b,11111100b,00000000b
  643. db 00000110b,11000000b,00000000b
  644. db 00000100b,01100000b,00000000b
  645. db 00000000b,01100000b,00000000b
  646. db 00000000b,00110000b,00000000b
  647. db 00000000b,00110000b,00000000b
  648. db 00000000b,00000000b,00000000b
  649. ;****************** ALIGNED FOR PIXEL FIVE *******************************
  650. ; screen mask
  651. AlignClip578:
  652. db 11111001b,11111111b,11111111b
  653. db 11111000b,11111111b,11111111b
  654. db 11111000b,01111111b,11111111b
  655. db 11111000b,00111111b,11111111b
  656. db 11111000b,00011111b,11111111b
  657. db 11111000b,00001111b,11111111b
  658. db 11111000b,00000111b,11111111b
  659. db 11111000b,00000011b,11111111b
  660. db 11111000b,00000001b,11111111b
  661. db 11111000b,00000000b,11111111b
  662. db 11111000b,00001111b,11111111b
  663. db 11111000b,10000111b,11111111b
  664. db 11111001b,10000111b,11111111b
  665. db 11111111b,11000011b,11111111b
  666. db 11111111b,11000011b,11111111b
  667. db 11111111b,11100011b,11111111b
  668. ; cursor mask
  669. db 00000000b,00000000b,00000000b
  670. db 00000010b,00000000b,00000000b
  671. db 00000011b,00000000b,00000000b
  672. db 00000011b,10000000b,00000000b
  673. db 00000011b,11000000b,00000000b
  674. db 00000011b,11100000b,00000000b
  675. db 00000011b,11110000b,00000000b
  676. db 00000011b,11111000b,00000000b
  677. db 00000011b,11111100b,00000000b
  678. db 00000011b,11111110b,00000000b
  679. db 00000011b,01100000b,00000000b
  680. db 00000010b,00110000b,00000000b
  681. db 00000000b,00110000b,00000000b
  682. db 00000000b,00011000b,00000000b
  683. db 00000000b,00011000b,00000000b
  684. db 00000000b,00000000b,00000000b
  685. ;****************** ALIGNED FOR PIXEL SIX *******************************
  686. ; screen mask
  687. AlignClip678:
  688. db 11111100b,11111111b,11111111b
  689. db 11111100b,01111111b,11111111b
  690. db 11111100b,00111111b,11111111b
  691. db 11111100b,00011111b,11111111b
  692. db 11111100b,00001111b,11111111b
  693. db 11111100b,00000111b,11111111b
  694. db 11111100b,00000011b,11111111b
  695. db 11111100b,00000001b,11111111b
  696. db 11111100b,00000000b,11111111b
  697. db 11111100b,00000000b,11111111b
  698. db 11111100b,00000111b,11111111b
  699. db 11111100b,01000011b,11111111b
  700. db 11111100b,11000011b,11111111b
  701. db 11111111b,11100001b,11111111b
  702. db 11111111b,11100001b,11111111b
  703. db 11111111b,11110001b,11111111b
  704. ; cursor mask
  705. db 00000000b,00000000b,00000000b
  706. db 00000001b,00000000b,00000000b
  707. db 00000001b,10000000b,00000000b
  708. db 00000001b,11000000b,00000000b
  709. db 00000001b,11100000b,00000000b
  710. db 00000001b,11110000b,00000000b
  711. db 00000001b,11111000b,00000000b
  712. db 00000001b,11111100b,00000000b
  713. db 00000001b,11111110b,00000000b
  714. db 00000001b,11111111b,00000000b
  715. db 00000001b,10110000b,00000000b
  716. db 00000001b,00011000b,00000000b
  717. db 00000000b,00011000b,00000000b
  718. db 00000000b,00001100b,00000000b
  719. db 00000000b,00001100b,00000000b
  720. db 00000000b,00000000b,00000000b
  721. ;****************** ALIGNED FOR PIXEL SEVEN *******************************
  722. ; screen mask
  723. AlignClip778:
  724. db 11111110b,01111111b,11111111b
  725. db 11111110b,00111111b,11111111b
  726. db 11111110b,00011111b,11111111b
  727. db 11111110b,00001111b,11111111b
  728. db 11111110b,00000111b,11111111b
  729. db 11111110b,00000011b,11111111b
  730. db 11111110b,00000001b,11111111b
  731. db 11111110b,00000000b,11111111b
  732. db 11111110b,00000000b,11111111b
  733. db 11111110b,00000000b,11111111b
  734. db 11111110b,00000011b,11111111b
  735. db 11111110b,00100001b,11111111b
  736. db 11111110b,01100001b,11111111b
  737. db 11111111b,11110000b,11111111b
  738. db 11111111b,11110000b,11111111b
  739. db 11111111b,11111000b,11111111b
  740. ; cursor mask
  741. db 00000000b,00000000b,00000000b
  742. db 00000000b,10000000b,00000000b
  743. db 00000000b,11000000b,00000000b
  744. db 00000000b,11100000b,00000000b
  745. db 00000000b,11110000b,00000000b
  746. db 00000000b,11111000b,00000000b
  747. db 00000000b,11111100b,00000000b
  748. db 00000000b,11111110b,00000000b
  749. db 00000000b,11111111b,00000000b
  750. db 00000000b,11111111b,00000000b
  751. db 00000000b,11011000b,00000000b
  752. db 00000000b,10001100b,00000000b
  753. db 00000000b,00001100b,00000000b
  754. db 00000000b,00000110b,00000000b
  755. db 00000000b,00000110b,00000000b
  756. db 00000000b,00000000b,00000000b
  757. clip_cursor79 db 00111111b,11111111b,11111111b
  758. db 00011111b,11111111b,11111111b
  759. db 00001111b,11111111b,11111111b
  760. db 00000111b,11111111b,11111111b
  761. db 00000011b,11111111b,11111111b
  762. db 00000001b,11111111b,11111111b
  763. db 00000000b,11111111b,11111111b
  764. db 00000000b,11111111b,11111111b
  765. db 00000000b,11111111b,11111111b
  766. db 00000000b,11111111b,11111111b
  767. db 00000001b,11111111b,11111111b
  768. db 00010000b,11111111b,11111111b
  769. db 00110000b,11111111b,11111111b
  770. db 11111000b,01111111b,11111111b
  771. db 11111000b,01111111b,11111111b
  772. db 11111100b,01111111b,11111111b
  773. ; cursor mask
  774. db 00000000b,00000000b,00000000b
  775. db 01000000b,00000000b,00000000b
  776. db 01100000b,00000000b,00000000b
  777. db 01110000b,00000000b,00000000b
  778. db 01111000b,00000000b,00000000b
  779. db 01111100b,00000000b,00000000b
  780. db 01111110b,00000000b,00000000b
  781. db 01111111b,00000000b,00000000b
  782. db 01111111b,00000000b,00000000b
  783. db 01111111b,00000000b,00000000b
  784. db 01101100b,00000000b,00000000b
  785. db 01000110b,00000000b,00000000b
  786. db 00000110b,00000000b,00000000b
  787. db 00000011b,00000000b,00000000b
  788. db 00000011b,00000000b,00000000b
  789. db 00000000b,00000000b,00000000b
  790. ;****************** ALIGNED FOR PIXEL ONE *******************************
  791. ; screen mask
  792. AlignClip179:
  793. db 10011111b,11111111b,11111111b
  794. db 10001111b,11111111b,11111111b
  795. db 10000111b,11111111b,11111111b
  796. db 10000011b,11111111b,11111111b
  797. db 10000001b,11111111b,11111111b
  798. db 10000000b,11111111b,11111111b
  799. db 10000000b,11111111b,11111111b
  800. db 10000000b,11111111b,11111111b
  801. db 10000000b,11111111b,11111111b
  802. db 10000000b,11111111b,11111111b
  803. db 10000000b,11111111b,11111111b
  804. db 10001000b,11111111b,11111111b
  805. db 10011000b,11111111b,11111111b
  806. db 11111100b,11111111b,11111111b
  807. db 11111100b,11111111b,11111111b
  808. db 11111110b,11111111b,11111111b
  809. ; cursor mask
  810. db 00000000b,00000000b,00000000b
  811. db 00100000b,00000000b,00000000b
  812. db 00110000b,00000000b,00000000b
  813. db 00111000b,00000000b,00000000b
  814. db 00111100b,00000000b,00000000b
  815. db 00111110b,00000000b,00000000b
  816. db 00111111b,00000000b,00000000b
  817. db 00111111b,00000000b,00000000b
  818. db 00111111b,00000000b,00000000b
  819. db 00111111b,00000000b,00000000b
  820. db 00110110b,00000000b,00000000b
  821. db 00100011b,00000000b,00000000b
  822. db 00000011b,00000000b,00000000b
  823. db 00000001b,00000000b,00000000b
  824. db 00000001b,00000000b,00000000b
  825. db 00000000b,00000000b,00000000b
  826. ;****************** ALIGNED FOR PIXEL TWO *******************************
  827. ; screen mask
  828. AlignClip279:
  829. db 11001111b,11111111b,11111111b
  830. db 11000111b,11111111b,11111111b
  831. db 11000011b,11111111b,11111111b
  832. db 11000001b,11111111b,11111111b
  833. db 11000000b,11111111b,11111111b
  834. db 11000000b,11111111b,11111111b
  835. db 11000000b,11111111b,11111111b
  836. db 11000000b,11111111b,11111111b
  837. db 11000000b,11111111b,11111111b
  838. db 11000000b,11111111b,11111111b
  839. db 11000000b,11111111b,11111111b
  840. db 11000100b,11111111b,11111111b
  841. db 11001100b,11111111b,11111111b
  842. db 11111110b,11111111b,11111111b
  843. db 11111110b,11111111b,11111111b
  844. db 11111111b,11111111b,11111111b
  845. ; cursor mask
  846. db 00000000b,00000000b,00000000b
  847. db 00010000b,00000000b,00000000b
  848. db 00011000b,00000000b,00000000b
  849. db 00011100b,00000000b,00000000b
  850. db 00011110b,00000000b,00000000b
  851. db 00011111b,00000000b,00000000b
  852. db 00011111b,00000000b,00000000b
  853. db 00011111b,00000000b,00000000b
  854. db 00011111b,00000000b,00000000b
  855. db 00011111b,00000000b,00000000b
  856. db 00011011b,00000000b,00000000b
  857. db 00010001b,00000000b,00000000b
  858. db 00000001b,00000000b,00000000b
  859. db 00000000b,00000000b,00000000b
  860. db 00000000b,00000000b,00000000b
  861. db 00000000b,00000000b,00000000b
  862. ;****************** ALIGNED FOR PIXEL THREE *******************************
  863. ; screen mask
  864. AlignClip379:
  865. db 11100111b,11111111b,11111111b
  866. db 11100011b,11111111b,11111111b
  867. db 11100001b,11111111b,11111111b
  868. db 11100000b,11111111b,11111111b
  869. db 11100000b,11111111b,11111111b
  870. db 11100000b,11111111b,11111111b
  871. db 11100000b,11111111b,11111111b
  872. db 11100000b,11111111b,11111111b
  873. db 11100000b,11111111b,11111111b
  874. db 11100000b,11111111b,11111111b
  875. db 11100000b,11111111b,11111111b
  876. db 11100010b,11111111b,11111111b
  877. db 11100110b,11111111b,11111111b
  878. db 11111111b,11111111b,11111111b
  879. db 11111111b,11111111b,11111111b
  880. db 11111111b,11111111b,11111111b
  881. ; cursor mask
  882. db 00000000b,00000000b,00000000b
  883. db 00001000b,00000000b,00000000b
  884. db 00001100b,00000000b,00000000b
  885. db 00001110b,00000000b,00000000b
  886. db 00001111b,00000000b,00000000b
  887. db 00001111b,00000000b,00000000b
  888. db 00001111b,00000000b,00000000b
  889. db 00001111b,00000000b,00000000b
  890. db 00001111b,00000000b,00000000b
  891. db 00001111b,00000000b,00000000b
  892. db 00001101b,00000000b,00000000b
  893. db 00001000b,00000000b,00000000b
  894. db 00000000b,00000000b,00000000b
  895. db 00000000b,00000000b,00000000b
  896. db 00000000b,00000000b,00000000b
  897. db 00000000b,00000000b,00000000b
  898. ;****************** ALIGNED FOR PIXEL FOUR *******************************
  899. ; screen mask
  900. AlignClip479:
  901. db 11110011b,11111111b,11111111b
  902. db 11110001b,11111111b,11111111b
  903. db 11110000b,11111111b,11111111b
  904. db 11110000b,11111111b,11111111b
  905. db 11110000b,11111111b,11111111b
  906. db 11110000b,11111111b,11111111b
  907. db 11110000b,11111111b,11111111b
  908. db 11110000b,11111111b,11111111b
  909. db 11110000b,11111111b,11111111b
  910. db 11110000b,11111111b,11111111b
  911. db 11110000b,11111111b,11111111b
  912. db 11110001b,11111111b,11111111b
  913. db 11110011b,11111111b,11111111b
  914. db 11111111b,11111111b,11111111b
  915. db 11111111b,11111111b,11111111b
  916. db 11111111b,11111111b,11111111b
  917. ; cursor mask
  918. db 00000000b,00000000b,00000000b
  919. db 00000100b,00000000b,00000000b
  920. db 00000110b,00000000b,00000000b
  921. db 00000111b,00000000b,00000000b
  922. db 00000111b,00000000b,00000000b
  923. db 00000111b,00000000b,00000000b
  924. db 00000111b,00000000b,00000000b
  925. db 00000111b,00000000b,00000000b
  926. db 00000111b,00000000b,00000000b
  927. db 00000111b,00000000b,00000000b
  928. db 00000110b,00000000b,00000000b
  929. db 00000100b,00000000b,00000000b
  930. db 00000000b,00000000b,00000000b
  931. db 00000000b,00000000b,00000000b
  932. db 00000000b,00000000b,00000000b
  933. db 00000000b,00000000b,00000000b
  934. ;****************** ALIGNED FOR PIXEL FIVE *******************************
  935. ; screen mask
  936. AlignClip579:
  937. db 11111001b,11111111b,11111111b
  938. db 11111000b,11111111b,11111111b
  939. db 11111000b,11111111b,11111111b
  940. db 11111000b,11111111b,11111111b
  941. db 11111000b,11111111b,11111111b
  942. db 11111000b,11111111b,11111111b
  943. db 11111000b,11111111b,11111111b
  944. db 11111000b,11111111b,11111111b
  945. db 11111000b,11111111b,11111111b
  946. db 11111000b,11111111b,11111111b
  947. db 11111000b,11111111b,11111111b
  948. db 11111000b,11111111b,11111111b
  949. db 11111001b,11111111b,11111111b
  950. db 11111111b,11111111b,11111111b
  951. db 11111111b,11111111b,11111111b
  952. db 11111111b,11111111b,11111111b
  953. ; cursor mask
  954. db 00000000b,00000000b,00000000b
  955. db 00000010b,00000000b,00000000b
  956. db 00000011b,00000000b,00000000b
  957. db 00000011b,00000000b,00000000b
  958. db 00000011b,00000000b,00000000b
  959. db 00000011b,00000000b,00000000b
  960. db 00000011b,00000000b,00000000b
  961. db 00000011b,00000000b,00000000b
  962. db 00000011b,00000000b,00000000b
  963. db 00000011b,00000000b,00000000b
  964. db 00000011b,00000000b,00000000b
  965. db 00000010b,00000000b,00000000b
  966. db 00000000b,00000000b,00000000b
  967. db 00000000b,00000000b,00000000b
  968. db 00000000b,00000000b,00000000b
  969. db 00000000b,00000000b,00000000b
  970. ;****************** ALIGNED FOR PIXEL SIX *******************************
  971. ; screen mask
  972. AlignClip679:
  973. db 11111100b,11111111b,11111111b
  974. db 11111100b,11111111b,11111111b
  975. db 11111100b,11111111b,11111111b
  976. db 11111100b,11111111b,11111111b
  977. db 11111100b,11111111b,11111111b
  978. db 11111100b,11111111b,11111111b
  979. db 11111100b,11111111b,11111111b
  980. db 11111100b,11111111b,11111111b
  981. db 11111100b,11111111b,11111111b
  982. db 11111100b,11111111b,11111111b
  983. db 11111100b,11111111b,11111111b
  984. db 11111100b,11111111b,11111111b
  985. db 11111100b,11111111b,11111111b
  986. db 11111111b,11111111b,11111111b
  987. db 11111111b,11111111b,11111111b
  988. db 11111111b,11111111b,11111111b
  989. ; cursor mask
  990. db 00000000b,00000000b,00000000b
  991. db 00000001b,00000000b,00000000b
  992. db 00000001b,00000000b,00000000b
  993. db 00000001b,00000000b,00000000b
  994. db 00000001b,00000000b,00000000b
  995. db 00000001b,00000000b,00000000b
  996. db 00000001b,00000000b,00000000b
  997. db 00000001b,00000000b,00000000b
  998. db 00000001b,00000000b,00000000b
  999. db 00000001b,00000000b,00000000b
  1000. db 00000001b,00000000b,00000000b
  1001. db 00000001b,00000000b,00000000b
  1002. db 00000000b,00000000b,00000000b
  1003. db 00000000b,00000000b,00000000b
  1004. db 00000000b,00000000b,00000000b
  1005. db 00000000b,00000000b,00000000b
  1006. ;****************** ALIGNED FOR PIXEL SEVEN *******************************
  1007. ; screen mask
  1008. AlignClip779:
  1009. db 11111110b,11111111b,11111111b
  1010. db 11111110b,11111111b,11111111b
  1011. db 11111110b,11111111b,11111111b
  1012. db 11111110b,11111111b,11111111b
  1013. db 11111110b,11111111b,11111111b
  1014. db 11111110b,11111111b,11111111b
  1015. db 11111110b,11111111b,11111111b
  1016. db 11111110b,11111111b,11111111b
  1017. db 11111110b,11111111b,11111111b
  1018. db 11111110b,11111111b,11111111b
  1019. db 11111110b,11111111b,11111111b
  1020. db 11111110b,11111111b,11111111b
  1021. db 11111110b,11111111b,11111111b
  1022. db 11111111b,11111111b,11111111b
  1023. db 11111111b,11111111b,11111111b
  1024. db 11111111b,11111111b,11111111b
  1025. ; cursor mask
  1026. db 00000000b,00000000b,00000000b
  1027. db 00000000b,00000000b,00000000b
  1028. db 00000000b,00000000b,00000000b
  1029. db 00000000b,00000000b,00000000b
  1030. db 00000000b,00000000b,00000000b
  1031. db 00000000b,00000000b,00000000b
  1032. db 00000000b,00000000b,00000000b
  1033. db 00000000b,00000000b,00000000b
  1034. db 00000000b,00000000b,00000000b
  1035. db 00000000b,00000000b,00000000b
  1036. db 00000000b,00000000b,00000000b
  1037. db 00000000b,00000000b,00000000b
  1038. db 00000000b,00000000b,00000000b
  1039. db 00000000b,00000000b,00000000b
  1040. db 00000000b,00000000b,00000000b
  1041. db 00000000b,00000000b,00000000b
  1042. CursorOffsetLUT dw current_cursor
  1043. dw AlignData1
  1044. dw AlignData2
  1045. dw AlignData3
  1046. dw AlignData4
  1047. dw AlignData5
  1048. dw AlignData6
  1049. dw AlignData7
  1050. ClipOffsetLUT78 dw clip_cursor78
  1051. dw AlignClip178
  1052. dw AlignClip278
  1053. dw AlignClip378
  1054. dw AlignClip478
  1055. dw AlignClip578
  1056. dw AlignClip678
  1057. dw AlignClip778
  1058. ClipOffsetLUT79 dw clip_cursor79
  1059. dw AlignClip179
  1060. dw AlignClip279
  1061. dw AlignClip379
  1062. dw AlignClip479
  1063. dw AlignClip579
  1064. dw AlignClip679
  1065. dw AlignClip779
  1066. ; pointer to the current look up table set for the pointer image.
  1067. ; The LUTs are swapped when the pointer enters bytes 78 and 79
  1068. ; along a scanline to prevent the pointer wrapping around the screen.
  1069. PointerLUT label word
  1070. dw offset CursorOffsetLUT
  1071. ;;;;;;;;;;;;;;;;;;;;;;;
  1072. ;;;; End of what should be an include for pointer.inc
  1073. ;;;;;;;;;;;;;;;;;;;;;;;
  1074. even
  1075. clrgend dw 06e41h,07964h,05720h,07461h,06f73h,0f36eh
  1076. hiresylut dw 350,350,480,480
  1077. ;============================================================================
  1078. ; Surprisingly, a look up table multiply is much faster than
  1079. ; the shift - add instruction sequence for multiplying by 80.
  1080. ; So it would be silly not to use it eh? Times by 80 is needed
  1081. ; to convert a raster location (1 raster = 80 bytes) in pixel
  1082. ; y coordinates into a video buffer byte index
  1083. ; Note: Multiply by 80 is also used for text mode calculations
  1084. ; now! Andy on the 9/3/93
  1085. ;============================================================================
  1086. even
  1087. mult80lut label word
  1088. mulsum=0
  1089. REPT 480 ; number of VGA scanlines for mode 12h
  1090. dw mulsum
  1091. mulsum=mulsum+80
  1092. ENDM
  1093. ;============================================================================
  1094. ; A table to do a multiply by 320. This is used for converting number of
  1095. ; rasters into video buffer offsets for mode 13h (256 VGA colour mode).
  1096. ;============================================================================
  1097. even
  1098. mult320lut label word
  1099. mulsum=0
  1100. REPT 200 ; number of VGA scanlines for mode 13h
  1101. dw mulsum
  1102. mulsum=mulsum+320
  1103. ENDM
  1104. even
  1105. ;============================================================================
  1106. ; Look up table for use with modes 10h and 12h. This table provides the means
  1107. ; for the selection of a clipped or unclipped pointer image depending on the
  1108. ; current x position of the pointer.
  1109. ;============================================================================
  1110. ChooseImageLUT label word
  1111. REPT 624
  1112. dw offset CursorOffsetLUT
  1113. ENDM
  1114. REPT 8
  1115. dw offset ClipOffsetLUT78
  1116. ENDM
  1117. REPT 8
  1118. dw offset ClipOffsetLUT79
  1119. ENDM
  1120. ;============================================================================
  1121. ; Buffer arranged for 4 plane EGA video modes. The screen where
  1122. ; the pointer is going to be drawn is scanned plane by plane and
  1123. ; saved as bitplane separations.
  1124. ;============================================================================
  1125. even ; make sure that this data is word aligned
  1126. behindcursor dw 24 dup(?) ; Plane 0
  1127. dw 24 dup(?) ; Plane 1
  1128. dw 24 dup(?) ; Plane 2
  1129. dw 24 dup(?) ; Plane 3
  1130. ;============================================================================
  1131. ; a table of the video buffer segment for the supported
  1132. ; BIOS text and graphics modes.
  1133. ;============================================================================
  1134. even ; make sure that this data is word aligned
  1135. videomodetable dw 0b800h,0b800h ; modes 0,1
  1136. dw 0b800h,0b800h ; modes 2,3
  1137. dw 0b800h,0b800h ; modes 4,5
  1138. dw 0b800h,0b000h ; modes 6,7
  1139. dw 0ffffh,0ffffh ; n/a
  1140. dw 0ffffh,0ffffh ; n/a
  1141. dw 0ffffh,0a000h ; n/a,mode 0dh
  1142. dw 0a000h,0a000h ; modes 0eh,0fh
  1143. dw 0a000h,0a000h ; modes 10h,11h
  1144. dw 0a000h,0a000h ; modes 12h,13h
  1145. videobufferseg dw ?
  1146. even ; make sure that this data is word aligned
  1147. hotspot dw 2 dup(0)
  1148. VRAMlasttextcelloff label word ; last text offset in VRAM
  1149. VRAMlastbyteoff dw ? ; Last offset in VRAM
  1150. VRAMlastbitoff dw ? ; LSB: Where pointer is in byte
  1151. ; MSB: ODD/EVEN of the pointer
  1152. ; first scan line
  1153. LastXCounters dw ? ; last X looping counter
  1154. LastYCounters dw ? ; last Y looping counter
  1155. ; ODD in LSB and EVEN in MSB
  1156. lasttextimage dw ? ; text cell from last time
  1157. background dw NOTSTORED ; STORED if data in buffer
  1158. current_position_x dw ?
  1159. current_position_y dw ?
  1160. vidbytealigned dw ?
  1161. lastmaskrotate dw ?
  1162. lastvidmode db 0ffh ; the video mode during the last int.
  1163. internalCF db 0ffh ; the mouse driver keeps a flag called
  1164. ; the internal cursor flag. If the flag
  1165. ; = 0, then int 33h f1 will display the
  1166. ; pointer, -1 = default value.
  1167. ; 32 bit code writes to this area on a hardware interrupt and
  1168. ; when an app does an int 33h function 3, it reads the data
  1169. ; directly from here.
  1170. ; Data format is: word 0 -> button status
  1171. ; word 1 -> x virtual coordinate
  1172. ; word 2 -> y virtual coordinate
  1173. function3data dw 3 dup(?)
  1174. conditional_off db 0 ;!= 0 if conditional off is on
  1175. ;
  1176. ;=============================================================================
  1177. ; Data to determine the address of where the latches should be saved in the
  1178. ; video buffer for the current video mode.
  1179. ; latchcache contains the value looked up by saveVGAregisters and used by
  1180. ; restoreVGAregisters.
  1181. ;=============================================================================
  1182. latchcache dw ? ; location of latch cache in VRAM
  1183. even
  1184. latchhomeLUT label word
  1185. dw ? ; mode 0
  1186. dw ? ; mode 1
  1187. dw ? ; mode 2
  1188. dw ? ; mode 3
  1189. dw ? ; mode 4
  1190. dw ? ; mode 5
  1191. dw ? ; mode 6
  1192. dw ? ; mode 7
  1193. dw ? ; mode 8
  1194. dw ? ; mode 9
  1195. dw ? ; mode a
  1196. dw ? ; mode b
  1197. dw ? ; mode c
  1198. dw ? ; mode d
  1199. dw 80*200+78 ; mode e
  1200. dw 80*350+78 ; mode f
  1201. dw 80*350+78 ; mode 10
  1202. dw 80*480+78 ; mode 11
  1203. dw 80*480+78 ; mode 12
  1204. ;=============================================================================
  1205. ; CGA video mode 4 is a 2 bit per pixel graphics mode. The pointer images
  1206. ; received from the application (or the default images for that matter) are
  1207. ; described by a one bit per pixel map. This look up table provides the means
  1208. ; of conversion from one to two bits per pixel.
  1209. ;=============================================================================
  1210. even
  1211. LUT1to2bit label word
  1212. dw 00000h,00003h,0000Ch,0000Fh,00030h,00033h,0003Ch,0003Fh
  1213. dw 000C0h,000C3h,000CCh,000CFh,000F0h,000F3h,000FCh,000FFh
  1214. dw 00300h,00303h,0030Ch,0030Fh,00330h,00333h,0033Ch,0033Fh
  1215. dw 003C0h,003C3h,003CCh,003CFh,003F0h,003F3h,003FCh,003FFh
  1216. dw 00C00h,00C03h,00C0Ch,00C0Fh,00C30h,00C33h,00C3Ch,00C3Fh
  1217. dw 00CC0h,00CC3h,00CCCh,00CCFh,00CF0h,00CF3h,00CFCh,00CFFh
  1218. dw 00F00h,00F03h,00F0Ch,00F0Fh,00F30h,00F33h,00F3Ch,00F3Fh
  1219. dw 00FC0h,00FC3h,00FCCh,00FCFh,00FF0h,00FF3h,00FFCh,00FFFh
  1220. dw 03000h,03003h,0300Ch,0300Fh,03030h,03033h,0303Ch,0303Fh
  1221. dw 030C0h,030C3h,030CCh,030CFh,030F0h,030F3h,030FCh,030FFh
  1222. dw 03300h,03303h,0330Ch,0330Fh,03330h,03333h,0333Ch,0333Fh
  1223. dw 033C0h,033C3h,033CCh,033CFh,033F0h,033F3h,033FCh,033FFh
  1224. dw 03C00h,03C03h,03C0Ch,03C0Fh,03C30h,03C33h,03C3Ch,03C3Fh
  1225. dw 03CC0h,03CC3h,03CCCh,03CCFh,03CF0h,03CF3h,03CFCh,03CFFh
  1226. dw 03F00h,03F03h,03F0Ch,03F0Fh,03F30h,03F33h,03F3Ch,03F3Fh
  1227. dw 03FC0h,03FC3h,03FCCh,03FCFh,03FF0h,03FF3h,03FFCh,03FFFh
  1228. dw 0C000h,0C003h,0C00Ch,0C00Fh,0C030h,0C033h,0C03Ch,0C03Fh
  1229. dw 0C0C0h,0C0C3h,0C0CCh,0C0CFh,0C0F0h,0C0F3h,0C0FCh,0C0FFh
  1230. dw 0C300h,0C303h,0C30Ch,0C30Fh,0C330h,0C333h,0C33Ch,0C33Fh
  1231. dw 0C3C0h,0C3C3h,0C3CCh,0C3CFh,0C3F0h,0C3F3h,0C3FCh,0C3FFh
  1232. dw 0CC00h,0CC03h,0CC0Ch,0CC0Fh,0CC30h,0CC33h,0CC3Ch,0CC3Fh
  1233. dw 0CCC0h,0CCC3h,0CCCCh,0CCCFh,0CCF0h,0CCF3h,0CCFCh,0CCFFh
  1234. dw 0CF00h,0CF03h,0CF0Ch,0CF0Fh,0CF30h,0CF33h,0CF3Ch,0CF3Fh
  1235. dw 0CFC0h,0CFC3h,0CFCCh,0CFCFh,0CFF0h,0CFF3h,0CFFCh,0CFFFh
  1236. dw 0F000h,0F003h,0F00Ch,0F00Fh,0F030h,0F033h,0F03Ch,0F03Fh
  1237. dw 0F0C0h,0F0C3h,0F0CCh,0F0CFh,0F0F0h,0F0F3h,0F0FCh,0F0FFh
  1238. dw 0F300h,0F303h,0F30Ch,0F30Fh,0F330h,0F333h,0F33Ch,0F33Fh
  1239. dw 0F3C0h,0F3C3h,0F3CCh,0F3CFh,0F3F0h,0F3F3h,0F3FCh,0F3FFh
  1240. dw 0FC00h,0FC03h,0FC0Ch,0FC0Fh,0FC30h,0FC33h,0FC3Ch,0FC3Fh
  1241. dw 0FCC0h,0FCC3h,0FCCCh,0FCCFh,0FCF0h,0FCF3h,0FCFCh,0FCFFh
  1242. dw 0FF00h,0FF03h,0FF0Ch,0FF0Fh,0FF30h,0FF33h,0FF3Ch,0FF3Fh
  1243. dw 0FFC0h,0FFC3h,0FFCCh,0FFCFh,0FFF0h,0FFF3h,0FFFCh,0FFFFh
  1244. ;============================================================================
  1245. ; Table for selection of the correct pointer image for the current location
  1246. ; in the video buffer, when using video BIOS mode 4.
  1247. ;============================================================================
  1248. mode4pointerLUT label word
  1249. REPT 76 ; for the first 76 bytes of scanline, use these
  1250. dw current_cursor
  1251. dw AlignData1
  1252. dw AlignData2
  1253. dw AlignData3
  1254. ENDM
  1255. dw clip_cursor78
  1256. dw AlignClip178
  1257. dw AlignClip278
  1258. dw AlignClip378
  1259. dw AlignClip478
  1260. dw AlignClip578
  1261. dw AlignClip678
  1262. dw AlignClip778
  1263. dw clip_cursor79
  1264. dw AlignClip179
  1265. dw AlignClip279
  1266. dw AlignClip379
  1267. dw AlignClip479
  1268. dw AlignClip579
  1269. dw AlignClip679
  1270. dw AlignClip779
  1271. ;============================================================================
  1272. ; Look up table to adjust CX on clipping in mode 4. This allows the mode4
  1273. ; pointer drawing algorithm to use the modes 10h/12h clipped pointer data
  1274. ; without having to modify it. The problem is that mode 10/12 expects the
  1275. ; data to be 4 bits per pixel and aligned to a word, whereas mode 4 is 2 bits
  1276. ; per pixel and aligns to a byte.
  1277. ;============================================================================
  1278. mode4clipCXadjustLUT label word
  1279. adjtemp=0 ; data for pixel x-coordinates 0 -> 307
  1280. REPT 77
  1281. dw 4 dup(adjtemp)
  1282. adjtemp=adjtemp+1
  1283. ENDM
  1284. dw 4 dup(76) ; data for pixels 308 -> 311
  1285. dw 8 dup(78) ; data for pixels 312 -> 319
  1286. ;============================================================================
  1287. ; The CGA buffer is split at 2000h. Therefore if the pointer starts writing
  1288. ; below scanline 199 on the video display, the odd scanline video buffer
  1289. ; will become corrupted. In these cases, the pointer should be clipped to
  1290. ; display scanline 199. The look up table below maps loop counters to a
  1291. ; display scanline for this purpose.
  1292. ;
  1293. ; table arrangement (odd scanline data, even scanline data)
  1294. ;
  1295. ;============================================================================
  1296. mode4clipDXLUT label word
  1297. db 200-15 dup(8,8) ; scanlines 0 -> 184
  1298. db 8,7 ; scanline 185
  1299. db 7,7 ; scanline 186
  1300. db 7,6 ; scanline 187
  1301. db 6,6 ; scanline 188
  1302. db 6,5 ; scanline 189
  1303. db 5,5 ; scanline 190
  1304. db 5,4 ; scanline 191
  1305. db 4,4 ; scanline 192
  1306. db 4,3 ; scanline 193
  1307. db 3,3 ; scanline 194
  1308. db 3,2 ; scanline 195
  1309. db 2,2 ; scanline 196
  1310. db 2,1 ; scanline 197
  1311. db 1,1 ; scanline 198
  1312. db 1,0 ; scanline 199
  1313. mode4SelectedPointer label word
  1314. dw ?
  1315. ;==========================================================================
  1316. ; Some space into which the Medium resolution graphics pointer background
  1317. ; gets stored. Note that the 256 colour mode buffer encroaches on that of
  1318. ; mode 4.
  1319. ;==========================================================================
  1320. bkgrnd256 label byte ; 256 colour buffer = 24*16 @ 1 byte/pix
  1321. db 384-64 dup(?) ; share the CGA buffer(=64 bytes)
  1322. CGAbackgrnd label byte
  1323. db 24/4*16 dup(?) ; 24 pixels/row @ 4 pixels/byte for 16
  1324. ; rows.
  1325. ;===========================================================================
  1326. ; Jump table to redirect the code flow according to the current video mode.
  1327. ; Used in the 32 bit entry point procedure.
  1328. ; Pointer drawing routines.
  1329. ;===========================================================================
  1330. even
  1331. drawpointerJMPT label word
  1332. dw offset not_supported ; mode 0
  1333. dw offset not_supported ; mode 1
  1334. IFDEF SIXTEENBIT
  1335. dw offset drawTextPointer ; mode 2
  1336. dw offset drawTextPointer ; mode 3
  1337. ELSE
  1338. dw offset not_supported ; mode 2
  1339. dw offset not_supported ; mode 3
  1340. ENDIF
  1341. dw offset drawMediumResPointer ; mode 4
  1342. dw offset drawMediumResPointer ; mode 5
  1343. dw offset not_supported ; mode 6
  1344. IFDEF SIXTEENBIT
  1345. dw offset drawTextPointer ; mode 7
  1346. ELSE
  1347. dw offset not_supported ; mode 7
  1348. ENDIF
  1349. dw offset not_supported ; mode 8
  1350. dw offset not_supported ; mode 9
  1351. dw offset not_supported ; mode a
  1352. dw offset not_supported ; mode b
  1353. dw offset not_supported ; mode c
  1354. dw offset not_supported ; mode d
  1355. dw offset not_supported ; mode e
  1356. dw offset drawHiResPointer ; mode f
  1357. dw offset drawHiResPointer ; mode 10
  1358. dw offset drawHiResPointer ; mode 11
  1359. dw offset drawHiResPointer ; mode 12
  1360. dw offset drawC256pointer ; mode 13
  1361. ;===========================================================================
  1362. ; Jump table to redirect the code flow according to the current video mode.
  1363. ; Used in the 32 bit entry point procedure.
  1364. ; INT 33h Function 1 support modules.
  1365. ;===========================================================================
  1366. even
  1367. int33function1JMPT label word
  1368. dw offset not_supported ; mode 0
  1369. dw offset not_supported ; mode 1
  1370. IFDEF SIXTEENBIT
  1371. dw offset TextInt33Function1 ; mode 2
  1372. dw offset TextInt33Function1 ; mode 3
  1373. ELSE
  1374. dw offset not_supported ; mode 2
  1375. dw offset not_supported ; mode 3
  1376. ENDIF
  1377. dw offset MediumResInt33Function1 ; mode 4
  1378. dw offset MediumResInt33Function1 ; mode 5
  1379. dw offset not_supported ; mode 6
  1380. IFDEF SIXTEENBIT
  1381. dw offset TextInt33Function1 ; mode 7
  1382. ELSE
  1383. dw offset not_supported ; mode 7
  1384. ENDIF
  1385. dw offset not_supported ; mode 8
  1386. dw offset not_supported ; mode 9
  1387. dw offset not_supported ; mode a
  1388. dw offset not_supported ; mode b
  1389. dw offset not_supported ; mode c
  1390. dw offset not_supported ; mode d
  1391. dw offset not_supported ; mode e
  1392. dw offset HiResInt33Function1 ; mode f
  1393. dw offset HiResInt33Function1 ; mode 10
  1394. dw offset HiResInt33Function1 ; mode 11
  1395. dw offset HiResInt33Function1 ; mode 12
  1396. dw offset C256Int33Function1 ; mode 13
  1397. ;===========================================================================
  1398. ; Jump table to redirect the code flow according to the current video mode.
  1399. ; Used in the 32 bit entry point procedure.
  1400. ; INT 33h Function 2 support modules.
  1401. ;===========================================================================
  1402. even
  1403. int33function2JMPT label word
  1404. dw offset not_supported ; mode 0
  1405. dw offset not_supported ; mode 1
  1406. IFDEF SIXTEENBIT
  1407. dw offset TextInt33Function2 ; mode 2
  1408. dw offset TextInt33Function2 ; mode 3
  1409. ELSE
  1410. dw offset not_supported ; mode 2
  1411. dw offset not_supported ; mode 3
  1412. ENDIF
  1413. dw offset MediumResInt33Function2 ; mode 4
  1414. dw offset MediumResInt33Function2 ; mode 5
  1415. dw offset not_supported ; mode 6
  1416. IFDEF SIXTEENBIT
  1417. dw offset TextInt33Function2 ; mode 7
  1418. ELSE
  1419. dw offset not_supported ; mode 7
  1420. ENDIF
  1421. dw offset not_supported ; mode 8
  1422. dw offset not_supported ; mode 9
  1423. dw offset not_supported ; mode a
  1424. dw offset not_supported ; mode b
  1425. dw offset not_supported ; mode c
  1426. dw offset not_supported ; mode d
  1427. dw offset not_supported ; mode e
  1428. dw offset HiResInt33Function2 ; mode f
  1429. dw offset HiResInt33Function2 ; mode 10
  1430. dw offset HiResInt33Function2 ; mode 11
  1431. dw offset HiResInt33Function2 ; mode 12
  1432. dw offset C256Int33Function2 ; mode 13
  1433. ;==========================================================================
  1434. ; Some storage space for the critical VGA registers.
  1435. ;==========================================================================
  1436. ;Sequencer Registers
  1437. seqregs label byte
  1438. db 4 dup(?) ; N.B. sequencer reset reg doesn't
  1439. ; get saved.
  1440. ; Graphics Controller Registers
  1441. GCregs label byte
  1442. db 9 dup(?)
  1443. ;==========================================================================
  1444. ; The mouse driver's very own stack. To prevent unnecessary tears,
  1445. ; particulary from the application running in DOS land, a stack is
  1446. ; maintained by the driver. This prevents the driver routines from
  1447. ; blowing a very full stack elsewhere.
  1448. ; N.B. on leaving the driver, the stack should be empty!
  1449. ;==========================================================================
  1450. even
  1451. mouse_stack dw STACKSIZE dup(?)
  1452. top_of_stack label word
  1453. dw ? ; this is where the stack starts
  1454. ;===========================================================================
  1455. ; The memory variable below is incremented on entry to the 16 bit code
  1456. ; and on exit, decremented. If an interrupt occurs during the execution of
  1457. ; this 16 bit code, the flag is incremented again, and thus greater than zero
  1458. ; so it is known that the code has been reentered and the stack must be
  1459. ; maintained accordingly.
  1460. ;===========================================================================
  1461. reentrant dw -1
  1462. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1463. ;
  1464. ; END OF DATA
  1465. ;
  1466. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1467. ;================================================================
  1468. ; code to redirect the flow of control from the segment:offset for
  1469. ; the mouse interrupt (33h) as indicated in the IVT (the IVT entry
  1470. ; has been set to point to here) to the Insignia mouse driver code.
  1471. ;================================================================
  1472. int33h_vector:
  1473. jmp short skip
  1474. ; High level language entry point.
  1475. lvector db 0EAh ; far jump opcode
  1476. loffset dw ? ; destination offset
  1477. lseg dw ? ; destination segment
  1478. ; The pointer set to our interrupt 33h handler
  1479. skip:
  1480. ;
  1481. ; Let's just jump to the C mouse_io_interrupt code for
  1482. ; RISC and bypass the ROM like 4.0 does.
  1483. ;
  1484. bop 0BDh
  1485. iret
  1486. db 0EAh ; far jump opcode
  1487. moff dw ? ; will be filled in by the driver code from the IVT
  1488. mseg dw ? ; as before
  1489. DOCLI:
  1490. FCLI
  1491. ret
  1492. DOSTI:
  1493. FSTI
  1494. ret
  1495. DOIRET:
  1496. FIRET
  1497. ;================================================================
  1498. ; Functions moved out of ROM - real ROMS mapped in
  1499. ;================================================================
  1500. unexp_int:
  1501. bop UNEXP_BOP
  1502. jmp DOIRET
  1503. mouse_io:
  1504. ;
  1505. ; INT 33h entry point
  1506. ;
  1507. jmp mio_hack
  1508. nop
  1509. mouse_io_lang: ; entry point for HLL
  1510. pushf ; check ASAP if redundant show/hide cursor
  1511. push di ; save di,
  1512. mov di, [di+14] ; get first parameter (mouse function),
  1513. ; then duplicate mio_hack below.
  1514. ; this has to be done to preserve
  1515. ; compatibility between both ways to
  1516. ; call the mouse.
  1517. jz lbop ; F0
  1518. cmp di,2
  1519. jg lbop ; >F2
  1520. je miol_2
  1521. miol_1:
  1522. mov conditional_off, 0 ; disable conditonal off
  1523. cmp [internalCF],0 ; is the flag already zero?
  1524. je miol_12_quit ; if so, do nothing
  1525. inc [internalCF] ; increment it
  1526. jz lbop
  1527. miol_12_quit:
  1528. pop di
  1529. popf
  1530. jmp DOIRET
  1531. miol_2:
  1532. dec [internalCF] ; decrement the pointer internal flag
  1533. cmp [internalCF], 0ffh; currently displayed?
  1534. jne miol_12_quit
  1535. lbop:
  1536. pop ax
  1537. popf
  1538. bop IO_LANG_BOP
  1539. retf 8
  1540. mio_hack: ; int 33h handler
  1541. pushf ; save up the flags
  1542. cmp ax,1 ; mouse show cursor.
  1543. je mio_1
  1544. cmp ax,2 ; mouse hide cursor.
  1545. je mio_2
  1546. cmp ax,3 ; get button status and mouse position.
  1547. je mio_3
  1548. cmp ax,9 ; set graphics cursor
  1549. je mio_9
  1550. cmp ax,10 ; set text cursor - not supported
  1551. je mio_quit ; return straight back to app.
  1552. jmp short hack1bop ; none of the above, so goto 32 bit land
  1553. mio_1:
  1554. mov conditional_off, 0 ; disable conditional off
  1555. cmp [internalCF],0 ; is the flag already zero?
  1556. je mio_quit ; if so, do nothing
  1557. inc [internalCF] ; increment it
  1558. jz hack1bop ; just turned zero, so turn pointer on
  1559. ; via the 32 bit code.
  1560. mio_quit:
  1561. popf
  1562. jmp DOIRET
  1563. mio_2:
  1564. dec [internalCF] ; decrement the pointer internal flag
  1565. cmp [internalCF], 0ffh; currently displayed?
  1566. jne mio_quit ; Already turned off, so quit
  1567. hack1bop:
  1568. popf
  1569. bop IO_INTR_BOP ; BOP to the 32 bit part of the handler
  1570. jmp DOIRET ; return back after the BOP to caller
  1571. mio_9:
  1572. call int33function9 ; change the shape of the graphics pointer
  1573. popf ; restore the flag state
  1574. jmp DOIRET ; back to the caller
  1575. mio_3:
  1576. mov bx,[function3data] ; return button status
  1577. mov cx,[function3data+2] ; return x coordinate
  1578. mov dx,[function3data+4] ; return x coordinate
  1579. popf ; return back to the application
  1580. jmp DOIRET ; via an iret.
  1581. IFDEF MOUSE_VIDEO_BIOS
  1582. mouse_video_io:
  1583. pushf
  1584. or ah,ah
  1585. jne mvio1
  1586. jmp do_bop
  1587. mvio1:
  1588. cmp ax,6f05h
  1589. jne mvio2
  1590. jmp do_bop
  1591. mvio2:
  1592. cmp ah,4
  1593. jne mvio3
  1594. jmp do_bop
  1595. mvio3:
  1596. ;=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  1597. ; Microsoft EGA.LIB function support
  1598. ; input: AH = the function required
  1599. cmp ah,0f0h ; is function F0 or greater?
  1600. jge mvio4 ; YES, so check to see if less than or == F7
  1601. jmp go_rom ; NO, so do rom stuff
  1602. mvio4:
  1603. cmp ah,0f7h ; is it greater than F7
  1604. jg mvio5 ; YES, so test for == FA
  1605. jmp ega_lib ; NO, but in range F0 to F7, so do EGALIB emm
  1606. mvio5:
  1607. cmp ah,0fah
  1608. jne mvio6
  1609. jmp egaFA
  1610. mvio6:
  1611. jmp go_rom
  1612. ; to get here, must want to do mouse video functions 0f0h to 0f7h or
  1613. ; function 0fah.
  1614. jmp ega_lib
  1615. ; data area for EGA.LIB function support
  1616. ; Notice that the sequencer register buffer only has space
  1617. ; for four entrys even though it actually has five addressable
  1618. ; registers. The Sequencer RESET status is not stored, so the buffer
  1619. ; is arranged thus:
  1620. ; buffer offset 0 1 2 3
  1621. ; register index 1 2 3 4
  1622. ;
  1623. even
  1624. ega_current_crtc db 25 dup(?) ; driver's copy of CRTC regs
  1625. ega_current_seq db 4 dup(?) ; driver's copy of Seq regs
  1626. ega_current_graph db 9 dup(?) ; driver's copy of GC regs
  1627. ega_current_attr db 20 dup(?) ; driver's copy of AC regs
  1628. ega_current_misc db ? ; driver's copy of misc reg
  1629. dirty_crtc db 25 dup(?)
  1630. dirty_seq db 4 dup(?)
  1631. dirty_graph db 9 dup(?)
  1632. dirty_attr db 20 dup(?)
  1633. ega_default_crtc db 25 dup(?) ; default EGA register values
  1634. ega_default_seq db 4 dup(?) ; as set by the application
  1635. ega_default_graph db 9 dup(?) ; through a call to F7
  1636. ega_default_attr db 20 dup(?)
  1637. ega_default_misc db ?
  1638. relnum label word
  1639. release_major db MAJOR_RELEASE_NUMBER
  1640. release_minor db MINOR_RELEASE_NUMBER
  1641. even
  1642. egalibjmp label word ; crafty jump table to replace a base
  1643. ; switch
  1644. dw egaF0 ; 0F0h - read one EGA register
  1645. dw egaF1 ; 0F1h - write one EGA register
  1646. dw egaF2 ; 0F2h - read register range
  1647. dw egaF3 ; 0F3h - write register range
  1648. dw egaF4 ; 0F4h - read register set
  1649. dw egaF5 ; 0F5h - write register set
  1650. dw egaF6 ; 0F6h - revert to default regs
  1651. dw egaF7 ; 0F7h - define deflt reg table
  1652. dw noint ; 0F8h is not a valid function
  1653. dw noint ; 0F9h is not a valid function
  1654. dw egaFA ; 0FAh - interrogate driver
  1655. ega_lib:
  1656. xor al,al
  1657. sub ax,0f0h ; create a jump table index
  1658. shl ax,1 ; remember that a word pointer is reqd
  1659. mov si,ax
  1660. jmp [egalibjmp+si] ; get the relavent jump address
  1661. egaF0: ;--- Read an EGA register ----------------------------------------------
  1662. pusha
  1663. and bx,0ffh ; just want the lower byte (BL)
  1664. F00:
  1665. cmp dx,0
  1666. jne F08
  1667. mov bl,byte ptr [ega_current_crtc+bx]
  1668. popa
  1669. jmp noint
  1670. F08:
  1671. cmp dx,8
  1672. jne F010
  1673. dec bx ; note that RESET is not stored
  1674. mov bl,byte ptr [ega_current_seq+bx]
  1675. popa
  1676. jmp noint
  1677. F010:
  1678. cmp dx,010h
  1679. jne F018
  1680. mov bl,byte ptr [ega_current_graph+bx]
  1681. popa
  1682. jmp noint
  1683. F018:
  1684. cmp dx,018h
  1685. jne F020
  1686. mov bl,byte ptr [ega_current_attr+bx]
  1687. popa
  1688. jmp noint
  1689. F020:
  1690. cmp dx,020h
  1691. jne F028
  1692. mov bl,byte ptr [ega_current_misc]
  1693. F028: ; do nothing for this case
  1694. F0quit:
  1695. popa
  1696. jmp noint
  1697. egaF1: ;--- Write an EGA register --------------------------------------------
  1698. F10:
  1699. pusha
  1700. cmp dx,0
  1701. jne F18
  1702. mov dx,03d4h ; write to the CRTC index register
  1703. mov ax,bx ; values to write to ports 3d4/3d5
  1704. out dx,ax ; do the write
  1705. mov di,bx ; save the written values to memory
  1706. and di,0ffh ; get just the lower 8 bits
  1707. mov byte ptr [ega_current_crtc+di],bh
  1708. mov byte ptr [dirty_crtc+di],1
  1709. popa
  1710. jmp noint
  1711. F18:
  1712. cmp dx,8
  1713. jne F110
  1714. mov dx,03c4h ; write to the Sequencer index register
  1715. mov ax,bx ; values to write to ports 3c4/3c5
  1716. out dx,ax ; do the write
  1717. cmp bl,0 ; Cannot index reset because it its
  1718. jle F18bra1 ; not stored. range = 1->4
  1719. and bx,0ffh ; just want BL
  1720. dec bx ; actually, one less than that
  1721. mov byte ptr [ega_current_seq+bx],ah
  1722. mov byte ptr [dirty_seq+bx],1
  1723. F18bra1:
  1724. popa
  1725. jmp noint
  1726. F110:
  1727. cmp dx,010h
  1728. jne F118
  1729. mov dx,03ceh ; write to the Graphics controller
  1730. mov ax,bx ; values to write to ports 3ce/3cf
  1731. out dx,ax ; do the write
  1732. mov di,bx ; save the written values to memory
  1733. and di,0ffh ; get just the lower 8 bits
  1734. mov byte ptr [ega_current_graph+di],bh
  1735. mov byte ptr [dirty_graph+di],1
  1736. popa
  1737. jmp noint
  1738. F118:
  1739. cmp dx,018h
  1740. jne F120
  1741. mov dx,03dah ; clear attribute controller index
  1742. in al,dx ; the read clears this register
  1743. mov ax,bx ; need to write BX to the ports
  1744. mov dx,03c0h ; Attribute Controller index register
  1745. out dx,ax ; do the write
  1746. inc dx
  1747. mov al,020h ; EGA palette enable
  1748. out dx,al ; enable the palette
  1749. mov di,bx ; save the written values to memory
  1750. and di,0ffh ; get just the lower 8 bits
  1751. mov byte ptr [ega_current_graph+di],bh
  1752. mov byte ptr [dirty_graph+di],1
  1753. popa
  1754. jmp noint
  1755. F120:
  1756. cmp dx,020h
  1757. jne F128
  1758. mov dx,03c2h ; EGA miscellaneous register
  1759. mov al,bl
  1760. out dx,al ; write to the register
  1761. mov [ega_current_misc],bl
  1762. popa
  1763. jmp noint
  1764. F128:
  1765. cmp dx,028h
  1766. jne F128
  1767. mov dx,03dah ; EGA feature register
  1768. mov al,bl
  1769. out dx,al
  1770. F1quit:
  1771. popa
  1772. jmp noint
  1773. egaF2: ;--- Read a register range ---------------------------------------------
  1774. pusha
  1775. cmp dx,0
  1776. jne F28
  1777. F20:
  1778. lea si,ega_current_crtc ; get the address of this buffer
  1779. mov dx,cx ; save this value
  1780. xchg ch,cl ; create an index with CH
  1781. and cx,0ffh ; only need CH (now CL)
  1782. add si,cx ; SOURCE adjust the address
  1783. xor dh,dh ; only want the old CL value
  1784. mov cx,dx ; restore CX
  1785. mov di,bx ; DESTINATION got from the application
  1786. rep movsb ; copy to the app's register block
  1787. popa
  1788. jmp noint
  1789. F28:
  1790. cmp dx,8
  1791. jne F210
  1792. lea si,ega_current_seq ; get the address of this buffer
  1793. mov dx,cx ; save this value
  1794. xchg ch,cl ; create an index with CH
  1795. and cx,0ffh ; only need CH (now CL)
  1796. dec cx ; RESET is not stored, so index-1
  1797. add si,cx ; SOURCE adjust the address
  1798. xor dh,dh ; only want the old CL value
  1799. mov cx,dx ; restore CX
  1800. mov di,bx ; DESTINATION got from the application
  1801. rep movsb ; copy to the app's register block
  1802. popa
  1803. jmp noint
  1804. F210:
  1805. cmp dx,010h
  1806. jne F218
  1807. lea si,ega_current_graph ; get the address of this buffer
  1808. mov dx,cx ; save this value
  1809. xchg ch,cl ; create an index with CH
  1810. and cx,0ffh ; only need CH (now CL)
  1811. add si,cx ; SOURCE adjust the address
  1812. xor dh,dh ; only want the old CL value
  1813. mov cx,dx ; restore CX
  1814. mov di,bx ; DESTINATION got from the application
  1815. rep movsb ; copy to the app's register block
  1816. popa
  1817. jmp noint
  1818. F218:
  1819. cmp dx,018h
  1820. jne F2quit
  1821. lea si,ega_current_attr ; get the address of this buffer
  1822. mov dx,cx ; save this value
  1823. xchg ch,cl ; create an index with CH
  1824. and cx,0ffh ; only need CH (now CL)
  1825. add si,cx ; SOURCE adjust the address
  1826. xor dh,dh ; only want the old CL value
  1827. mov cx,dx ; restore CX
  1828. mov di,bx ; DESTINATION got from the application
  1829. rep movsb ; copy the application's register block
  1830. F2quit:
  1831. popa
  1832. jmp noint
  1833. egaF3: ;--- Write a register range to the EGA adapter ------------------------
  1834. pusha
  1835. push ds
  1836. push es
  1837. F31:
  1838. cmp dx,0
  1839. jne F38
  1840. lea di,ega_current_crtc ; write the application data here
  1841. mov al,ch ; adjust the write position as required
  1842. cbw
  1843. add di,ax ; DESTINATION specified address
  1844. mov si,bx ; SOURCE from the application
  1845. lea bx,dirty_crtc ; need to write some data into here
  1846. add bx,ax ; well, at this offset anyway
  1847. mov ax,es ; The application is the source
  1848. mov ds,ax ; so point to its segment
  1849. mov dx,03d4h ; CRTC index register
  1850. mov ah,ch ; CRTC register to start at
  1851. xor ch,ch ; CX is now the loop counter
  1852. assume ds:nothing
  1853. F31cp:
  1854. mov byte ptr cs:[bx],1 ; fill in the dirty_crtc array
  1855. inc bx
  1856. movsb ; get the value from the app to write
  1857. ; and write to the internal buffer
  1858. out dx,ax ; write to the EGA adapter
  1859. loop F31cp
  1860. jmp F3quit
  1861. F38:
  1862. cmp dx,8
  1863. jne F310
  1864. lea di,ega_current_seq ; write the application data here
  1865. mov al,ch ; adjust the write position as required
  1866. cbw
  1867. add di,ax ; DESTINATION specified address
  1868. dec di ; RESET is not stored, so index-1
  1869. mov si,bx ; SOURCE from the application
  1870. lea bx,dirty_seq ; need to write some data into here
  1871. add bx,ax ; well, at this offset anyway
  1872. inc bx
  1873. mov ax,es ; The application is the source
  1874. mov ds,ax ; so point to its segment
  1875. mov dx,03c4h ; Sequencer index register
  1876. mov ah,ch ; Sequencer register to start at
  1877. inc ah
  1878. xor ch,ch ; CX is now the loop counter
  1879. assume ds:nothing
  1880. F38cp:
  1881. mov byte ptr cs:[bx],1 ; fill in the dirty_seq array
  1882. inc bx
  1883. movsb ; get the value from the app to write
  1884. ; and write to the internal buffer
  1885. out dx,ax ; write to the EGA adapter
  1886. loop F38cp
  1887. assume ds:SpcMseSeg
  1888. jmp F3quit
  1889. F310:
  1890. cmp dx,010h
  1891. jne F318
  1892. lea di,ega_current_graph ; write the application data here
  1893. mov al,ch ; adjust the write position as required
  1894. cbw
  1895. add di,ax ; DESTINATION specified address
  1896. mov si,bx ; SOURCE from the application
  1897. lea bx,dirty_graph ; need to write some data into here
  1898. add bx,ax ; well, at this offset anyway
  1899. mov ax,es ; The application is the source
  1900. mov ds,ax ; so point to its segment
  1901. mov dx,03ceh ; Graphics Controller index register
  1902. mov ah,ch ; GC register to start at
  1903. xor ch,ch ; CX is now the loop counter
  1904. assume ds:nothing
  1905. F310cp:
  1906. mov byte ptr cs:[bx],1 ; fill in the dirty_graph array
  1907. inc bx
  1908. movsb ; get the value from the app to write
  1909. ; and write to the internal buffer
  1910. out dx,ax ; write to the EGA adapter
  1911. loop F310cp
  1912. assume ds:SpcMseSeg
  1913. jmp short F3quit
  1914. F318:
  1915. cmp dx,018h
  1916. jne F3quit
  1917. mov dx,03dah ; clear attribute controller index
  1918. in al,dx ; the read clears this register
  1919. lea di,ega_current_attr ; write the application data here
  1920. mov al,ch ; adjust the write position as required
  1921. cbw
  1922. add di,ax ; DESTINATION specified address
  1923. mov si,bx ; SOURCE from the application
  1924. lea bx,dirty_attr ; need to write some data into here
  1925. add bx,ax ; well, at this offset anyway
  1926. mov ax,es ; The application is the source
  1927. mov ds,ax ; so point to its segment
  1928. mov dx,03c0h ; Attribute Controller index register
  1929. mov ah,ch ; AC register to start at
  1930. xor ch,ch ; CX is now the loop counter
  1931. assume ds:nothing
  1932. F318cp:
  1933. mov byte ptr cs:[bx],1 ; fill in the dirty_attr array
  1934. inc bx
  1935. movsb ; get the value from the app to write
  1936. ; and write to the internal buffer
  1937. out dx,ax ; write to the EGA adapter
  1938. loop F318cp
  1939. assume ds:SpcMseSeg
  1940. F3quit:
  1941. pop es
  1942. pop ds
  1943. popa
  1944. jmp noint
  1945. egaF4: ;--- Read EGA register set -------------------------------------------
  1946. ;
  1947. ; note that the incoming/outgoing data is structured thus:
  1948. ;
  1949. ; from application --> db Port number
  1950. ; --> db must be zero
  1951. ; --> db pointer value
  1952. ; to application <-- db data read from register
  1953. pusha
  1954. F4lp:
  1955. mov al,byte ptr es:[bx] ; get the type of the next EGA register
  1956. mov dl,byte ptr es:[bx+2] ; load up the offset required
  1957. xor dh,dh ; convert DL to a word (DX)
  1958. add bx,3 ; point to where the data should
  1959. ; be written for the application
  1960. F40:
  1961. cmp al,0
  1962. jne F48
  1963. lea di,ega_current_crtc ; point to the internal CRTC reg. buffer
  1964. add di,dx ; index into the buffer
  1965. mov al,byte ptr [di] ; get the register value from the driver
  1966. mov byte ptr es:[bx],al ; store the register value
  1967. jmp short F4lp2 ; do the next loop iteration
  1968. F48:
  1969. cmp al,8
  1970. jne F410
  1971. lea di,ega_current_seq ; point to the internal Sequencer buffer
  1972. add di,dx ; index into the buffer
  1973. dec di ; RESET is not stored, so index off 1
  1974. mov al,byte ptr [di] ; get the register value from the driver
  1975. mov byte ptr es:[bx],al ; store the register value
  1976. jmp short F4lp2 ; do the next loop iteration
  1977. F410:
  1978. cmp al,010h
  1979. jne F418
  1980. lea di,ega_current_graph ; point to the internal GC reg. buffer
  1981. add di,dx ; index into the buffer
  1982. mov al,byte ptr [di] ; get the register value from the driver
  1983. mov byte ptr es:[bx],al ; store the register value
  1984. jmp short F4lp2 ; do the next loop iteration
  1985. F418:
  1986. cmp al,018h
  1987. jne F420
  1988. lea di,ega_current_attr ; point to the interal AC reg. buffer
  1989. add di,dx ; index into the buffer
  1990. mov al,byte ptr [di] ; get the register value from the driver
  1991. mov byte ptr es:[bx],al ; store the register value
  1992. jmp short F4lp2 ; do the next loop iteration
  1993. F420:
  1994. cmp al,020h
  1995. jne F4lp2
  1996. mov al,[ega_current_misc] ; load contents of miscellaneous reg
  1997. mov byte ptr[di],al ; store the register value
  1998. ; the C code actually loads BL here but I don't know why!
  1999. F4lp2:
  2000. inc bx ; point to the next 'record'
  2001. loop F4lp
  2002. popa
  2003. jmp noint
  2004. egaF5: ;--- Write EGA register set -------------------------------------------
  2005. ;
  2006. ; note that the incoming data is structured thus:
  2007. ;
  2008. ; from application --> db Port number
  2009. ; --> db must be zero
  2010. ; --> db pointer value
  2011. ; --> db data read from register
  2012. pusha
  2013. F5lp:
  2014. mov al,byte ptr es:[bx] ; get the type of the next EGA register
  2015. mov dl,byte ptr es:[bx+2] ; load up the offset required
  2016. xor dh,dh ; turn from 8 bit to a word quantity
  2017. mov si,dx ; need this when accessing buffers
  2018. add bx,3 ; point to where the data should
  2019. ; be written for the application
  2020. mov ah,byte ptr es:[bx] ; load data to send to the port
  2021. inc bx ; point to the next 'record'
  2022. F50:
  2023. cmp al,0
  2024. jne F58
  2025. mov al,dl ; also the port offset to access
  2026. mov dx,03d4h ; index register for CRTC
  2027. out dx,ax ; write to the specified port
  2028. mov byte ptr [ega_current_crtc+si],ah
  2029. mov byte ptr [dirty_crtc+si],1
  2030. jmp short F5lp2
  2031. F58:
  2032. cmp al,8
  2033. jne F510
  2034. mov al,dl ; also the port offset to access
  2035. mov dx,03c4h ; index register for Sequencer
  2036. out dx,ax ; write to the specified port
  2037. dec si ; RESET is not stored, so index off 1
  2038. mov byte ptr [ega_current_seq+si],ah
  2039. mov byte ptr [dirty_seq+si],1
  2040. jmp short F5lp2
  2041. F510:
  2042. cmp al,010h
  2043. jne F518
  2044. mov al,dl ; also the port offset to access
  2045. mov dx,03ceh ; index register for GC
  2046. out dx,ax ; write to the specified port
  2047. mov byte ptr [ega_current_graph+si],ah
  2048. mov byte ptr [dirty_graph+si],1
  2049. jmp short F5lp2
  2050. F518:
  2051. cmp al,018h
  2052. jne F520
  2053. mov dx,03dah ; clear attribute controller index
  2054. in al,dx ; the read clears this register
  2055. lea di,ega_current_attr ; write the application data here
  2056. mov al,dl ; also the port offset to access
  2057. mov dx,03c0h ; index register for AC
  2058. out dx,ax ; write to the specified port
  2059. mov al,020h ; EGA palette enable
  2060. out dx,al ; reenable the video
  2061. mov byte ptr [ega_current_attr+si],ah
  2062. mov byte ptr [dirty_attr+si],1
  2063. jmp short F5lp2
  2064. F520:
  2065. cmp al,020h
  2066. jne F528
  2067. mov byte ptr [ega_current_misc],ah
  2068. mov dx,03c2h ; Miscellaneous output register
  2069. xchg ah,al
  2070. out dx,al ; write one byte
  2071. jmp short F5lp2
  2072. F528:
  2073. xchg ah,al
  2074. mov dx,03dah ; EGA feature register
  2075. out dx,al
  2076. F5lp2:
  2077. dec cx
  2078. cmp cx,0
  2079. jz F5quit
  2080. jmp F5lp
  2081. F5quit:
  2082. popa
  2083. jmp noint
  2084. egaF6: ;--- Restore the EGA default register values --------------------------
  2085. pusha
  2086. push es
  2087. ; copy the default EGA register sets to the driver's internal cache
  2088. mov ax,ds
  2089. mov es,ax
  2090. mov cx,25
  2091. lea di,ega_current_crtc
  2092. lea si,ega_default_crtc
  2093. rep movsb
  2094. mov cx,4
  2095. lea di,ega_current_seq
  2096. lea si,ega_default_seq
  2097. rep movsb
  2098. mov cx,9
  2099. lea di,ega_current_graph
  2100. lea si,ega_default_graph
  2101. rep movsb
  2102. mov cx,20
  2103. lea di,ega_current_attr
  2104. lea si,ega_default_attr
  2105. rep movsb
  2106. mov al,[ega_default_misc]
  2107. mov [ega_current_misc],al
  2108. ; Set up the Sequencer defaults
  2109. mov dx,03c4h ; Sequencer index register
  2110. mov ax,0100h ; Synchronous reset
  2111. out dx,ax ; do the work
  2112. xor bx,bx ; do the four non reset registers
  2113. inc al ; point to the next Sequencer register
  2114. F6lp1:
  2115. cmp [dirty_seq+bx],1 ; has the dirty bit been set?
  2116. jne F6ne1
  2117. mov ah,[ega_default_seq+bx] ; default value to send to the register
  2118. out dx,ax ; do the work
  2119. F6ne1:
  2120. inc bx ; point to the next buffer location
  2121. inc al ; point to the next Sequencer register
  2122. cmp bx,3 ; copy elements 0->3 to ports
  2123. jl F6lp1
  2124. mov ax,0300h ; Clear synchronous reset
  2125. out dx,ax ; do the work
  2126. ; Set up the default Miscellaneous Output Register value.
  2127. mov dx,03c2h ; Miscellaneous o/p register address
  2128. mov al,[ega_default_misc] ; the default value
  2129. out dx,al ; write to the EGA/VGA
  2130. ; Set up the Cathode Ray Tube Controller in the default fashion
  2131. mov dx,03d4h ; Index to the CRTC
  2132. xor bx,bx ; clear an index register
  2133. F6lp2:
  2134. cmp [dirty_crtc+bx],1 ; has the dirty bit been set?
  2135. jne F6ne2
  2136. mov ax,bx ; index for the CRTC index register
  2137. mov ah,[ega_default_crtc+bx] ; default value for the selected reg.
  2138. out dx,ax
  2139. F6ne2:
  2140. inc bx ; point to the next location
  2141. cmp bx,25 ; 25 registers to copy
  2142. jl F6lp2
  2143. ; Set up the Attribute Controller default values
  2144. ; Remember that this is a funny beast which uses a flip-flop
  2145. ; off just one address/data port
  2146. mov dx,03dah ; CRT status register
  2147. in al,dx ; set the AC flip-flop
  2148. mov dx,03c0h ; Attibute controller address/data regs
  2149. xor bx,bx ; clear an index register
  2150. F6lp3:
  2151. cmp [dirty_attr+bx],1 ; has the dirty bit been set?
  2152. jne F6ne3
  2153. mov ax,bx ; index for the CRTC index register
  2154. mov ah,[ega_default_attr+bx] ; default value for the selected reg.
  2155. out dx,al ; index the register, then flip the flop
  2156. xchg al,ah ; get the default data for this register
  2157. out dx,al ; write the data out
  2158. F6ne3:
  2159. inc bx ; point to the next location
  2160. cmp bx,20 ; 20 registers to copy
  2161. ; Set the Graphics Controller default values
  2162. mov dx,03ceh ; Index to the GC
  2163. xor bx,bx ; clear an index register
  2164. F6lp4:
  2165. cmp [dirty_graph+bx],1 ; has the dirty bit been set?
  2166. jne F6ne4
  2167. mov ax,bx ; index for the GC index register
  2168. mov ah,[ega_default_graph+bx] ; default value for the selected reg.
  2169. out dx,ax
  2170. F6ne4:
  2171. inc bx ; point to the next location
  2172. cmp bx,9 ; 9 registers to copy
  2173. jl F6lp2
  2174. ; Reenable the video
  2175. mov dx,03c0h ; index register for AC
  2176. mov al,020h ; EGA palette enable
  2177. out dx,al ; reenable the video
  2178. ; Clean out the dirty register arrays
  2179. xor al,al ; put a nice zero in all the dirty
  2180. ; registers
  2181. mov cx,25+4+9+20 ; do the CRTC, SEQ, GC and AC in
  2182. mov di,offset dirty_crtc ; one go
  2183. rep stosb
  2184. pop es
  2185. popa
  2186. jmp noint
  2187. egaF7: ;---Define default register table -------------------------------------
  2188. pusha
  2189. push es
  2190. push ds
  2191. ; Load a new set of default registers for a particular EGA/VGA component
  2192. mov si,bx ; SOURCE of the incoming data from the app
  2193. mov ax,es ; save the SOURCE segment register
  2194. mov bx,ds ; save the DESTINATION offset
  2195. mov ds,ax ; DS is now the SOURCE segment in the app
  2196. mov es,bx ; ES is now the DESTINATION segment in the dvr
  2197. assume ds:nothing, es:SpcMseSeg
  2198. F70: ; Set the default CRTC registers
  2199. cmp dx,0
  2200. jne F78
  2201. mov cx,25 ; copy 25 register entries
  2202. mov di,offset ega_default_crtc
  2203. rep movsb ; do the copy
  2204. jmp short F7dirty
  2205. F78: ; Set the default Sequencer registers
  2206. cmp dx,8
  2207. jne F710
  2208. mov cx,4 ; copy 4 register entries
  2209. mov di,offset ega_default_seq
  2210. rep movsb ; do the copy
  2211. jmp short F7dirty
  2212. F710: ; Set the default Graphic Controller registers
  2213. cmp dx,10
  2214. jne F718
  2215. mov cx,9 ; copy 9 register entries
  2216. mov di,offset ega_default_graph
  2217. rep movsb ; do the copy
  2218. jmp short F7dirty
  2219. F718: ; Set the default Attribute Controller registers
  2220. cmp dx,18
  2221. jne F720
  2222. mov cx,20 ; copy 20 register entries
  2223. mov di,offset ega_default_attr
  2224. rep movsb ; do the copy
  2225. jmp short F7dirty
  2226. F720: ; Set the default Miscellaneous Output register
  2227. cmp dx,20
  2228. jne F7quit
  2229. mov word ptr cs:[ega_default_misc],si
  2230. F7dirty:
  2231. ; Set all the dirty register arrays
  2232. mov al,1 ; put a nice one in all the dirty
  2233. ; registers
  2234. mov cx,25+4+9+20 ; dirty all the registers in one go
  2235. mov di,offset dirty_crtc
  2236. rep stosb
  2237. F7quit:
  2238. pop ds ; need to restore the segment registers
  2239. pop es
  2240. assume ds:SpcMseSeg, es:nothing
  2241. popa
  2242. jmp noint
  2243. egaFA: ;--- Interrogate driver -----------------------------------------------
  2244. ; The real Microsoft mouse driver gets this wrong (release 7.03)
  2245. push ax
  2246. mov ax,cs
  2247. mov es,ax
  2248. mov bx,offset relnum ; return the address of the mouse
  2249. ; driver version number
  2250. pop ax
  2251. jmp noint
  2252. ;=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
  2253. ENDIF ; MOUSE_VIDEO_BIOS
  2254. do_bop:
  2255. bop VIDEO_IO_BOP ;BOP BE
  2256. nop
  2257. nop
  2258. jnc noint
  2259. go_rom:
  2260. popf
  2261. db 0EAh ; this is a far jump
  2262. old_vid_int dd ? ; far pointer to the old int 10h vector
  2263. jmp DOIRET
  2264. noint:
  2265. popf
  2266. jmp DOIRET
  2267. mouse_int1:
  2268. bop INT1_BOP
  2269. jmp DOIRET
  2270. mouse_version:
  2271. dw 04242h
  2272. dw 0000h
  2273. mouse_copyright:
  2274. db "Windows NT MS-DOS subsystem Mouse Driver"
  2275. video_io:
  2276. int VIDEO
  2277. bop UNSIMULATE_BOP
  2278. mouse_int2:
  2279. bop INT2_BOP
  2280. jmp DOIRET
  2281. mouseINB:
  2282. in al,dx
  2283. bop 0feh
  2284. mouseOUTB:
  2285. out dx,al
  2286. bop 0feh
  2287. mouseOUTW:
  2288. out dx,ax
  2289. bop 0feh
  2290. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2291. ;
  2292. ;16 BIT ENTRY POINT 16 BIT ENTRY POINT 16 BIT ENTRY POINT 16 BIT ENTRY POINT
  2293. ;
  2294. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2295. ;========================================================================
  2296. ; Procedure that provides the driver interface to 32 bit land. This is
  2297. ; the entry point to the Intel 16 bit driver from the mouse interrupt
  2298. ; handler in the host mouse code.
  2299. ;
  2300. ; This procedure determines the current video mode from the BIOS data
  2301. ; area, and depending on this branches to the correct display routines
  2302. ; for this mode.
  2303. ;
  2304. ; N.B. This function MUST NOT modify CX and DX because the next level
  2305. ; of functions in the driver heirarchy requires the values passed in
  2306. ; them from 32 bit land.
  2307. ;========================================================================
  2308. assume ds:SpcMseSeg
  2309. entry_point_from_32bit proc near
  2310. make_stack ; use the driver's own stack
  2311. push ds
  2312. push ax
  2313. push bx
  2314. mov ax,cs
  2315. mov ds,ax
  2316. call getBIOSvideomode; read the BIOS data area
  2317. xor bx,bx ; clear the jump table index
  2318. shl al,1 ; create a table index for word sized entries
  2319. mov bl,al ; move into a base register
  2320. call [drawpointerJMPT+bx] ; jump to the correct routine
  2321. pop bx
  2322. pop ax
  2323. pop ds
  2324. kill_stack ; return to the previous stack
  2325. bop 0FEh ; return to the 32 bit side
  2326. entry_point_from_32bit endp
  2327. ;========================================================================
  2328. ; Procedure to set the cursor draw flag to DO DRAW. This is called from
  2329. ; SoftPC code via a host_simulate(). This routine is called when the
  2330. ; application does an INT 33h, function 1.
  2331. ;
  2332. ; In accordance with the Microsoft Programmer's Reference, the internal
  2333. ; cursor flag (internalCF) has a default value of -1. If intenalCF = 0
  2334. ; then the cursor is drawn. If the flag is already 0, then this function
  2335. ; does nothing.
  2336. ;
  2337. ; Note: with calls to int 33h AX = 2, it is legal to
  2338. ; make internalCF less than -1.
  2339. ;========================================================================
  2340. int33function1 proc near
  2341. make_stack ; use the driver's own stack
  2342. push ax
  2343. push bx
  2344. push ds
  2345. mov ax,cs
  2346. mov ds,ax
  2347. ;; do not allow mouse int comes in while we are updating the cursor.
  2348. ;; call DOCLI
  2349. ; check to see if the pointer should be drawn
  2350. ; cmp [internalCF],0 ; is the flag already zero?
  2351. ; jz fn1quit ; if so, do nothing
  2352. ; pointer is not ON, so increment the flag to try to turn it ON
  2353. ; inc [internalCF] ; increment the pointer internal flag
  2354. ; cmp [internalCF],0 ; if 0, then the pointer can be drawn
  2355. ; jl fn1quit ; it is < 0, so don't draw the pointer.
  2356. ; The internal cursor flag hits zero for the first time, so
  2357. ; draw the pointer.
  2358. call getBIOSvideomode; read the BIOS data area
  2359. xor bx,bx ; clear the jump table index
  2360. shl al,1 ; create a table index for word sized entries
  2361. mov bl,al ; move into a base register
  2362. call [Int33function1JMPT+bx] ; do the correct function 1 handler
  2363. fn1quit:
  2364. ;; call DOSTI
  2365. pop ds
  2366. pop bx
  2367. pop ax
  2368. kill_stack ; return to the previous stack
  2369. bop 0FEh ; back to jolly old 32 bit land
  2370. int33function1 endp
  2371. ;========================================================================
  2372. ; Procedure to set the cursor draw flag to DONT DRAW. This is called from
  2373. ; SoftPC code via a host_simulate(). This routine is called when the
  2374. ; application does an INT 33h, function 2
  2375. ;
  2376. ; Note: with calls to int 33h AX = 2, it is legal to
  2377. ; make internalCF less than -1.
  2378. ;========================================================================
  2379. int33function2 proc near
  2380. make_stack ; use the driver's own stack
  2381. push ax
  2382. push bx
  2383. push ds
  2384. mov ax,cs
  2385. mov ds,ax
  2386. ;; do not allow mouse int comes in while we are updating the cursor.
  2387. ;; call DOCLI
  2388. ; dec [internalCF] ; decrement the pointer internal flag
  2389. ; if the internal cursor flag is less than -1, then do not try
  2390. ; do remove the pointer from the screen because this has already
  2391. ; been done.
  2392. ; cmp [internalCF],0ffh
  2393. ; jl fn2quit ; do nothing if < -1
  2394. ; Internal flag hits -1, so remove the pointer from the screen.
  2395. call getBIOSvideomode; read the BIOS data area
  2396. xor bx,bx ; clear the jump table index
  2397. shl al,1 ; create a table index for word sized entries
  2398. mov bl,al ; move into a base register
  2399. call [Int33function2JMPT+bx] ; do the correct function 1 handler
  2400. fn2quit:
  2401. ;; call DOSTI
  2402. pop ds
  2403. pop bx
  2404. pop ax
  2405. kill_stack ; return to the previous stack
  2406. bop 0feh
  2407. int33function2 endp
  2408. ;========================================================================
  2409. ; Procedure to return straight back to cloud 32. This is needed if an
  2410. ; unsupported video mode is found in the BIOS data area.
  2411. ;========================================================================
  2412. not_supported proc near
  2413. ret ; cant't BOP 0feh here or the stack will die
  2414. ; (out of balance with CS:IP stored from call)
  2415. not_supported endp
  2416. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2417. ;
  2418. ; END 16 BIT ENTRY END 16 BIT ENTRY END 16 BIT ENTRY END 16 BIT ENTRY
  2419. ;
  2420. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2421. ;========================================================================
  2422. ; Procedure to draw a cursor on the fullscreen X86 graphics display for
  2423. ; high resolution graphics modes.
  2424. ; This procedure saves the area about to be written over, blts the
  2425. ; pointer image onto the screen and restores the background from whence
  2426. ; cursor has just come.
  2427. ;
  2428. ; Input: CX = x-coordinate
  2429. ; DX = y-coordinate
  2430. ; Output: None
  2431. ;========================================================================
  2432. drawHiResPointer proc near
  2433. ; save the video card's read/write context
  2434. ;; call DOCLI
  2435. pusha
  2436. push ds
  2437. mov ax,cs ; make sure that DS points to the
  2438. mov ds,ax ; right segment
  2439. call saveVGAregisters
  2440. call check_for_mode_change
  2441. mov bx,cx ; get X coordinate into a base register
  2442. shl bx,1 ; calculate a word index
  2443. mov ax,[ChooseImageLUT+bx] ; select the right image LUT
  2444. mov [PointerLUT],ax ; store the LUT address
  2445. xor ax,ax ; assume carry clear after the next call
  2446. call determineboundary
  2447. jnc detcont ; pointer in buonds if carry clear
  2448. not ax ; carry was set, so set AX non zero
  2449. detcont:
  2450. ; Coordinates are now transformed from Cartesian to physical VRAM
  2451. ; memory byte and bit offsets.
  2452. mov di,dx ; store DX for later
  2453. ; internalCF = the current pointer status
  2454. ; background = indicates if a background has been stored or not
  2455. ;
  2456. ; if(internalCF == Zero && background == STORED)
  2457. ; The normal cursor ON condition
  2458. cmp [internalCF],0
  2459. jnz end_the_if ; request to turn pointer on
  2460. cmp [background],STORED
  2461. jne end_the_if
  2462. mov si,cx
  2463. mov di,dx
  2464. mov dx,[VRAMlastbyteoff]
  2465. mov cx,[VRAMlastbitoff]
  2466. call restore_background
  2467. cmp ax,0 ; should the pointer be drawn?
  2468. jnz end_the_if ; if the pointer has gone off the edge of
  2469. ; the screen, then quit
  2470. mov [VRAMlastbyteoff],di ; save the current position
  2471. mov [VRAMlastbitoff],si
  2472. mov cx,si
  2473. mov dx,di
  2474. call save_background
  2475. mov cx,si
  2476. mov dx,di
  2477. call drawEGApointer
  2478. end_the_if:
  2479. call restoreVGAregisters
  2480. pop ds
  2481. popa
  2482. ;; call DOSTI
  2483. ret
  2484. drawHiResPointer endp
  2485. ;========================================================================
  2486. ; Procedure to draw a cursor on the fullscreen X86 graphics display.for
  2487. ; medium resolution graphics modes.
  2488. ; This procedure saves the area about to be written over, blts the
  2489. ; pointer image onto the screen and restores the background from whence
  2490. ; cursor has just come.
  2491. ;
  2492. ; Input: CX = x-coordinate
  2493. ; DX = y-coordinate
  2494. ; Output: None
  2495. ;========================================================================
  2496. drawMediumResPointer proc near
  2497. pusha
  2498. ;; call DOCLI
  2499. shr cx,1 ; map from 640 virtual to 320 real
  2500. ; CX,DX = x,y cartesian coordinates here.
  2501. call check_for_mode_change
  2502. ; internalCF = the current pointer status
  2503. ; background = indicates if a background has been stored or not
  2504. ;
  2505. ; if(internalCF == Zero && background == STORED)
  2506. ; The normal cursor ON condition
  2507. cmp [internalCF],0
  2508. jnz cant_draw_ptr ; request to turn pointer on
  2509. cmp [background],STORED
  2510. jne cant_draw_ptr
  2511. mov si, cx ; save new cursor position
  2512. mov di, dx
  2513. mov dx,[VRAMlastbyteoff] ;
  2514. mov cx,[VRAMlastbitoff]
  2515. mov bp,[LastYCounters] ; Y looping counter
  2516. call restorebkgrndmode4
  2517. mov cx, si ; restore new cursor position
  2518. mov dx, di
  2519. call detboundmode4 ; calculate new byte offset
  2520. jc cant_draw_ptr ; don't draw new cursor of out of scrn
  2521. mov [VRAMlastbyteoff], dx ; byte offset
  2522. mov [VRAMlastbitoff], cx ; MSB = 0FFh if start with ODD line
  2523. ; LSB = bit offset
  2524. mov [LastYCounters], bp ; MSB: even counter, LSB for odd
  2525. call savebkgrndmode4
  2526. call drawmode4pointer
  2527. cant_draw_ptr:
  2528. ;; call DOSTI
  2529. popa
  2530. ret
  2531. drawMediumResPointer endp
  2532. ;========================================================================
  2533. ; Procedure to draw a cursor on the fullscreen X86 graphics display for
  2534. ; medium resolution, 256 colour graphics mode. (video bios mode 13h).
  2535. ; This procedure saves the area about to be written over, blts the
  2536. ; pointer image onto the screen and restores the background from whence
  2537. ; cursor has just come.
  2538. ;
  2539. ; Input: CX = x-coordinate
  2540. ; DX = y-coordinate
  2541. ; Output: None
  2542. ;========================================================================
  2543. drawC256Pointer proc near
  2544. pusha
  2545. ;; call DOCLI
  2546. shr cx,1 ; map from 640 virtual to 320 real x
  2547. ; CX,DX = x,y cartesian coordinates here.
  2548. call check_for_mode_change
  2549. ; internalCF = the current pointer status
  2550. ; background = indicates if a background has been stored or not
  2551. ;
  2552. ; if(internalCF == Zero && background == STORED)
  2553. ; The normal cursor ON condition
  2554. cmp [internalCF],0
  2555. jnz cant_draw_256ptr ; request to turn pointer on
  2556. cmp [background],STORED
  2557. jne cant_draw_256ptr
  2558. mov si,cx
  2559. mov di,dx
  2560. mov dx,[VRAMlastbyteoff]
  2561. mov cx,[LastXCounters]
  2562. mov bp,[LastYCounters]
  2563. call restorebkgrndmode13
  2564. mov cx, si
  2565. mov dx, di
  2566. call detboundmode13
  2567. jc cant_draw_256ptr
  2568. mov [VRAMlastbyteoff],dx ; save the current position
  2569. mov [LastXCounters],cx
  2570. mov [LastYCounters], bp
  2571. call savebkgrndmode13
  2572. call draw256pointer
  2573. cant_draw_256ptr:
  2574. ;; call DOSTI
  2575. popa
  2576. ret
  2577. drawC256Pointer endp
  2578. ;========================================================================
  2579. ; Procedure to draw a pointer on the fullscreen X86 text display for
  2580. ; BIOS modes 3 and 7.
  2581. ; This procedure saves the area about to be written over, XORs the
  2582. ; pointer image onto the screen and restores the background from whence
  2583. ; cursor has just come.
  2584. ;
  2585. ; Input: CX = x-coordinate
  2586. ; DX = y-coordinate
  2587. ; Output: None
  2588. ;========================================================================
  2589. IFDEF SIXTEENBIT
  2590. drawTextPointer proc near
  2591. pusha
  2592. push es
  2593. ; CX,DX = x,y virtual pixel coordinates here.
  2594. ; 0 <= x < 640
  2595. ; 0 <= y < 200 for 25 line mode
  2596. ; 0 <= y < 344 for 43 line mode
  2597. ; 0 <= y < 400 for 50 line mode
  2598. ; The virtual character size is always 8x8 virtual pixels.
  2599. call check_for_mode_change
  2600. ; internalCF = the current pointer status
  2601. ; background = indicates if a background has been stored or not
  2602. ;
  2603. ; if(internalCF == Zero && background == STORED)
  2604. ; The normal cursor ON condition
  2605. cmp [internalCF],0
  2606. jnz cant_draw_text_ptr ; request to turn pointer on
  2607. cmp [background],STORED
  2608. jne cant_draw_text_ptr
  2609. ; Calculate the current cell location as an offset
  2610. ; into the text buffer segment starting at B800:0
  2611. ; Note: The following kinky shifts allow for the fact that the text
  2612. ; video buffer consists of word elements of the form char:attr.
  2613. ; So, if a row = 80 characters wide on the screen, it is 160
  2614. ; bytes wide in VRAM.
  2615. mov bx,dx ; create a word table index
  2616. shr bx,3 ; virtual char height = 8, but 160 bytes
  2617. ; per text row, so save some shifts.
  2618. shl bx,1 ; make a word table index
  2619. mov di,[mult80lut+bx] ; multiply by 80 words per text row.
  2620. shl di,1
  2621. shr cx,3 ; divide the x virtual pixel coordinate
  2622. ; by 8 = virtual char width and mult
  2623. ; by 2 to get word offset in text row.
  2624. shl cx,1
  2625. add di,cx ; full VRAM location now in DI
  2626. ; Restore the text cell previously overwritten.
  2627. mov si,[VRAMlasttextcelloff]; address of last modified text cell
  2628. mov [VRAMlasttextcelloff],di; store the current cell location
  2629. mov ax,0b800h ; the text buffer segment
  2630. mov es,ax ; ES now points there
  2631. ; The text pointer uses the same magic as the graphics code
  2632. ; to place a pointer on the screen.
  2633. mov bx,07700h ; the magic cursor mask for pointer
  2634. mov cx,077ffh ; the magic screen mask for pointer
  2635. assume es:nothing
  2636. mov ax,[lasttextimage] ; restore the background
  2637. mov es:[si],ax ; from last time
  2638. mov ax,es:[di] ; load the cell to be modifyed
  2639. mov [lasttextimage],ax ; save this cell for next time
  2640. and ax,cx ; apply the screen mask
  2641. xor ax,bx ; apply the cursor mask
  2642. mov es:[di],ax ; and write back
  2643. assume es:SpcMseSeg
  2644. cant_draw_text_ptr:
  2645. pop es
  2646. popa
  2647. ret
  2648. drawTextPointer endp
  2649. ENDIF ;; SIXTEENBIT
  2650. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2651. ;
  2652. ; Interrupt 33h support functions.
  2653. ; These functions are called via a jump table from the 16 bit entry
  2654. ; point code.
  2655. ;
  2656. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2657. ;========================================================================
  2658. ; Procedure to set the cursor draw flag to DO DRAW. This is called from
  2659. ; SoftPC code via a host_simulate(). This routine is called when the
  2660. ; application does an INT 33h, function 1
  2661. ;========================================================================
  2662. int33function0 proc near
  2663. make_stack ; use the driver's own stack
  2664. push ds
  2665. push es
  2666. pusha
  2667. ; sort out the segments
  2668. mov ax,cs
  2669. mov ds,ax
  2670. mov ax,cs
  2671. mov es,ax
  2672. ;; do not allow mouse int comes in while we are updating the cursor.
  2673. ;; call DOCLI
  2674. ; set the internal pointer flag to its default value.
  2675. mov [internalCF],0ffh
  2676. ; set the default hotspot location = (0,0)
  2677. xor ax,ax
  2678. mov [hotspot],ax
  2679. mov [hotspot+2],ax
  2680. ; copy the default pointer to the working pointer buffer
  2681. lea si,default_cursor
  2682. lea di,current_cursor
  2683. call copy_pointer_to_current
  2684. ; clear the pointer enabled flag, turn the pointer off by restoring
  2685. ; the background.
  2686. mov [background],NOTSTORED ; there is no stored background now
  2687. ;; call DOSTI
  2688. popa
  2689. pop es
  2690. pop ds
  2691. kill_stack ; restore the previous stack
  2692. bop 0FEh
  2693. int33function0 endp
  2694. ;========================================================================
  2695. ; Procedure to accept a cursor bit image from the current application
  2696. ; at ES:DX. This is stored as the current pointer image for use by
  2697. ; the driver.
  2698. ;========================================================================
  2699. assume es:nothing
  2700. int33function9 proc near
  2701. call DOCLI
  2702. make_stack ; use the driver's own stack
  2703. push ds
  2704. push es
  2705. pusha
  2706. mov ax,cs ; point at the driver data segment
  2707. mov ds,ax
  2708. ;; do not allow mouse int comes in while we are updating the cursor.
  2709. ;; call DOCLI
  2710. ; Read in the hotspot cartesian coordinate values for the
  2711. ; new pointer image. If the hotspot values are out of range
  2712. ; i.e. >127 | < -128, then reset to the boundary value
  2713. ; Now using kinky non modRM short forms by clever use of AX
  2714. mov ax,127 ; load accumulator with 127
  2715. mov bp,ax ; store this constant in a register
  2716. cmp ax,bx ; compare X value of hotspot with 127
  2717. jg test_low_x ; if 127 > BX, BX is within upper limit
  2718. xchg ax,bx ; BX > 127, so set to 127
  2719. jmp short check_y_hotspot ; now test the Y values
  2720. test_low_x:
  2721. not ax ; change accumulator from 127 to -128
  2722. cmp ax,bx ; compare X value of hotspot with -128
  2723. jl check_y_hotspot ; if -128 < BX, BX is within lower lim.
  2724. xchg ax,bx ; BX < -128, so set it to -128
  2725. check_y_hotspot:
  2726. mov ax,bp ; reload AX with 127
  2727. cmp ax,cx ; compare Y value of hotspot with 127
  2728. jg test_low_y ; if 127 > CX, Cx is within upper limit
  2729. xchg ax,cx ; CX > 127, so set CX to 127
  2730. jmp short done_hotspot_check; both hotspot coords tested, so save
  2731. test_low_y:
  2732. not ax ; change accumulator from 127 to -128
  2733. cmp ax,cx ; compare Y value of hotspot with -128
  2734. jl done_hotspot_check ; if -128 < CX, CX is within lower lim.
  2735. xchg ax,cx ; CX < -128, so set it to -128
  2736. done_hotspot_check:
  2737. mov [hotspot],bx ; save the hotspot x,y
  2738. mov [hotspot+2],cx ; y component of the hotspot
  2739. ; DESTINATION: the driver current pointer buffer
  2740. ; Note: the SOURCE is already being pointed at by DX
  2741. lea di,current_cursor ; this is the bit that must change
  2742. mov si,dx
  2743. ; copy in the new application pointer
  2744. mov ax,es
  2745. mov ds,ax ; DS now points to where ES points
  2746. mov ax,cs
  2747. mov ax,es ; ES points to our data area now
  2748. call copy_pointer_to_current ; Copy the pointer image appropriately
  2749. popa
  2750. pop es
  2751. pop ds
  2752. kill_stack ; restore the previous stack
  2753. call DOSTI
  2754. ret ; this code is called from within this
  2755. ; 16 bit driver, so don't BOP
  2756. int33function9 endp
  2757. ;============================================================================
  2758. ; Procedure to display the pointer image in HIRES graphics modes
  2759. ;============================================================================
  2760. HiResInt33Function1 proc near
  2761. pusha
  2762. call check_for_mode_change
  2763. call saveVGAregisters
  2764. mov cx,[current_position_x] ; get the last known cursor position
  2765. mov dx,[current_position_y] ; from the OS via the event loop
  2766. call determineboundary ; convert to VRAM coordinates
  2767. jc end_function1 ; if the pointer has gone off the edge
  2768. ; of the screen, then quit
  2769. mov [VRAMlastbyteoff],dx ; save the restore background location
  2770. mov [VRAMlastbitoff],cx
  2771. mov si,cx
  2772. mov di,dx
  2773. call save_background
  2774. mov cx,si
  2775. mov dx,di
  2776. call drawEGApointer
  2777. mov [background],STORED
  2778. end_function1:
  2779. call restoreVGAregisters
  2780. popa
  2781. ret ; return to driver surface manager code
  2782. HiResInt33Function1 endp
  2783. ;============================================================================
  2784. ; Procedure to display the pointer image in MEDIUMRES graphics modes
  2785. ; Note that this function does a conversion from virtual pixel coordinates
  2786. ; to real screen coordinates as required if the stored values in the
  2787. ; current_position memory locations are greater than 320 for X or 200
  2788. ; for Y.
  2789. ;============================================================================
  2790. MediumResInt33Function1 proc near
  2791. pusha
  2792. call check_for_mode_change
  2793. mov cx,[current_position_x] ; get the last known cursor position
  2794. mov dx,[current_position_y] ; from the OS via the event loop
  2795. shr cx,1 ; virtual coor -> screen coor
  2796. call detboundmode4 ; convert to VRAM coordinates
  2797. jc MediumResFunction1_exit
  2798. mov [VRAMlastbyteoff],dx ; save the restore background location
  2799. mov [VRAMlastbitoff],cx
  2800. mov [LastYCounters], bp
  2801. call savebkgrndmode4
  2802. call drawmode4pointer
  2803. mov [background],STORED
  2804. MediumResFunction1_exit:
  2805. popa
  2806. ret
  2807. MediumResInt33Function1 endp
  2808. ;============================================================================
  2809. ; Procedure to display the pointer image in VGA 256 colour graphics modes
  2810. ;============================================================================
  2811. C256Int33Function1 proc near
  2812. pusha
  2813. call check_for_mode_change
  2814. call modifyentry255 ; make sure that DAC entry 255 is white
  2815. mov cx,[current_position_x] ; get the last known cursor position
  2816. mov dx,[current_position_y]
  2817. shr cx, 1 ; virtual coor -> screen coord
  2818. call detboundmode13 ; convert to VRAM coordinates
  2819. jc C256Function1_exit
  2820. mov [VRAMlastbyteoff],dx ; save the restore background location
  2821. mov [LastXCounters],cx ; X loop counter
  2822. mov [LastYCounters], bp ; Y loop counter
  2823. call savebkgrndmode13
  2824. call draw256pointer
  2825. mov [background],STORED
  2826. C256Function1_exit:
  2827. popa
  2828. ret ; return to driver surface manager code
  2829. C256Int33Function1 endp
  2830. ;============================================================================
  2831. ; Procedure to show the TEXT pointer
  2832. ;============================================================================
  2833. IFDEF SIXTEENBIT
  2834. TextInt33Function1 proc near
  2835. pusha
  2836. push es
  2837. mov [background],STORED
  2838. call check_for_mode_change
  2839. mov cx,[current_position_x] ; get the last known cursor position
  2840. mov bx,[current_position_y] ; from the OS via the event loop
  2841. shr bx,3 ; virtual char height = 8, but 160 bytes
  2842. ; per text row.
  2843. shl bx,1 ; make a word table index
  2844. mov di,[mult80lut+bx] ; multiply by 80 words per text row.
  2845. shl di,1 ; remember 160 bytes NOT 80 in a row
  2846. shr cx,3 ; divide the x virtual pixel coordinate
  2847. ; by 8 = virtual char width and mult
  2848. ; by 2 to get word offset in text row.
  2849. shl cx,1
  2850. add di,cx ; full VRAM location now in DI
  2851. mov [VRAMlasttextcelloff],di; store the current cell location
  2852. mov ax,0b800h ; the text buffer segment
  2853. mov es,ax ; DS now points there
  2854. mov bx,07700h ; the magic cursor mask for pointer
  2855. mov cx,077ffh ; the magic screen mask for pointer
  2856. assume es:nothing
  2857. mov ax,es:[di] ; load the cell to be modifyed
  2858. mov [lasttextimage],ax ; save this cell for next time
  2859. and ax,cx ; apply the screen mask
  2860. xor ax,bx ; apply the cursor mask
  2861. mov es:[di],ax ; and write back
  2862. assume es:SpcMseSeg
  2863. pop es
  2864. popa
  2865. ret ; return to driver surface manager code
  2866. TextInt33Function1 endp
  2867. ENDIF ;; SIXTEENBIT
  2868. ;============================================================================
  2869. ; Procedure to remove the pointer image in HIRES graphics modes
  2870. ;============================================================================
  2871. HiResInt33Function2 proc near
  2872. push cx
  2873. push dx
  2874. call saveVGAregisters
  2875. call check_for_mode_change
  2876. cmp [background],STORED ; is there some stored background?
  2877. jne no_background_stored ; no, so don't restore it
  2878. mov dx,[VRAMlastbyteoff]
  2879. mov cx,[VRAMlastbitoff]
  2880. call restore_background ; restored the background at correct
  2881. mov [background],NOTSTORED ; place. Set buffer cleared Flag
  2882. no_background_stored:
  2883. call restoreVGAregisters
  2884. pop dx
  2885. pop cx
  2886. ret
  2887. HiResInt33Function2 endp
  2888. ;============================================================================
  2889. ; Procedure to remove the pointer image in MEDIUMRES graphics modes
  2890. ;============================================================================
  2891. MediumResInt33Function2 proc near
  2892. push cx
  2893. push dx
  2894. push bp
  2895. call check_for_mode_change
  2896. cmp [background],STORED ; is there some stored background?
  2897. jne nobkgrndstored ; no, so don't restore it
  2898. mov dx,[VRAMlastbyteoff]
  2899. cmp dx,80*100 ; mustn't be greater than buffer size
  2900. jl vidoffok ; it's OK, so do nothing
  2901. mov dx,80*10-1 ; modify DX to fit in the buffer
  2902. vidoffok:
  2903. mov cx,[VRAMlastbitoff] ; CL = bit offset
  2904. ; CH = odd/even flag
  2905. and cl,3 ; cannot be greater than bit 3( 2bits/p)
  2906. mov bp, [LastYCounters]
  2907. call restorebkgrndmode4 ; restored the background at correct
  2908. mov [background],NOTSTORED ; place. Set buffer cleared Flag
  2909. nobkgrndstored:
  2910. pop bp
  2911. pop dx
  2912. pop cx
  2913. ret
  2914. MediumResInt33Function2 endp
  2915. ;============================================================================
  2916. ; Procedure to remove the pointer image in MEDIUMRES graphics modes
  2917. ;============================================================================
  2918. C256Int33Function2 proc near
  2919. push cx
  2920. push dx
  2921. push bp
  2922. call check_for_mode_change
  2923. cmp [background],STORED ; is there some stored background?
  2924. jne nobkgrndstored256 ; no, so don't restore it
  2925. mov dx,[VRAMlastbyteoff]
  2926. mov cx,[LastXCounters]
  2927. mov bp,[LastYCounters]
  2928. call restorebkgrndmode13 ; restored the background at correct
  2929. mov [background],NOTSTORED ; place. Set buffer cleared Flag
  2930. nobkgrndstored256:
  2931. pop bp
  2932. pop dx
  2933. pop cx
  2934. ret
  2935. C256Int33Function2 endp
  2936. ;============================================================================
  2937. ; Procedure to remove the pointer image in TEXT modes
  2938. ;============================================================================
  2939. IFDEF SIXTEENBIT
  2940. TextInt33Function2 proc near
  2941. push ax
  2942. push si
  2943. push es
  2944. call check_for_mode_change
  2945. cmp [background],STORED ; is there some stored background?
  2946. jne no_text_background_stored ; no, so don't restore it
  2947. mov [background],NOTSTORED ; place. Set buffer cleared Flag
  2948. ; Restore the text cell previously overwritten.
  2949. mov si,[VRAMlasttextcelloff]; address of last modified text cell
  2950. mov ax,0b800h ; the text buffer segment
  2951. mov es,ax ; DS now points there
  2952. assume es:nothing
  2953. mov ax,[lasttextimage] ; restore the background
  2954. mov es:[si],ax ; from last time
  2955. no_text_background_stored:
  2956. assume es:SpcMseSeg
  2957. pop es
  2958. pop si
  2959. pop ax
  2960. ret
  2961. TextInt33Function2 endp
  2962. ENDIF ;; SIXTEENBIT
  2963. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2964. ;
  2965. ; End of Interrupt 33h support functions.
  2966. ;
  2967. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2968. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2969. ;
  2970. ; Mouse driver general support functions
  2971. ;
  2972. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2973. ;========================================================================
  2974. ; Procedure to determine if the application has changed video modes since
  2975. ; the last mouse interrupt. If it has, then the image that is saved in the
  2976. ; background restore buffer is invalid and should not be drawn.
  2977. ;========================================================================
  2978. check_for_mode_change proc near
  2979. push ax
  2980. call getBIOSvideomode; peek at the BIOS data area for video mode
  2981. cmp al,[lastvidmode]; compare with the last mode value
  2982. ; from the preceding interrupt
  2983. jnz mode_change ; a mode change has occurred
  2984. pop ax ; no mode change, so quit
  2985. ret
  2986. mode_change:
  2987. mov [background],NOTSTORED
  2988. mov byte ptr [lastvidmode],al ; store the new mode
  2989. pop ax
  2990. ret
  2991. check_for_mode_change endp
  2992. ;========================================================================
  2993. ; Procedure to read the BIOS data area and get the current video mode
  2994. ; Output: AL = BIOS video mode
  2995. ; Modifies: memory variable -> currentvidmode, puts the video found in
  2996. ; the BIOS data area in this memory location.
  2997. ;========================================================================
  2998. getBIOSvideomode proc near
  2999. push es
  3000. push bx
  3001. mov ax,40h ; BIOS data area segment
  3002. mov es,ax
  3003. mov al,es:[49h] ; get the BIOS video mode data
  3004. mov bl,al ; copy the video mode value
  3005. xor bh,bh
  3006. shl bx,1 ; create a word table index
  3007. mov bx,[latchhomeLUT+bx] ; get the latch hiding place for this
  3008. ; video mode
  3009. mov [latchcache],bx ; save in memory for use in save and restore
  3010. ; vga registers.
  3011. pop bx
  3012. pop es ; restore the 'normal' data segment
  3013. ret
  3014. getBIOSvideomode endp
  3015. ;=========================================================================
  3016. ; Function to modify the 256th palette entry for 256 colour mode. The
  3017. ; driver requires white to be set in this DAC register triple.
  3018. ;=========================================================================
  3019. modifyentry255 proc near
  3020. push ax
  3021. push dx
  3022. mov dx,03c8h
  3023. mov al,0ffh
  3024. out dx,al
  3025. inc dx
  3026. out dx,al
  3027. out dx,al
  3028. out dx,al
  3029. pop dx
  3030. pop ax
  3031. ret
  3032. modifyentry255 endp
  3033. ;========================================================================
  3034. ; Procedure to copy the required pointer image to the snapshot
  3035. ; buffers. Each buffer holds a different instance of the mouse
  3036. ; pointer for each possible alignment of the pointer image in
  3037. ; a VRAM byte.
  3038. ;
  3039. ; INPUT DS:SI = pointer to the source image
  3040. ;
  3041. ;========================================================================
  3042. assume ds:nothing
  3043. copy_pointer_to_current proc near
  3044. push ds
  3045. push es
  3046. pusha
  3047. ; Set up the destination for the copy
  3048. mov ax,cs ; point ES to this segment
  3049. mov es,ax
  3050. lea di,current_cursor ; this is the bit that must change
  3051. mov bx,di ; save this address for a while
  3052. mov bp,si ; save the application source address
  3053. ; Fill the AND buffer with 1s and then fill the XOR buffer with
  3054. ; 0s for the byte aligned pointer condition. This is done so that
  3055. ; the last byte in the 3byte scanline sequence is set to the correct
  3056. ; value to prevent image loss from the screen.
  3057. cld ; move low mem -> high mem
  3058. mov ax,24 ; avoid doing a modRM load of immediate
  3059. mov cx,ax ; 24 words to fill.
  3060. mov dx,ax ; store this for a while
  3061. xor ax,ax ; clear AX (AX = 0)
  3062. not ax ; AX = 0ffffh -> fill AND mask with it.
  3063. rep stosw ; fill the screen mask (AND mask)
  3064. mov cx,dx ; do the next 24 words (XOR mask)
  3065. not ax ; AX = 0h -> fill XOR mask with it
  3066. rep stosw ; Fill the cursor mask
  3067. ; Now fill the prepared 48 word buffer with the user defined
  3068. ; AND and XOR masks
  3069. ; Note that the image passed in from the application is little-endian.
  3070. ; To write to the VGA planes byte by byte, the image has to be reversed
  3071. ; to big-endian for the purpose of quick drawing since the VGA can only
  3072. ; read and write one byte from/to its latches.
  3073. mov di,bx ; point to the top of the buffer again
  3074. mov si,bp ; point to the new pointer image
  3075. mov cx,32
  3076. norept1:
  3077. lodsw ; read in the required image word
  3078. xchg al,ah ; convert little endian to big endian
  3079. stosw ; write into local buffer
  3080. inc di ; remember local buffer in 3 bytes wide
  3081. dec cx
  3082. jnz norept1
  3083. ; Now, the aligned mask must be rotated, then copied into each of
  3084. ; the seven unaligned image buffers.
  3085. mov ax,cs
  3086. mov ds,ax ; return to the default data segment
  3087. mov bp,1000000000000000b ; a mask for the MSBit
  3088. lea di,AlignData1 ; point to the buffer for 1 bit offset
  3089. mov si,bx ; source = byte aligned pointer image
  3090. push bx
  3091. mov bx,32*7
  3092. norept2:
  3093. lodsw ; load the word from 3 byte sequence
  3094. xchg al,ah ; put into little-endian format
  3095. mov cl,byte ptr [si] ; load the remaining byte
  3096. shr ax,1 ; LSB now stored in CF
  3097. rcr cl,1 ; CF into MSB, lsb into CF
  3098. jnc $+4 ; CF=0 -> don't need to do anything
  3099. or ax,bp ; OR in the carried bit from CF
  3100. xchg al,ah ; return to bitstream format
  3101. stosw ; write the rotated data
  3102. mov byte ptr[di],cl
  3103. inc si ; point to the next source scanline
  3104. inc di ; point to the next dest scanline
  3105. dec bx
  3106. jnz norept2
  3107. pop bx
  3108. ; Just to do a little bit more work, the rotated buffers created
  3109. ; above must be copied to the instances for byte 78 and byte 79
  3110. ; of the scanline. These images are then cunningly clipped in the
  3111. ; process to the edge of the screen!
  3112. mov si,bx ; BX points to the top of current buffer
  3113. ; Note DI points to clip_cursor78 now
  3114. ; may as well use the nice string functions now that I don't
  3115. ; have to XCHG bytes. (how space and cycle efficient
  3116. xor al,al ; constant for putting in masks
  3117. ; there are 8 instances for bits 0 to 7
  3118. mov bx,8
  3119. norept3:
  3120. ; Do the AND mask modifications for byte 78
  3121. not al ; AL = 11111111b
  3122. REPT 16 ; 16 scanlines
  3123. movsw ; copy contents of AND word
  3124. stosb ; Nice clear AND mask = 11111111b
  3125. inc si ; point to the first image byte in
  3126. ; the next scanline
  3127. ENDM
  3128. ; Do the XOR mask modifications for byte 78
  3129. not al ; AL = 00000000b
  3130. REPT 16 ; 16 scanlines
  3131. movsw ; copy contents of XOR word
  3132. stosb ; Nice clear XOR mask = 00000000b
  3133. inc si ; point to the first image byte in
  3134. ; the next scanline
  3135. ENDM
  3136. dec bx
  3137. jnz norept3
  3138. ; prepare the BYTE 79 instances
  3139. ; SI and DI should be in the right place
  3140. xor ax,ax ; constant for putting in masks
  3141. mov bx,2 ; constant for addressing source
  3142. ; there are 8 instances for bits 0 to 7
  3143. mov cx,8
  3144. norept4:
  3145. ; Do the AND mask modifications for byte 79
  3146. not ax ; AX = 0ffffh
  3147. REPT 16 ; 16 scanlines
  3148. movsb ; copy contents of AND byte
  3149. stosw ; Nice clear AND mask (=0ffffh)
  3150. add si,bx ; point to the first image byte in
  3151. ; the next scanline
  3152. ENDM
  3153. ; Do the XOR mask modifications for byte 79
  3154. not ax ; AX = 0h
  3155. REPT 16 ; 16 scanlines
  3156. movsb ; copy contents of XOR byte
  3157. stosw ; Nice clear XOR mask
  3158. add si,bx ; point to the first image byte in
  3159. ; the next scanline
  3160. ENDM
  3161. dec cx
  3162. jz norept4quit
  3163. jmp norept4
  3164. norept4quit:
  3165. popa
  3166. pop es
  3167. pop ds
  3168. ret
  3169. copy_pointer_to_current endp
  3170. ;========================================================================
  3171. ; Procedure to determine the segment of the video buffer for
  3172. ; the current display mode.
  3173. ;========================================================================
  3174. assume ds:SpcMseSeg
  3175. getvideobuffer proc near
  3176. push ax
  3177. push si
  3178. ; determine the current video mode from the BIOS and save it.
  3179. ; Use this value to determine the video buffer segment address.
  3180. mov ah,0fh ; use the bios to get the video mode
  3181. int 10h
  3182. cbw ; create a table index
  3183. shl ax,1 ; word sized table entries
  3184. mov si,ax
  3185. mov ax,[videomodetable+si] ; use video mode to index the table
  3186. mov [videobufferseg],ax
  3187. pop si
  3188. pop ax
  3189. ret
  3190. getvideobuffer endp
  3191. IFDEF DEBUGMOUSE
  3192. ;=========================================================================
  3193. ; Code to provide 32 bit side with a dump of the VGA registers on request.
  3194. ;=========================================================================
  3195. VGAregs db 9+5+25 dup(?) ; enough room for sequencer, GC and CTRC
  3196. dumpVGAregs proc near
  3197. call DOCLI
  3198. pusha
  3199. push ds
  3200. mov ax,cs
  3201. mov ds,ax
  3202. assume ds:SpcMseSeg
  3203. ; Save the Graphics Controller registers
  3204. xor bx,bx ; Index into the G.C. register saving array
  3205. mov dx,03ceh ; Graphics Controller index register
  3206. xor ax,ax
  3207. mov cx,9 ; save 9 G.C. registers
  3208. norept5:
  3209. mov al,ah
  3210. out dx,al ; Select it
  3211. inc dx ; Address the register
  3212. in al,dx ; Get the register contents
  3213. mov [VGAregs+bx],al ; Save the register
  3214. inc bx ; index to next array entry
  3215. inc ah
  3216. dec dx ; Sequencer index register
  3217. dec cx
  3218. jnz norept5
  3219. ; Save the Sequencer registers
  3220. mov dx,03c4h ; Sequencer index register
  3221. xor ax,ax
  3222. mov cx,5 ; save 5 sequencer registers
  3223. norept6:
  3224. mov al,ah
  3225. out dx,al ; Select it
  3226. inc dx ; Address the register
  3227. in al,dx ; Get the register contents
  3228. mov [VGAregs+bx],al ; Save the register
  3229. inc bx ; index to next array entry
  3230. inc ah
  3231. dec dx ; Sequencer index register
  3232. dec cx
  3233. jnz norept6
  3234. ; Save the CRTC registers
  3235. mov dx,03d4h ; CRTC index register
  3236. xor ax,ax
  3237. mov cx,25 ; save 25 sequencer registers
  3238. norept7:
  3239. mov al,ah
  3240. out dx,al ; Select it
  3241. inc dx ; Address the register
  3242. in al,dx ; Get the register contents
  3243. mov [VGAregs+bx],al ; Save the register
  3244. inc bx ; index to next array entry
  3245. inc ah
  3246. dec dx ; CRTC index register
  3247. dec cx
  3248. jnz norept7
  3249. pop ds
  3250. popa
  3251. call DOSTI
  3252. bop 0feh ; return to 32 bit land
  3253. dumpVGAregs endp
  3254. ENDIF ; DEBUGMOUSE
  3255. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3256. ;
  3257. ; End of Mouse driver general support functions
  3258. ;
  3259. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3260. ;========================================================================
  3261. ; Procedure to draw an EGA pointer image on the graphics screen at a
  3262. ; specified bit location.
  3263. ;
  3264. ; Input: CX = pointer offset in the current VRAM byte.
  3265. ; DX = offset in the video buffer to pointer
  3266. ; Output: None
  3267. ; Modifies: AX,BX,CX,DX,BP,SI,DI
  3268. ;========================================================================
  3269. assume ds:SpcMseSeg
  3270. .286
  3271. even
  3272. drawEGApointer proc near
  3273. push es
  3274. push ds
  3275. mov ax,cs
  3276. mov ds,ax
  3277. cld ; index from low memory to high for LODSB
  3278. ; point to the video buffer
  3279. mov ax,0a000h
  3280. mov es,ax
  3281. mov bp,dx ; save the byte offset in VRAM for the XOR code
  3282. ; Select the Graphics Controller
  3283. mov dx,03ceh
  3284. ;************ AND MASK OPERATION **************************
  3285. ; use the bit position to select the relavent pointer image
  3286. shl cx,1 ; need a word offset into LUT
  3287. mov di,cx ; need an index register
  3288. mov bx,[PointerLUT]
  3289. mov si,[bx+di] ; Point to the screen (AND) mask
  3290. mov di,bp ; point to the byte offset in VRAM
  3291. mov ax,0803h ; Index the data rotate register and select AND
  3292. out dx,ax ; do it
  3293. mov ax,80-2 ; Avoid modRM loading of CX
  3294. mov cx,ax ; A constant handily kept in a register
  3295. ; The pointer contains 16 words of information
  3296. push bx
  3297. mov bx,16
  3298. norept8:
  3299. lodsw ; Load 2 bytes from the AND mask into AL and AH
  3300. xchg al,es:[di] ; Latch the 8 pixels for updating.
  3301. ; and write them back out with new data
  3302. inc di ; point to the next byte in VRAM
  3303. xchg ah,es:[di] ; Latch the 8 pixels for updating.
  3304. ; and write them back out with new data
  3305. inc di ; point to the next byte in VRAM
  3306. lodsb ; Load a byte from the AND mask into AL
  3307. xchg al,es:[di] ; Latch the 8 pixels for updating.
  3308. ; and write them back out with new data
  3309. add di,cx ; point to the next byte in VRAM on the next scan
  3310. ; line to write to. CX contains 80-2
  3311. dec bx
  3312. jnz norept8
  3313. pop bx
  3314. ;************ XOR MASK OPERATION **************************
  3315. ; Note: SI points to current_cursor+48 now, automatically
  3316. ; i.e. at the start of the XOR mask.
  3317. mov di,bp ; point to the byte offset in VRAM
  3318. mov ax,1803h ; Index the DATA ROTATE REGISTER and
  3319. ; Select the XOR function to XOR CPU data in
  3320. out dx,ax ; Do the deed
  3321. push bx
  3322. mov bx,16
  3323. norept9:
  3324. lodsw ; Load 2 bytes from the AND mask into AL and AH
  3325. xchg al,es:[di] ; Latch the 8 pixels for updating.
  3326. ; and write them back out with new data
  3327. inc di ; point to the next byte in VRAM
  3328. xchg ah,es:[di] ; Latch the 8 pixels for updating.
  3329. ; and write them back out with new data
  3330. inc di ; point to the next byte in VRAM
  3331. lodsb ; Load a byte from the XOR mask into AL
  3332. xchg al,es:[di] ; Latch the 8 pixels for updating.
  3333. ; and write them back out with new data
  3334. add di,cx ; point to the next byte in VRAM on the next scan
  3335. ; line to write to. CX contains 80-2
  3336. dec bx
  3337. jnz norept9
  3338. pop bx
  3339. pop ds
  3340. pop es
  3341. ret
  3342. drawEGApointer endp
  3343. ;========================================================================
  3344. ; Procedure to determine what the byte and bit offset is, in the current
  3345. ; VGA buffer for the top left hand corner of the pointer bitmap.
  3346. ; The X,Y value is modified for hotspot in this routine. A flag is set,
  3347. ; also, to relay whether or not the cursor bitmap is byte aligned or not.
  3348. ;
  3349. ; INPUT: CX,DX = pointer x,y coordinates
  3350. ; OUT : DX = byte offset to top left hand pointer pixel
  3351. ; CX = bit offset in the byte
  3352. ; CF = set if it is not possible to draw the pointer on the
  3353. ; screen because of the hotspot adjustment. (Usually a
  3354. ; negative hotspot value will cause clipping and wrapping
  3355. ; problems at the right and bottom screen boundaries.
  3356. ;========================================================================
  3357. determineboundary proc near
  3358. push ax
  3359. push bx
  3360. push es
  3361. ; do the adjustment in x,y for pointer hotspot
  3362. ; Also test for top or left screen boundary problems
  3363. ; and zero the coordinate if it goes negative.
  3364. sub cx,[hotspot] ; adjust the x cartesian coord for hotspot
  3365. jns dont_zero_x ; if x goes negative, assume zero
  3366. xor cx,cx
  3367. dont_zero_x:
  3368. sub dx,[hotspot+2] ; adjust the y cartesian coord for the hotspot
  3369. jns dont_zero_y ; if y goes negative, assume zero
  3370. xor dx,dx
  3371. dont_zero_y:
  3372. ; Now check the right and bottom bounds to prevent the pointer
  3373. ; image wrapping if the hotspot adjustment forces either of
  3374. ; the coordinates to exceed the screen bounds.
  3375. ; First, for all video modes that this function handles, the
  3376. ; X bound is always x < 640 ... check this first.
  3377. cmp cx,640
  3378. jl didntexceedX
  3379. stc ; Oh oh - failed, so set carry flag.
  3380. jmp short quitdet ; bye bye.
  3381. didntexceedX:
  3382. ; Now check out the y value by finding the maximum extent from
  3383. ; a lut based on the current BIOS video mode.
  3384. mov ax,40h ; B.D.A. segment
  3385. mov es,ax ; and ES points to it.
  3386. mov al,byte ptr es:[49h]
  3387. sub al,0fh ; table is normalized. mode f is in entry
  3388. ; zero.
  3389. xor ah,ah ; create a look up table index
  3390. shl ax,1 ; for a table with word sized elements.
  3391. xchg bx,ax ; use a suitable register as index
  3392. cmp dx,[hiresylut+bx] ; get the extent and compare y coord.
  3393. jl didntexceedY
  3394. stc ; Oh oh - failed, so set carry flag.
  3395. jmp short quitdet ; bye bye.
  3396. didntexceedY:
  3397. ; determine the byte offset from the start of the video buffer
  3398. ; for the modified coordinates. First calculate how many bytes
  3399. ; there are for the number of scanlines -1 to where the pointer
  3400. ; is.
  3401. mov ax,dx ; copy Y position into AX
  3402. shl ax,1 ; create a word table index
  3403. xchg ax,bx ; copy table index into a base register
  3404. mov dx,[mult80lut+bx] ; do a fast LUT multiply by 80
  3405. ; determine the byte position of the pixel in question
  3406. mov ax,cx ; save the x-coordinate displacement
  3407. and ax,7 ; do a modulus 8 to find the pixel position
  3408. ; in the byte. The bit number is in DX.
  3409. ; add the whole number of bytes in the current row to the number
  3410. ; of complete-row bytes
  3411. shr cx,3 ; divide pixels by 8 to get bytes
  3412. add dx,cx ; DX hold the complete byte offset.
  3413. xchg ax,cx ; CX = bit offset in the byte.
  3414. ; the pointer has not exceeded the screen buonds, so clear
  3415. ; the carry flag to signify this.
  3416. clc
  3417. ; Wind up the routine and return with the carry flag:
  3418. ; SET if cursor exceeded screen bounds.
  3419. ; CLEAR otherwise.
  3420. quitdet:
  3421. pop es
  3422. pop bx
  3423. pop ax
  3424. ret
  3425. determineboundary endp
  3426. ;========================================================================
  3427. ; Procedure to buffer up the data over which the cursor will next be
  3428. ; drawn. This data will be used to replace the cursor at a later point
  3429. ; when the cursor position has changed and for generating a cursor image
  3430. ; To prevent having separate routines for aligned and unaligned pointer
  3431. ; saves, this routine saves a pixel block 24 x 16 deep in all cases. The
  3432. ; start offset is a byte location into VRAM in which the pointer TLHC lives.
  3433. ;
  3434. ; Input: DX = VRAM byte
  3435. ; Modifies: AX,BX,DI,CX,DX,ES
  3436. ;
  3437. ;========================================================================
  3438. assume ds:SpcMseSeg
  3439. even
  3440. save_background proc near
  3441. push ds
  3442. push es
  3443. pusha
  3444. mov ax,cs ; point DS briefly at the driver data
  3445. mov ds,ax
  3446. mov es,ax ; point ES to the driver segment
  3447. lea di,behindcursor ; DESTINATION: a nice, safe place in the
  3448. ; driver segment
  3449. mov ax,0a000h ; point DS at VRAM
  3450. mov ds,ax
  3451. assume ds:nothing
  3452. mov bp,dx ; save DX=VRAM byte offset for later use
  3453. mov dx,03ceh ; VGA GC index register
  3454. mov al,4 ; select the read map select reg
  3455. out dx,al ; Index in the map select register
  3456. inc dx ; DX holds port address to map select register
  3457. xor al,al ; plane 0 will be selected first
  3458. cld ; make sure to address forward in memory
  3459. mov ah,3 ; number of bytes to copy per pointer scanline
  3460. xor cx,cx ; counter for the REP MOVSB
  3461. mov bx,80-3 ; another handy constant: move to next scanline
  3462. ; byte.
  3463. REPT 4 ; read the 4 EGA planes individually
  3464. mov si,bp ; SOURCE: somewhere in VRAM
  3465. out dx,al ; do the plane selection
  3466. inc al ; select the next plane to latch
  3467. ; note that only one byte at a time may be read from the latches
  3468. ; do 16 scanlines for each plane
  3469. push dx
  3470. mov dx,16
  3471. @@:
  3472. mov cl,ah ; CX now contains 3
  3473. rep movsb ; copy 3 bytes from VRAM to data segment
  3474. add si,bx ; move down to the first byte in next scanline
  3475. dec dx
  3476. jnz @B ; norept10
  3477. pop dx
  3478. ENDM
  3479. popa
  3480. pop es
  3481. pop ds
  3482. ret
  3483. save_background endp
  3484. ;========================================================================
  3485. ; Procedure to restore the area of the screen that was behind the cursor
  3486. ; before it had moved.
  3487. ;
  3488. ; Note. Currently (2/12/92) this is the only routine that modifies the
  3489. ; VGA sequencer. Therefore, the code from save and restore vga registers
  3490. ; that maintain the sequencer registers has been moved to here for
  3491. ; centralisation purposes.
  3492. ;
  3493. ; Input: DX = VRAM byte
  3494. ; Output: None
  3495. ; Modifies: AX,BX,CX,DX,DI,SI
  3496. ;========================================================================
  3497. assume ds:SpcMseSeg
  3498. even
  3499. restore_background proc near
  3500. push ds
  3501. push es
  3502. pusha
  3503. ;; call DOCLI ; turn off interrupts
  3504. mov ax,cs
  3505. mov ds,ax ; point at the driver data segment
  3506. mov ax,0a000h ; videobufferseg
  3507. mov es,ax ; point ES at VRAM segment
  3508. mov bp,dx ; save the pointer for later
  3509. mov si,offset behindcursor ; SOURCE: point at the stored planes
  3510. ; set up the Graphic Controller for the restore.
  3511. mov dx,03ceh ; VGA GC index register
  3512. mov ax,0003h ; Select copy into latches function
  3513. out dx,ax ; i.e. data rotate -> replace
  3514. mov ax,0ff08h ; bitmask register reset
  3515. out dx,ax
  3516. ; do the 4 plane restore.
  3517. mov cx,80-2 ; point to the first byte in image on next line
  3518. cld ; write forward in memory
  3519. mov bx,0102h ; BH = initial plane mask value
  3520. ; plane 0 is selected with a 1
  3521. ; BL = map mask register offset
  3522. mov dx,03c4h ; index register for sequencer
  3523. mov al,bl ; point to the map mask register in sequencer
  3524. out dx,al ; index the register into 03c5h
  3525. inc dx ; point to the data register
  3526. in al,dx ; read the data register value in
  3527. dec dx ; restore DX to 03c4h
  3528. mov [seqregs],al ; save the map mask register value
  3529. REPT 4 ; 4 planes to restore
  3530. mov di,bp ; DESTINATION: pointer into VRAM
  3531. mov ax,bx ; select the plane to mask and map mask register
  3532. out dx,ax ; do the mask
  3533. shl bh,1 ; point to the mask for the next iteration
  3534. push dx
  3535. mov dx,16
  3536. @@:
  3537. lodsw ; load the old background data (ONE WORD)
  3538. xchg al,es:[di] ; latch the VRAM data and swap with the
  3539. inc di ; point to next byte to replace
  3540. xchg ah,es:[di] ; latch the VRAM data and swap with the
  3541. inc di ; point to next byte to replace
  3542. lodsb ; load the old background data (ONE BYTE)
  3543. xchg al,es:[di] ; latch the VRAM data and swap with the
  3544. add di,cx ; point to the first byte in image on next line
  3545. dec dx
  3546. jnz @B ; norept11
  3547. pop dx
  3548. ENDM
  3549. mov ah,[seqregs] ; the old map mask value
  3550. mov al,bl ; need to restore the map mask register
  3551. out dx,ax ; do the restore
  3552. ;; call DOSTI ; reenable interrupts.
  3553. popa
  3554. pop es
  3555. pop ds
  3556. ret
  3557. restore_background endp
  3558. ;==========================================================================
  3559. ; Procedure to save the register state of the VGA card on receiving a
  3560. ; mouse pointer update interrupt. This procedure also sets up the following
  3561. ; VGA registers to nice values for the driver.
  3562. ;
  3563. ; mode register <write mode 0, read mode 0>
  3564. ; data rotate register <do not rotate, no logical ops>
  3565. ; enable set/reset register <disable set/reset>
  3566. ;
  3567. ;==========================================================================
  3568. even
  3569. assume ds:SpcMseSeg
  3570. saveVGAregisters proc near
  3571. push dx
  3572. push di
  3573. push es
  3574. ; Save the Graphics Controller registers that the
  3575. ; Driver uses
  3576. xor bx,bx ; Index into the G.C. register saving array
  3577. mov dx,03ceh ; Graphics Controller index register
  3578. xor al,al
  3579. push cx
  3580. mov cx,9 ; save 9 G.C. registers
  3581. norept12:
  3582. out dx,al ; Select it
  3583. inc dx ; Address the register
  3584. in al,dx ; Get the register contents
  3585. mov [GCregs+bx],al ; Save the register
  3586. inc bx ; index to next array entry
  3587. mov al,bl
  3588. dec dx ; G.C. index register
  3589. dec cx
  3590. jnz norept12
  3591. pop cx
  3592. ; save the latches to location in a bit of video buffer
  3593. ; off the screen.
  3594. mov ax,0a000h ; point to the video buffer
  3595. mov es,ax
  3596. assume es:nothing
  3597. mov ax,0105h ; select write mode 1 to squirt latches out
  3598. out dx,ax ; do the selection
  3599. mov di,[latchcache] ; 1 byte over the last location
  3600. mov es:[di],al ; write the latches out to the planes
  3601. ; disable the enable set/reset register
  3602. mov ax,01h ; select enable set/reset register and clear it
  3603. out dx,ax
  3604. ; clear the data rotate register (no logical operations).
  3605. inc ax
  3606. inc ax ; select data rotate register and clear it
  3607. out dx,ax ; AX = 3 therefore points to the DRR
  3608. ; set write mode 0 for the graphics display
  3609. ; conveniently, this also sets read mode to 0 which is needed too!
  3610. inc ax
  3611. inc ax ; select write mode 0
  3612. out dx,ax ; AX = 5, i.e. the mode register
  3613. ; color don't care. don't care for all planes
  3614. inc ax ;register 7, color don't care
  3615. inc ax
  3616. out dx, ax
  3617. ; bit mask register. enable all planes
  3618. ;
  3619. inc ax ;register 8, bit mask
  3620. not ah
  3621. out dx, ax
  3622. pop es
  3623. pop di
  3624. pop dx
  3625. ret
  3626. saveVGAregisters endp
  3627. ;==========================================================================
  3628. ; Procedure to restore the register state of the VGA card after dealing
  3629. ; with mouse pointer update interrupt.
  3630. ;==========================================================================
  3631. restoreVGAregisters proc near
  3632. assume ds:SpcMseSeg
  3633. push es
  3634. push di
  3635. push bx
  3636. ; restore the latches that where saved in the video planes
  3637. mov ax,0a000h ; point to the video buffer
  3638. mov es,ax
  3639. assume es:nothing
  3640. mov di,[latchcache] ; the byte just off the end of the buffer
  3641. mov al,es:[di] ; read in the latches
  3642. ; Restore the Graphics Controller registers that the
  3643. ; Driver uses
  3644. xor ax,ax ; create an index
  3645. xor bx,bx ; Index into the G.C. register saving array
  3646. mov dx,03ceh ; Graphics Controller index register
  3647. norept13:
  3648. mov ah,[GCregs+bx] ; restore the register
  3649. out dx,ax ; Select it
  3650. inc al ; index for the next register
  3651. inc bx ; index to next array entry
  3652. cmp al,9
  3653. jne norept13
  3654. pop bx
  3655. pop di
  3656. pop es
  3657. ret
  3658. restoreVGAregisters endp
  3659. ;=======================================================================
  3660. ; Procedure to draw a BIOS Mode 4 graphics pointer to the display.
  3661. ; Input: DX = byte offset
  3662. ; CL = bit offset in the byte
  3663. ; CH = 0FFh if ODD, 0 if EVEN
  3664. ; BP = Y loop counter, ODD in LSB, EVEN in MSB
  3665. ;=======================================================================
  3666. drawmode4pointer proc near
  3667. pusha
  3668. push es
  3669. cld
  3670. xchg dx, bp ;
  3671. mov di, bp ; bp = di = byte offset, dx = y counters
  3672. mov ax,0b800h ; point a segment register to
  3673. mov es,ax ; the CGA video buffer.
  3674. or ch, ch ;
  3675. je drawonevenscanline ;
  3676. jmp drawonoddscanline ; otherwise do an ODD job
  3677. ; ANDEVEN ANDEVEN ANDEVEN ANDEVEN ANDEVEN ANDEVEN ANDEVEN ANDEVEN ANDEVEN
  3678. drawonevenscanline:
  3679. mov si,[mode4SelectedPointer]
  3680. ; Load a word of the pointer image, convert it to two bits per
  3681. ; pixel and write to the screen for even scanlines
  3682. xor cx, cx
  3683. mov cl, dh ; number of even scanlines to draw
  3684. push dx
  3685. evensl1:
  3686. mov dx,3
  3687. norept14:
  3688. lodsb ; load 8 pixels from pointer bitmap
  3689. xor bh,bh ; want a zero extended 16 bit value
  3690. mov bl,al ; copy into a base register
  3691. shl bx,1 ; create a word address
  3692. mov ax,[LUT1to2bit+bx] ; get the byte to word conversion
  3693. xchg al,ah ; little-endianise
  3694. mov bx,es:[di] ; get the current displayed 8 pixels
  3695. and ax,bx ; AND the AND mask in
  3696. stosw ; write to the video buffer
  3697. dec dx
  3698. jnz norept14
  3699. add si,3
  3700. add di,80-6
  3701. loop evensl1
  3702. pop dx
  3703. ; Load a word of the pointer image, convert it to two bits per
  3704. ; pixel and write to the screen for odd scanlines
  3705. mov si,[mode4SelectedPointer]
  3706. add si,3
  3707. mov di,bp
  3708. add di,02000h ; offset into video buffer
  3709. ; the video buffer
  3710. mov cl,dl ; number of odd scanlines to draw
  3711. push dx
  3712. oddsl1:
  3713. mov dx,3
  3714. norept15:
  3715. lodsb ; load 8 pixels from bitmap
  3716. xor bh,bh
  3717. mov bl,al ; copy into a base register
  3718. shl bx,1 ; create a word address
  3719. mov ax,[LUT1to2bit+bx] ; get the byte to word conversion
  3720. xchg al,ah
  3721. mov bx,es:[di] ; get the current displayed 8 pixels
  3722. and ax,bx ; AND the AND mask in
  3723. stosw ; write to the video buffer
  3724. dec dx
  3725. jnz norept15
  3726. add si,3
  3727. add di,80-6
  3728. loop oddsl1
  3729. pop dx
  3730. ; XOREVEN XOREVEN XOREVEN XOREVEN XOREVEN XOREVEN XOREVEN XOREVEN XOREVEN
  3731. mov si,[mode4SelectedPointer]
  3732. add si,48
  3733. mov di,bp ; offset into video buffer
  3734. ; Load a word of the pointer image, convert it to two bits per
  3735. ; pixel and write to the screen for even scanlines
  3736. mov cl,dh ; number of even scanlines to draw
  3737. push dx
  3738. evensl2:
  3739. mov dx,3
  3740. norept16:
  3741. lodsb ; load 8 pixels from bitmap
  3742. xor bh,bh
  3743. mov bl,al ; copy into a base register
  3744. shl bx,1 ; create a word address
  3745. mov ax,[LUT1to2bit+bx] ; get the byte to word conversion
  3746. xchg al,ah
  3747. mov bx,es:[di] ; get the current displayed 8 pixels
  3748. xor ax,bx ; XOR the XOR mask in
  3749. stosw ; write to the video buffer
  3750. dec dx
  3751. jnz norept16
  3752. add si,3
  3753. add di,80-6
  3754. loop evensl2
  3755. pop dx
  3756. ; Load a word of the pointer image, convert it to two bits per
  3757. ; pixel and write to the screen for odd scanlines
  3758. mov si,[mode4SelectedPointer]
  3759. add si,48+3
  3760. mov di,bp
  3761. add di,02000h ; offset into video buffer
  3762. ; the video buffer
  3763. mov cl,dl ; number of odd scanlines to draw
  3764. oddsl2:
  3765. mov dx,3
  3766. norept17:
  3767. lodsb ; load 8 pixels from bitmap
  3768. xor bh,bh
  3769. mov bl,al ; copy into a base register
  3770. shl bx,1 ; create a word address
  3771. mov ax,[LUT1to2bit+bx] ; get the byte to word conversion
  3772. xchg al,ah
  3773. mov bx,es:[di] ; get the current displayed 8 pixels
  3774. xor ax,bx ; XOR the XOR mask in
  3775. stosw ; write to the video buffer
  3776. dec dx
  3777. jnz norept17
  3778. add si,3
  3779. add di,80-6
  3780. loop oddsl2
  3781. pop es
  3782. popa
  3783. ret
  3784. ; ANDODD ANDODD ANDODD ANDODD ANDODD ANDODD ANDODD ANDODD ANDODD ANDODD ANDODD
  3785. ;
  3786. ; This part of the code draws the pointer on an odd numbered scanline
  3787. ; of the video display. Since the video buffer is split, 0000 to 1fff
  3788. ; containing even scanlines and 2000 to 3fff containing odd, the data
  3789. ; must be manipulated in a subtly different fashion than that of the
  3790. ; even display scanline code.
  3791. ; The even scanline code display arrangement falls through naturally,
  3792. ; with an even scanline drawing thus:
  3793. ; buffer 0: scanline 0
  3794. ; buffer 1: scanline 0
  3795. ; buffer 0: scanline 1
  3796. ; buffer 1: scanline 1
  3797. ; buffer 0: scanline 2
  3798. ; buffer 1: scanline 2 etc.
  3799. ; whereas in the odd case:
  3800. ; buffer 1: scanline 0
  3801. ; buffer 0: scanline 0
  3802. ; buffer 1: scanline 1
  3803. ; buffer 0: scanline 1
  3804. ; buffer 1: scanline 2
  3805. ; buffer 0: scanline 2 etc.
  3806. ; and this requires that the odd image scanlines must be placed
  3807. ; one scanline lower in the even buffer than the even image scanlines
  3808. ; do in the odd buffer
  3809. drawonoddscanline:
  3810. ; Load a word of the pointer image, convert it to two bits per
  3811. ; pixel and write to the screen for odd scanlines
  3812. mov si,[mode4SelectedPointer]
  3813. add di,02000h ; offset into video buffer
  3814. ; the video buffer
  3815. xor cx,cx
  3816. mov cl,dl ; number of odd scanlines to draw
  3817. push dx
  3818. oddsl3:
  3819. mov dx,3
  3820. norept18:
  3821. lodsb ; load 8 pixels from bitmap
  3822. xor bh,bh
  3823. mov bl,al ; copy into a base register
  3824. shl bx,1 ; create a word address
  3825. mov ax,[LUT1to2bit+bx] ; get the byte to word conversion
  3826. xchg al,ah
  3827. mov bx,es:[di] ; get the current displayed 8 pixels
  3828. and ax,bx ; AND the AND mask in
  3829. stosw ; write to the video buffer
  3830. dec dx
  3831. jnz norept18
  3832. add si,3
  3833. add di,80-6
  3834. loop oddsl3
  3835. pop dx
  3836. ; Load a word of the pointer image, convert it to two bits per
  3837. ; pixel and write to the screen for even scanlines
  3838. and dh,dh
  3839. jz dontdothis1 ; can't do the loop 0 times
  3840. mov si,[mode4SelectedPointer]
  3841. add si,3
  3842. mov di,bp
  3843. add di,6 ; This is required to align the
  3844. ; even and odd scanlines together
  3845. mov cl,dh ; number of even scanlines to draw
  3846. push dx
  3847. evensl3:
  3848. add di,80-6 ; remember even BELOW odd
  3849. mov dx,3
  3850. norept19:
  3851. lodsb ; load 8 pixels from bitmap
  3852. xor bh,bh
  3853. mov bl,al ; copy into a base register
  3854. shl bx,1 ; create a word address
  3855. mov ax,[LUT1to2bit+bx] ; get the byte to word conversion
  3856. xchg al,ah
  3857. mov bx,es:[di] ; get the current displayed 8 pixels
  3858. and ax,bx ; AND the AND mask in
  3859. stosw ; write to the video buffer
  3860. dec dx
  3861. jnz norept19
  3862. add si,3
  3863. loop evensl3
  3864. pop dx
  3865. dontdothis1:
  3866. ; XORODD XORODD XORODD XORODD XORODD XORODD XORODD XORODD XORODD XORODD XORODD
  3867. mov si,[mode4SelectedPointer]
  3868. add si,48
  3869. mov di,bp ; offset into video buffer
  3870. add di,02000h ; offset into video buffer
  3871. ; the video buffer
  3872. ; Load a word of the pointer image, convert it to two bits per
  3873. ; pixel and write to the screen for odd scanlines
  3874. mov cl,dl ; number of odd scanlines to draw
  3875. push dx
  3876. oddsl4:
  3877. mov dx,3
  3878. norept20:
  3879. lodsb ; load 8 pixels from bitmap
  3880. xor bh,bh
  3881. mov bl,al ; copy into a base register
  3882. shl bx,1 ; create a word address
  3883. mov ax,[LUT1to2bit+bx] ; get the byte to word conversion
  3884. xchg al,ah
  3885. mov bx,es:[di] ; get the current displayed 8 pixels
  3886. xor ax,bx ; XOR the XOR mask in
  3887. stosw ; write to the video buffer
  3888. dec dx
  3889. jnz norept20
  3890. add si,3
  3891. add di,80-6
  3892. loop oddsl4
  3893. pop dx
  3894. ; Load a word of the pointer image, convert it to two bits per
  3895. ; pixel and write to the screen for even scanlines
  3896. and dh,dh ; can't do a loop 0 times
  3897. jz dontdothis2
  3898. mov si,[mode4SelectedPointer]
  3899. add si,48+3
  3900. mov di,bp
  3901. add di,6
  3902. mov cl,dh ; number of even scanlines to draw
  3903. evensl4:
  3904. add di,80-6
  3905. mov dx,3
  3906. norept21:
  3907. lodsb ; load 8 pixels from bitmap
  3908. xor bh,bh
  3909. mov bl,al ; copy into a base register
  3910. shl bx,1 ; create a word address
  3911. mov ax,[LUT1to2bit+bx] ; get the byte to word conversion
  3912. xchg al,ah
  3913. mov bx,es:[di] ; get the current displayed 8 pixels
  3914. xor ax,bx ; XOR the XOR mask in
  3915. stosw ; write to the video buffer
  3916. dec dx
  3917. jnz norept21
  3918. add si,3
  3919. loop evensl4
  3920. dontdothis2:
  3921. ; XORXORXORXORXORXORXORXORXORXORXORXORXORXORXORXORXORXORXORXORXORXORXORXOR
  3922. pop es
  3923. popa
  3924. ret
  3925. drawmode4pointer endp
  3926. ;========================================================================
  3927. ; Procedure to determine what the byte and bit offset is, in the current
  3928. ; VGA buffer for the top left hand corner of the pointer bitmap.
  3929. ; The X,Y value is modified for hotspot in this routine.
  3930. ; Y looping counter(ODD and EVEN) are also returned
  3931. ; The CGA buffer is interleaved, and runs from B800:0000 to B800:1999 for
  3932. ; odd scanlines and from B800:2000 for even scanlines.
  3933. ;
  3934. ; INPUT: CX,DX = pointer x,y coordinates
  3935. ; OUT :
  3936. ; carry set if either X or Y is out of screen
  3937. ; DX = byte offset to top left hand pointer pixel of the pointer
  3938. ; CL = bit offset in the byte
  3939. ; CH = 0FFh if ODD, 0 if EVEN
  3940. ; BP = Y loop counter(ODD in LSB and EVEN in MSB)
  3941. ;========================================================================
  3942. detboundmode4 proc near
  3943. push ax
  3944. push bx
  3945. push ds
  3946. mov ax,cs
  3947. mov ds,ax
  3948. assume ds:SpcMseSeg
  3949. ; do the adjustment in x,y for pointer hotspot
  3950. ; modify the raw X,Y values for hotspot
  3951. sub cx,[hotspot] ; adjust the x cartesian coord for hotspot
  3952. jns dont_zero_xmode4; if x goes negative, assume zero
  3953. xor cx,cx
  3954. dont_zero_xmode4:
  3955. sub dx,[hotspot+2] ; adjust the y cartesian coord for the hotspot
  3956. jns dont_zero_ymode4; if y goes negative, assume zero
  3957. xor dx,dx
  3958. dont_zero_ymode4:
  3959. cmp cx, 320 ;
  3960. jae detboundmode4_exit ; CY is cleared
  3961. cmp dx, 200
  3962. jae detboundmode4_exit ; CY is cleared
  3963. ; determine the byte offset from the start of the video buffer
  3964. ; for the modified coordinates. First calculate how many bytes
  3965. ; there are for the number of scanlines -1 to where the pointer
  3966. ; is. Also if the pointer starts on a odd scanline, set CF, else
  3967. ; clear CF.
  3968. mov ax,dx ; copy Y position into AX
  3969. mov bp,dx ; copy Y position into BP for use later
  3970. ; CGA video buffer is split in two. Therefore, screen scanline 0 maps
  3971. ; to video buffer scanline 0 and screen scanline 1 maps to video
  3972. ; buffer+2000h, scanline 0
  3973. and ax,0fffeh ; do the mapping 0->0, 1->0, 2->1, 3->1 etc.
  3974. ; and create a word table index
  3975. mov bx, ax ; copy table index into a base register
  3976. ; 2bits/pixel -> 4 pixels/byte
  3977. ; sine x total is 320, we have 80bytes
  3978. ; so a shl bx, 1 will be wrong.
  3979. mov dx,[mult80lut+bx] ; do a fast LUT multiply by 80
  3980. ; determine the byte position of the pixel in question
  3981. mov ax,cx ; save the x-coordinate displacement
  3982. and ax,3 ; do a modulus 4 to find the pixel position
  3983. ; in the byte. The byte number will be in DX.
  3984. ; add the whole number of bytes in the current row to the number
  3985. ; of complete-row bytes. Note that mode 4 is 2bits per pixel, so
  3986. ; there are four pixels represented by one byte.
  3987. mov bx,cx ; Save in a base reg. to create a table index
  3988. shl bx,1 ; Create a table index for word sized entries
  3989. add dx,[mode4clipCXadjustLUT+bx]; DX hold the complete byte offset.
  3990. mov cx, ax ; CX = bit offset in the byte.
  3991. mov ax, [mode4pointerLUT + bx] ; select appropriate pointer
  3992. mov [mode4SelectedPointer], ax
  3993. ; Odd or Even scanline? note BP contains y cartesian coordinate
  3994. mov bx, bp ; y coordinate
  3995. shr bp, 1 ; shift right to determine if odd or even
  3996. ; CF if odd, or 0 if even.
  3997. sbb ch, ch ; CH = 0FFh if ODD, 0 if EVEN
  3998. shl bx, 1
  3999. mov bp, [mode4clipDXLUT + bx] ;the Y counters
  4000. stc ; we are fine, set the CY so we will return
  4001. ; CY cleared.
  4002. detboundmode4_exit:
  4003. cmc ; revese the CY
  4004. pop ds
  4005. pop bx
  4006. pop ax
  4007. ret
  4008. detboundmode4 endp
  4009. ;=============================================================================
  4010. ; Procedure to save the area of CGA video buffer into which the pointer will
  4011. ; be drawn. The memory buffer in which this data is stored is arranged odd
  4012. ; scanlines first, then even. So, the first 48 bytes are the odd scanline
  4013. ; data.
  4014. ;
  4015. ; Input: DX = byte offset
  4016. ; CL = bit offset in the byte
  4017. ; CH = 0FFh if ODD, 0 if EVEN
  4018. ; BP = Y loop counter, ODD in LSB, EVEN in MSB
  4019. ;
  4020. ;=============================================================================
  4021. savebkgrndmode4 proc near
  4022. pusha
  4023. push es
  4024. push ds
  4025. ; set up the segment registers as required
  4026. mov ax,ds
  4027. mov es,ax
  4028. mov ax,0b800h
  4029. mov ds,ax
  4030. assume ds:nothing, es:SpcMseSeg
  4031. mov si,dx ; start the save.
  4032. or ch, ch
  4033. je svbkeven ; check the returned carry flag
  4034. ; the image's first scanline is odd
  4035. mov di,offset CGAbackgrnd ; where the background will be saved
  4036. mov bx,bp ; set the loop counter up
  4037. xor bh,bh ; don't want unwanted mess in MSB
  4038. add si,2000h ; odd part of buffer starts at 2000h
  4039. svodd1:
  4040. mov cx,3 ; copy six bytes
  4041. rep movsw ; do the image scanline save
  4042. add si,80-6 ; point to the next scanline
  4043. dec bx ; decrement the loop counter
  4044. jnz svodd1 ; do more scanlines if necessary
  4045. ; save some even scanlines if need be.
  4046. mov si,dx ; offset into CGA buffer
  4047. add si, 80
  4048. mov bx,bp ; set up the loop counter
  4049. xchg bl,bh ; get the even part of loop counter
  4050. xor bh,bh ; trash the top end trash
  4051. and bx,bx ; check for a zero loop
  4052. jz misseven ; can't have a loop which execs 0 times
  4053. mov di,offset CGAbackgrnd+48; where the background will be saved
  4054. sveven1:
  4055. mov cx,3 ; copy six bytes = 24 pixels
  4056. rep movsw ; do the scanline save
  4057. add si,80-6 ; point to the next scanline
  4058. dec bx ; decrement the loop counter
  4059. jnz sveven1 ; do more scanlines if necessary
  4060. misseven: ; jump to here if there are no even scanlines to draw
  4061. jmp short endsavemode4
  4062. svbkeven: ; the image's first scanline is even
  4063. mov di,offset CGAbackgrnd+48; where the background will be saved
  4064. mov bx,bp ; get the loop counter
  4065. xchg bl,bh ; rearrage to get the even part
  4066. xor bh,bh ; clear out the trash
  4067. sveven2:
  4068. mov cx,3 ; copy six bytes
  4069. rep movsw ; do the copy
  4070. add si,80-6 ; point to the next scanline
  4071. dec bx ; decrement the loop counter
  4072. jnz sveven2 ; do more scanlines if necessary
  4073. mov si,dx ; offset into CGA buffer
  4074. add si,2000h ; odd part of the video buffer
  4075. mov di,offset CGAbackgrnd ; where to save the odd scanlines
  4076. mov bx,bp ; get the loop counter
  4077. xor bh,bh ; clear out the unwanted trash
  4078. svodd2:
  4079. mov cx,3 ; copy six bytes
  4080. rep movsw ; do the copy
  4081. add si,80-6 ; point to the next scanline
  4082. dec bx ; decrement the loop counter
  4083. jnz svodd2 ; do more scanlines if necessary
  4084. endsavemode4:
  4085. assume ds:SpcMseSeg, es:nothing
  4086. pop ds
  4087. pop es
  4088. popa
  4089. ret
  4090. savebkgrndmode4 endp
  4091. ;=============================================================================
  4092. ; Procedure to restore the area of CGA video buffer into which the pointer
  4093. ; was drawn. The memory buffer in which this data is stored is arranged
  4094. ; odd scanlines first, then even. So, the first 48 bytes are the odd scanline
  4095. ; data.
  4096. ;
  4097. ; Input:
  4098. ; DX = byte offset to top left hand pointer pixel of the pointer
  4099. ; CL = bit offset in the byte
  4100. ; CH = 0FFh if ODD, 0 if EVEN
  4101. ; BP = Y loop counter(ODD in LSB and EVEN in MSB)
  4102. ;
  4103. ;=============================================================================
  4104. restorebkgrndmode4 proc near
  4105. pusha
  4106. push es
  4107. ; set up the segment registers as required
  4108. mov ax,0b800h
  4109. mov es,ax
  4110. mov di,dx ; restore background
  4111. or ch, ch
  4112. je rsbkeven ; check the returned carry flag
  4113. ; the image's first scanline is odd. The CGA buffer is translated
  4114. ; so that a scanline (row N) from the even part of the buffer appears
  4115. ; on the screen at raster I. The scanline at position N from the
  4116. ; odd part of the video buffer maps to screen position I+1. If the
  4117. ; 1st. scanline is odd, then this is drawn at raster A and the
  4118. ; following algorithm draws the 1st. even row at raster A+1 to
  4119. ; compensate for the video buffer arrangement.
  4120. mov si,offset CGAbackgrnd ; where the background is be saved
  4121. add di,2000h ; do the odd buffer
  4122. mov bx,bp ; set the loop counter up
  4123. xor bh,bh ; clear out the MSB trash
  4124. rsodd1:
  4125. mov cx,3 ; copy six bytes
  4126. rep movsw ; do the restore
  4127. add di,80-6 ; point to the next odd scanline
  4128. dec bx ; decrement the loop counter
  4129. jnz rsodd1 ; restore more even scanlines if needed
  4130. mov bx,bp ; let the loop counter
  4131. xchg bl,bh ; get the even part
  4132. xor bh,bh ; clear out the MSB trash
  4133. and bx,bx ; test for zero even scanlines
  4134. jz misseven1rs ; can't have a zero execute loop
  4135. mov di,dx ; offset into CGA buffer
  4136. add di,80 ; get the odd/even scanlines instep
  4137. mov si,offset CGAbackgrnd+48; where the background is be saved
  4138. rseven1:
  4139. mov cx,3 ; restore six bytes
  4140. rep movsw ; do the restore
  4141. add di,80-6 ; point to the next even scanline
  4142. dec bx ; decrement the loop counter
  4143. jnz rseven1 ; restore more even scanlines if needed
  4144. misseven1rs: ; jump to here if there are no even scanlines to be restored.
  4145. jmp short endrestoremode4
  4146. rsbkeven: ; the image's first scanline is even
  4147. mov si,offset CGAbackgrnd+48; where the background will be saved
  4148. mov bx,bp ; get the loop counter
  4149. xchg bl,bh ; get the even part of the loop counter
  4150. xor bh,bh ; scrap the MSB trash
  4151. rseven2:
  4152. mov cx,3 ; restore six bytes
  4153. rep movsw ; do the restore
  4154. add di,80-6 ; point to the next even scanline
  4155. dec bx ; decrement the loop counter
  4156. jnz rseven2 ; do more even scanlines if needed
  4157. mov di,dx ; offset into CGA buffer
  4158. add di,2000h ; do the odd buffer
  4159. mov si,offset CGAbackgrnd ; where to save the odd scanlines
  4160. mov bx,bp ; set the loop counter up
  4161. xor bh,bh ; scrap the MSB trash
  4162. rsodd2:
  4163. mov cx,3 ; restore six bytes
  4164. rep movsw ; do the restore
  4165. add di,80-6 ; point to the next odd scanline
  4166. dec bx ; decrement the loop counter
  4167. jnz rsodd2 ; restore more odd scanlines if needed
  4168. endrestoremode4:
  4169. assume ds:SpcMseSeg, es:nothing
  4170. pop es
  4171. popa
  4172. ret
  4173. restorebkgrndmode4 endp
  4174. ;============================================================================
  4175. ; Procedure to draw the pointer image into the video buffer for mode 13h
  4176. ; VGA graphics.
  4177. ;
  4178. ; Input:
  4179. ; DX = byte offset
  4180. ; BP = Y loop counter
  4181. ; CX = X loop counter
  4182. ;
  4183. ;============================================================================
  4184. draw256pointer proc near
  4185. pusha
  4186. push es
  4187. push ds
  4188. mov ax,0a000h ; point to the 256 colour mode video buffer
  4189. mov es,ax
  4190. mov ax,cs
  4191. mov ds,ax
  4192. assume ds:SpcMseSeg, es:nothing
  4193. cld ; write forward through the buffer
  4194. ; DX = TLHC pixel offset in the video buffer.
  4195. mov di,dx ; point DI at the video buffer location of fun
  4196. mov si, offset current_cursor ; we only use this cursor shape
  4197. ; because every pixel is on byte
  4198. ; boundary. The X counter would
  4199. ; take care of X clipping
  4200. y_256:
  4201. push cx
  4202. lodsw ;and mask
  4203. mov dx, [si + 48 - 2] ;xor mask
  4204. inc si ;we don't need the third byte
  4205. xchg al, ah ; byte sequence
  4206. xchg dh, dl ;
  4207. x_256:
  4208. shl ax, 1 ;AND mask bit
  4209. sbb bl, bl ; bl = 0FFf if CY, 0 if not CY
  4210. and bl, es:[di] ;and the target and save the result
  4211. shl dx, 1 ;XOR mask bit
  4212. sbb bh, bh ;
  4213. xor bl, bh ;xor with the save result
  4214. mov es:[di], bl ;update the target
  4215. inc di ;next pixel
  4216. loop x_256 ;until this scan line is done
  4217. pop cx ;recovery X loop counter
  4218. add di, 320 ;target address to next scan line
  4219. sub di, cx
  4220. dec bp ;Y counter
  4221. jne y_256
  4222. pop ds
  4223. pop es
  4224. popa
  4225. ret
  4226. draw256pointer endp
  4227. ;=============================================================================
  4228. ; Procedure to save the area of 256 colour mode video buffer into which the
  4229. ; pointer will be drawn. The memory buffer in which this data is stored is
  4230. ; arranged odd scanlines first, then even. So, the first 48 bytes are the odd
  4231. ; scanline data.
  4232. ;
  4233. ; Input:
  4234. ; DX = byte offset
  4235. ; BP = Y loop counter
  4236. ; CX = X loop counter
  4237. ;
  4238. ;=============================================================================
  4239. savebkgrndmode13 proc near
  4240. pusha
  4241. push es
  4242. push ds
  4243. mov di,offset bkgrnd256 ; point to the area in which backgound
  4244. ; data will be saved
  4245. mov si,dx ; SOURCE: the video buffer at x,y
  4246. mov ax,0a000h
  4247. mov ds,ax
  4248. mov ax,cs
  4249. mov es,ax
  4250. mov bx, cx ;x counter
  4251. mov dx, 320
  4252. sub dx, bx
  4253. assume ds:nothing, es:SpcMseSeg
  4254. cld
  4255. save_256_loop:
  4256. mov cx, bx
  4257. shr cx, 1
  4258. rep movsw
  4259. adc cl, 0
  4260. rep movsb
  4261. add si, dx ; next scan line offset
  4262. dec bp ; until Y counter is done
  4263. jne save_256_loop
  4264. pop ds
  4265. pop es
  4266. assume es:nothing, ds:SpcMseSeg
  4267. popa
  4268. ret
  4269. savebkgrndmode13 endp
  4270. ;=============================================================================
  4271. ; Procedure to replace an existing pointer image in the 256 colour video
  4272. ; buffer with the data that was there previous to the pointer draw operation.
  4273. ; The data is stored in an internal (to the driver) buffer.
  4274. ;
  4275. ; Input:
  4276. ; DX = byte offset
  4277. ; BP = Y loop counter
  4278. ; CX = X loop counter
  4279. ;
  4280. ;=============================================================================
  4281. restorebkgrndmode13 proc near
  4282. pusha
  4283. push es
  4284. mov di,dx ; DESTINATION: in the VRAM
  4285. mov ax,0a000h ; point a segment register at video buffer
  4286. mov es,ax
  4287. assume es:nothing
  4288. mov bx, cx
  4289. mov si,offset bkgrnd256 ; where the data is saved
  4290. mov dx, 320
  4291. sub dx, bx
  4292. cld ; write forward in memory
  4293. restore_256_loop:
  4294. mov cx, bx
  4295. shr cx, 1
  4296. rep movsw
  4297. adc cl, 0
  4298. rep movsb
  4299. add di, dx
  4300. dec bp
  4301. jne restore_256_loop
  4302. pop es
  4303. popa
  4304. ret
  4305. restorebkgrndmode13 endp
  4306. ;========================================================================
  4307. ; Procedure to determine what the byte offset is, in the current
  4308. ; VGA buffer for the top left hand corner of the pointer bitmap.
  4309. ; The X,Y value is modified for hotspot in this routine. X and Y looping
  4310. ; counters are also returned.
  4311. ;
  4312. ; INPUT: CX,DX = pointer x,y coordinates
  4313. ; OUT :
  4314. ; carry set if either X or Y is out of screen
  4315. ; DX = byte offset to top left hand pointer pixel of the pointer
  4316. ; CX = X counter
  4317. ; BP = Y counter
  4318. ;========================================================================
  4319. detboundmode13 proc near
  4320. push ax
  4321. push bx
  4322. push ds
  4323. mov ax,cs
  4324. mov ds,ax
  4325. assume ds:SpcMseSeg
  4326. ; do the adjustment in x,y for pointer hotspot
  4327. ; modify the raw X,Y values for hotspot
  4328. sub cx,[hotspot] ; adjust the x cartesian coord for hotspot
  4329. jns dont_zero_xmode13; if x goes negative, assume zero
  4330. xor cx,cx
  4331. dont_zero_xmode13:
  4332. sub dx,[hotspot+2] ; adjust the y cartesian coord for the hotspot
  4333. jns dont_zero_ymode13; if y goes negative, assume zero
  4334. xor dx,dx
  4335. dont_zero_ymode13:
  4336. cmp cx, 320
  4337. jae detboundmode13_exit ; CY is cleared
  4338. cmp dx, 200 ;
  4339. jae detboundmode13_exit ; CY is cleared
  4340. ; CX and DX are now validated for the following section: buffer
  4341. ; offset determination. Note, unlike other video modes, mode 13
  4342. ; provides a direct mapping of the video display to video buffer.
  4343. ; in other words; 1 byte represents 1 pixel. From this, it is not
  4344. ; necessary to provide byte alignment data.
  4345. mov bx,dx ; save in a base register
  4346. shl bx,1 ; create a word table index
  4347. mov dx,[mult320LUT+bx] ; do the multiply by 320
  4348. ; add in the offset along the current raster.
  4349. add dx,cx ; cx contains the byte offset from
  4350. mov ax,[mode4clipDXLUT + bx]; get Y loop counter from table
  4351. add al, ah ; the table has ODD/EVEN counters
  4352. cbw
  4353. mov bp, ax ; the final Y counter
  4354. ; column 0.
  4355. mov ax, 320 ; calculate X loop counter
  4356. sub ax, cx
  4357. cmp ax, 16 ;
  4358. jl set_new_x_counter
  4359. mov ax, 16
  4360. set_new_x_counter:
  4361. mov cx, ax ; X counter
  4362. stc ; everything is fine, set CY
  4363. ; so we will return CY cleared
  4364. detboundmode13_exit:
  4365. cmc ; complement the CY
  4366. pop ds
  4367. pop bx
  4368. pop ax
  4369. ret
  4370. detboundmode13 endp
  4371. public SpcMseEnd
  4372. SpcMseEnd label byte
  4373. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4374. ;
  4375. ; Installation Code From Here Downwards
  4376. ;
  4377. ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4378. ; segment:offset table for redirected mouse functions for real rom version.
  4379. mio_table dw 38 dup(?)
  4380. assume cs:SpcMseSeg,ds:nothing,es:nothing
  4381. public InstSpcMse
  4382. ;
  4383. ; InstSpcMse - Installs the softpc mouse driver code
  4384. ;
  4385. ; Inputs: ds == Resident location of SpcMseSeg
  4386. ; Outputs: None
  4387. ;
  4388. InstSpcMse proc near
  4389. ;;;;;;;;;;;;;;;;do ret to use old mouse driver;;; ret
  4390. pusha
  4391. ; save old int 10 vector
  4392. xor ax,ax
  4393. mov es,ax
  4394. mov ax,es:[40h]
  4395. mov si,offset old_vid_int
  4396. mov word ptr ds:[si],ax
  4397. mov ax,es:[42h]
  4398. mov word ptr ds:[si+2],ax
  4399. mov bx,ds
  4400. mov si,offset sysinitgrp:mio_table
  4401. push ds
  4402. push cs
  4403. pop ds
  4404. mov word ptr ds:[si], offset mouse_io
  4405. mov word ptr ds:[si+2],bx
  4406. IFDEF MOUSE_VIDEO_BIOS
  4407. mov word ptr ds:[si+4],offset mouse_video_io
  4408. mov word ptr ds:[si+6],bx
  4409. ENDIF ; MOUSE_VIDEO_BIOS
  4410. mov word ptr ds:[si+8],offset mouse_int1
  4411. mov word ptr ds:[si+10],bx
  4412. mov word ptr ds:[si+12], offset mouse_version
  4413. mov word ptr ds:[si+14],bx
  4414. mov word ptr ds:[si+16],offset mouse_copyright
  4415. mov word ptr ds:[si+18],bx
  4416. mov word ptr ds:[si+20],offset video_io
  4417. mov word ptr ds:[si+22],bx
  4418. mov word ptr ds:[si+24],offset mouse_int2
  4419. mov word ptr ds:[si+26],bx
  4420. mov word ptr ds:[si+28],offset entry_point_from_32bit
  4421. mov word ptr ds:[si+30],bx
  4422. mov word ptr ds:[si+32],offset int33function0
  4423. mov word ptr ds:[si+34],bx
  4424. mov word ptr ds:[si+36],offset int33function1
  4425. mov word ptr ds:[si+38],bx
  4426. mov word ptr ds:[si+40],offset int33function2
  4427. mov word ptr ds:[si+42],bx
  4428. mov word ptr ds:[si+44],offset int33function9
  4429. mov word ptr ds:[si+46],bx
  4430. mov word ptr ds:[si+48],offset current_position_x
  4431. mov word ptr ds:[si+50],bx
  4432. mov word ptr ds:[si+52],offset current_position_y
  4433. mov word ptr ds:[si+54],bx
  4434. mov word ptr ds:[si+56],offset mouseINB
  4435. mov word ptr ds:[si+58],bx
  4436. mov word ptr ds:[si+60],offset mouseOUTB
  4437. mov word ptr ds:[si+62],bx
  4438. mov word ptr ds:[si+64],offset mouseOUTW
  4439. mov word ptr ds:[si+66],bx
  4440. mov word ptr ds:[si+68],offset VRAMlasttextcelloff
  4441. mov word ptr ds:[si+70],bx
  4442. mov word ptr ds:[si+72],offset internalCF
  4443. mov word ptr ds:[si+74],bx
  4444. mov word ptr ds:[si+76],offset function3data
  4445. mov word ptr ds:[si+78],bx
  4446. mov word ptr ds:[si+80],offset conditional_off
  4447. mov word ptr ds:[si+82],bx
  4448. pop ds
  4449. mov bx, offset sysinitgrp:mio_table
  4450. bop 0C8h ; Host mouse installer BOP
  4451. ; get the freshly written int 33h vector from IVT
  4452. ; write the vector segment:offset data to the jump patch
  4453. xor ax,ax
  4454. mov es,ax
  4455. mov ax,es:[33h*4]
  4456. mov bx,es:[(33h*4)+2]
  4457. mov si,offset moff
  4458. mov word ptr ds:[si],ax
  4459. mov word ptr ds:[si+2],bx
  4460. add ax,2 ; HLL entry point
  4461. mov si,offset loffset
  4462. mov word ptr ds:[si],ax
  4463. mov word ptr ds:[si+2],bx
  4464. ; write the new value to the IVT
  4465. call DOCLI
  4466. mov bx, offset int33h_vector
  4467. mov word ptr es:[33h*4], bx
  4468. mov bx, ds
  4469. mov word ptr es:[(33h*4)+2], bx
  4470. call DOSTI
  4471. popa
  4472. ret
  4473. InstSpcMse endp
  4474. SpcMseSeg ends
  4475. end