|
View Message | Back to Messages |
Peter Swinkels Sat Jan 18 2025 at 8:48 am Revised mouse interrupt wrapper for QBASIC->
; Mouse interrupt wrapper for QBasic's CALL ABSOLUTE.
push bp ; Save previous bp.
mov bp,sp ; Set new bp.
push si ; Save si.
mov ax,[bp+8] ; Load argument 1,
mov cx,[bp+10] ; 2,
mov dx,[bp+12] ; 3,
mov bx,[bp+14] ; 4.
int 0x33 ; Mouse.
mov si,[bp+8] ; First argument (ax).
mov [si],ax ; Save to argument 1,
mov [si+2],cx ; 2,
mov [si+4],dx ; 3,
mov [si+6],bx ; 4.
pop si ; Restore si,
pop bp ; bp.
retf 8 ; Return and remove the arguments from the stack.
===
After fixing the wrong other of the registers and changing "ret" to "retf" (The example in QuickBASIC should have been more clearer on that imho.) it no longer freezes.
However, it does appear to be causing memory corruption because the code displayed in the IDE is corrupted after execution. It seems some tokenized copy of my code in memory is being modified.
===
DEFINT A-Z
DIM Int33h AS STRING
CLS
OPEN "INT33H.BIN" FOR INPUT AS 1: CLOSE 1
OPEN "INT33H.BIN" FOR BINARY AS 1
Int33h = INPUT$(LOF(1), 1)
CLOSE 1
ax% = 2
cx% = 0
dx% = 0
bx% = 0
PRINT "AX="; ax%
PRINT "CX="; cx%
PRINT "DX="; dx%
PRINT "BX="; bx%
DEF SEG = VARSEG(Int33h)
CALL ABSOLUTE(ax, cx, dx, bx, SADD(Int33h))
PRINT "AX="; ax%
PRINT "CX="; cx%
PRINT "DX="; dx%
PRINT "BX="; bx%
DO
LOOP WHILE INKEY$ = ""
END
===
I improved the initialization and display the parameters before and after calling the wrapper. They are modified in unexpected ways. Likely a stack issue.
As I said before in my earlier post, I could an extra pair of eyes. :-)
|
|