chewy
New Member
Posts: 1
|
Post by chewy on Nov 16, 2007 20:48:56 GMT
Does anyone know where to get a mouse program for 4.5? I have two versions of qbasic, and a mouse program for the one, but it won't work on 4.5. So if anyone knows where to get one it would be really helpful.
Thanks
|
|
|
Post by Mikrondel on Nov 17, 2007 7:01:48 GMT
Perhaps you forgot to load QB 4.5 with the /L switch?
To do that you can open a command prompt, navigate your way to your QB directory and type QB /L For a more permanent solution, make a shortcut to QB and add " /L" to its "cmd line".
In case it helps, here's a mouse driver routine that should work in any QB version:
DECLARE SUB MouseDriver (AX AS INTEGER, BX AS INTEGER, CX AS INTEGER, DX AS INTEGER) DEFINT A-Z
TYPE R AX AS INTEGER BX AS INTEGER CX AS INTEGER DX AS INTEGER END TYPE
MouseDriver 0, 0, 0, 0 MouseDriver 1, 0, 0, 0 'MouseDriver 2, 0, 0, 0 SLEEP DO MouseDriver 3, B, X, Y LOCATE 1, 1 PRINT X, Y LOOP UNTIL B
DEFSNG A-Z SUB MouseDriver (AX AS INTEGER, BX AS INTEGER, CX AS INTEGER, DX AS INTEGER) DIM D AS INTEGER, C AS INTEGER, B AS INTEGER, A AS INTEGER STATIC X() AS INTEGER, S$
IF LEN(S$) = 0 THEN S$ = "66585E66508B54068B4C048B5C028B04CD33895406894C04895C028904CB" REDIM X(0 TO ((LEN(S$) + 1) \ 2) - 1) AS INTEGER DEF SEG = VARSEG(X(0)) FOR I = 1 TO LEN(S$) STEP 2 POKE VARPTR(X(0)) + (I - 1) \ 2, VAL("&H" + MID$(S$, I, 2)) NEXT END IF A = AX B = BX C = CX D = DX DEF SEG = VARSEG(X(0)) CALL absolute(A, VARPTR(X(0))) DEF SEG AX = A BX = B CX = C DX = D
END SUB
|
|
clippy
Junior Member
Posts: 32
|
Post by clippy on Nov 18, 2007 20:23:46 GMT
One thing. What does TYPE R do? I don't see it used.
Ted
|
|
|
Post by Mikrondel on Nov 19, 2007 8:46:02 GMT
Whoops, that was an artefact from development. It may be removed.
I hope there aren't any more errors, maybe I should go and find the better version I posted at Network54.
|
|
|
Post by Ildûrest on Dec 3, 2007 9:06:51 GMT
DECLARE SUB MouseDriver (AX AS INTEGER, BX AS INTEGER, CX AS INTEGER, DX AS INTEGER) DEFINT A-Z
MC$ = "585B5E53508B54068B4C048B5C028B04CD33895406894C04895C028904CB" DIM SHARED MouseCode(0 TO 14) AS INTEGER DEF SEG = VARSEG(MouseCode(0)) FOR I = 0 TO 29 POKE VARPTR(MouseCode(0)) + I, VAL("&H" + MID$(MC$, I * 2 + 1, 2)) NEXT DEF SEG
MouseDriver 0, 0, 0, 0 MouseDriver 1, 0, 0, 0 DO MouseDriver 3, But, X, y LOOP UNTIL But PRINT X, y MouseDriver 2, 0, 0, 0
DEFSNG A-Z SUB MouseDriver (AX AS INTEGER, BX AS INTEGER, CX AS INTEGER, DX AS INTEGER) DIM D AS INTEGER, C AS INTEGER, B AS INTEGER, A AS INTEGER D = DX: C = CX: B = BX: A = AX DEF SEG = VARSEG(MouseCode(0)) CALL absolute(A, VARPTR(MouseCode(0))) DEF SEG
AX = A: BX = B: CX = C: DX = D END SUB
Source code to the machine language routine, if you're interested:
POP AX ;Preserve return address & segment POP BX POP SI ;Get data address PUSH BX ;Restore return address & segment PUSH AX MOV DX,[SI+06h] ;Load up registers MOV CX,[SI+04h] MOV BX,[SI+02h] MOV AX,[SI] INT 33H MOV [SI+06h],DX ;Unload registers MOV [SI+04h],CX MOV [SI+02h],BX MOV [SI],AX RETF
|
|