1 ; TSR hack that allows QBasic programs to use mouse.
\r
2 ; Made by Svjatoslav Agejenko
\r
4 ; Homepage: http://svjatoslav.eu
\r
9 myint = 79h ; interrupt to hook, becomes pointer to data table
\r
16 mov ax, 0 ; Saves old interrupt vector
\r
19 mov [oldVector], eax
\r
22 mov ax, cs ; Set new interrupt vector for IRQ 0
\r
26 mov ax, dataTable ; Set interrupt vector for INT 79 (default)
\r
27 mov [es:4 * myint], eax
\r
30 mov ax, endPointer ; Calculate needed memory size, become TSR
\r
40 pushf ; Execute default code in old int vector
\r
41 call dword [cs:oldVector]
\r
43 cmp [cs:isRunning], 0 ; Check if custom routine is already active
\r
46 mov [cs:isRunning], 1 ; Set active flag
\r
52 mov ax, 0bh ; Read Mouse Motion Counters
\r
54 add [CS:mouseHorisontal], cx
\r
55 add [CS:mouseVertical], dx
\r
56 mov ax, 3 ; read mouse buttons
\r
58 or [CS:mouseButtons], bx
\r
59 inc byte [CS:updated]
\r
65 mov [cs:isRunning], 0 ; Terminate active flag
\r
73 dw 1983 ; check number, indicates that module is loaded
\r
74 mouseHorisontal dw 0
\r