phat code If brute force doesn't solve your problems, then you aren't using enough.
Main

Projects

Downloads

Articles

Links

Forum

 

View Message

Back to Messages
Peter Swinkels Thu Jan 23 2025 at 7:57 am
Success! Mouse wrapper is working!
 
 
I got it to work in both QuickBASIC 4.5 and QBasic 1.1! :-)

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 = 1
 Registers.cx = 0
 Registers.dx = 0
 Registers.bx = 0
 CallInt33h

 DO
  Registers.ax = 3
  Registers.cx = 0
  Registers.dx = 0
  Registers.bx = 0
  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

===

; Mouse interrupt wrapper for QBasic's CALL ABSOLUTE.
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.
 
 
 
 

Reply to this Message

Name
Subject
Message

No HTML is allowed, except for <code> <b> <i> <u> in the message only.
All URLs and email addresses will automatically be converted to hyperlinks.