A mouse interrupt caller for QBasic:
Code:
; Mouse interrupt call procedure for QBasic.
push bp ; Save previous bp.
mov bp,sp ; Set new bp.
push si ; Save si.
mov si,[bp+6] ; Load registers structure offset.
mov ax,[si] ; Load values into CPU registers.
mov cx,[si+2] ;
mov dx,[si+4] ;
mov bx,[si+6] ;
int 0x33 ; Call mouse interrupt.
mov [si],ax ; Save CPU registers to structure.
mov [si+2],cx ;
mov [si+4],dx ;
mov [si+6],bx ;
pop si ; Restore si.
pop bp ; Restore bp.
retf 2 ; Return and remove arguments from stack.
Just compile it with Nasm or similar.
A QBasic example:
Code:
DEFINT A-Z
TYPE RegistersStr
ax AS INTEGER
cx AS INTEGER
dx AS INTEGER
bx AS INTEGER
END TYPE
DECLARE FUNCTION LoadWrapper$ ()
DECLARE SUB CallInt33h ()
DIM SHARED Int33h AS STRING
DIM SHARED Registers AS RegistersStr
CLS
Int33h = LoadWrapper$
Registers.ax = &H1
Registers.cx = &H0
Registers.dx = &H0
Registers.bx = &H0
CallInt33h
DO
Registers.ax = &H3
Registers.cx = &H0
Registers.dx = &H0
Registers.bx = &H0
CallInt33h
LOCATE 1, 1: PRINT Registers.cx, Registers.dx, " ";
LOOP WHILE INKEY$ = ""
END
SUB CallInt33h
DEF SEG = VARSEG(Int33h)
CALL ABSOLUTE(Registers, SADD(Int33h))
END SUB
FUNCTION LoadWrapper$
DIM FileH AS INTEGER
FileH = FREEFILE
OPEN "Int33h.BIN" FOR INPUT LOCK READ WRITE AS FileH
CLOSE FileH
FileH = FREEFILE
OPEN "Int33h.BIN" FOR BINARY LOCK READ WRITE AS FileH
Int33h = INPUT$(LOF(FileH), FileH)
CLOSE FileH
LoadWrapper$ = Int33h
END FUNCTION
Tested with QBasic 1.1 and QuickBASIC 4.5. Probably works with QuickBASIC 7.1 and VBDos too.
Changing it to handle other registers and interrupts should be simple. :-)
New versions of programs originally for qb45 changed to work with QBasic will likely be released in the near future! :-)