I'm using QBASIC version QB45
I'm using the classic code snippet to get the state of the mouse, through a system interrupt :
STATIC Regs as RegType
Regs.ax = &H0
CALL INTERRUPT(&H33, Regs, Regs)
IF Regs.ax = &HFFFF THEN
PRINT "ooops! No Mouse!"
SYSTEM
ENDIF
When I run the program, it does fail with "oooops! No mouse!"
I know that there is a mouse and that MS-DOS is not bothered by DosBox, as the mouse does work in the QBASIC graphical interface and I'm using it. It's only inside my program that it doesn't work.
Any idea?
There were two distinct issues:
There was an issue with the
STATIC. I thought it meant "local variable2 in QBASIC. So I removed it.despite Reg.ax being negative, the mouse still works. I can read CX, DX to get the mouse position and BX to get the buttons status.
Which leads to the core issue : Why does Dosbox say that there's no mouse available when I can display it and show it?
Maybe I simply misunderstand the meaning of "negative AX"; maybe it just means "no driver" but the mouse still works magically. For example, this page does not mention a possible negative result : https://www.equestionanswers.com/c/c-int33-mouse-service.php
Dosbox has an
int33=falsesetting, maybe it has something to do with it. See https://github.com/joncampbell123/dosbox-x/issues/1315I've updated my code to use INTERRUPTX instead of INTERRUPT: