Simple mouse code for masm

HI :)

I have just begun writing assembler, and now is the time for my first
mouse driver.
I have no clue or what ever code in my head, when i think of mouse stuff
with asembler.

Anyone can help my out ?

Daniel :)

Comments

  • : mouse driver masm code help ?
    [green]
    I don't think an actual mouse driver is what you want to write,
    it appears that you want to get your mouse to do something in
    a small test program so you can use your mouse later in another program
    you'll make using Masm assembly language?

    If that is the case I have some mouse Masm code in MDAT & LTD in
    http://bitdog.home.att.net/files/nasmenv.zip
    It unzips to a nasm environment, but in
    c:
    asm
    otdoneMDATMDATSRC
    c:
    asm
    otdoneLTDMASMSRC
    it should be commented so you can string search for mouse and find
    something that might help.

    Bitdog
    PS, I feel bad that the Masm code below is large, old,
    & I didn't check it lately, but maybe it will help somewhat?
    You might want to download Ralf Browns interrupt list,
    www.google.com search for it. It has interrupts for mouse functions.
    [/green]
    [code]
    ;;----------------- MSCHKON_M ---------------------
    ;; MOUSE CHECK
    ;; call with, NOTHING
    ;; returns AX = 0 if not installed, -1 if installed
    ;; returns BX = -1 if two buttons present
    ;; 0 if other than two buttons
    ;; 3 if mouse systems mouse is present with 3 buttons
    ;; MOUSE ON
    ;; Call with, NOTHING
    ;; Returns, NOTHING
    MSCHKON_M MACRO
    XOR AX,AX ;; function 0
    INT 33h ;; int 51 MOUSE DRIVER INSTALATION CHECK
    CMP AX,0 ;; if AX = 0 mouse not installed
    JZ NOMOUSE
    MOV AX,1 ;; funtion 1
    INT 33h ;; int 51 TURN ON MOUSE CURSOR
    STC ;; carry flag set if mouse turned on
    NOMOUSE:
    ENDM
    ;;
    ;; SYNTAX = MSLIMITV_M number, number (range is 0 - 192, for VGA 320x200)
    ;; SYNTAX = MSLIMITH_M number, number (range is 0 - 640, for VGA 320x200)
    ;;
    MSLIMITV_M MACRO MINROW, MAXROW
    MOV CX,MINROW ;; minium vertical range limits
    MOV DX,MAXROW ;; maximum vertical range limits
    MOV AX,8 ;; function 8
    INT 33h ;; int 51 SET VERTICAL RANGE
    ENDM
    ;;0-640
    MSLIMITH_M MACRO MINCOL, MAXCOL
    MOV CX,MINCOL
    MOV DX,MAXCOL
    MOV AX,7
    INT 33h
    ENDM
    ;;------------------- MSOFF_M ----------------
    ;; Call with, NOTHING
    ;; Returns, NOTHING
    MSOFF_M MACRO
    MOV AX,2 ;; function 2
    INT 33h ;; int 51 MOUSE OFF
    ENDM
    ;;------------------ MSON_M ----------------------
    ;; Call with, NOTHING
    ;; Returns, NOTHING
    MSON_M MACRO
    MOV AX,1 ;; function 1
    INT 33h ;; int 51 MOUSE ON
    ENDM
    ;------------------------ MSGSEN ----------------------
    ; Procedure MSGSEN = MouSe Get SENsitivity
    ; RETURNS, BX = horizontal speed (32h = normal)
    ; CX = vertical speed (32h = normal)
    ; DX = double speed threshold (32h = normal)
    MSGSEN PROC
    PUSH AX
    MOV AX,001Bh
    INT 33h
    POP AX
    RET
    MSGSEN ENDP
    ;------------------------------- MSPOS.INC ---------------
    ; Procedure MSPOS
    ; Call with, DH = row
    ; DL = column = position to print row/column on screen
    ; Returns, numerical values of mouse cursor position on the screen
    MSPOS PROC
    PUSH AX
    PUSH BX
    PUSH CX
    PUSH DX
    PUSH DI
    MOV DI,DX
    MOV AX,3
    INT 33h ; stats
    CMP BX,0 ; if a button is pressed skip this function
    JNZ MSPDONE
    PUSH CX ; column
    PUSH DX ; row
    PUSH DX ; row
    MOV AH,2
    MOV DX,DI
    MOV BH,0 ; page
    INT 10h
    ;
    POP BX ; row
    MOV AH,2
    MOV DL,32
    CMP BX,99
    JA MSPL0
    CMP BX,9
    JA MSPL1
    INT 21h
    MSPL1: INT 21h
    MSPL0:
    POP AX ; row
    CALL WRITDIGT
    MOV AH,2
    MOV DL,'-'
    INT 21h
    POP AX ; column
    SHR AX,1
    CALL WRITDIGT
    MOV AH,2
    MOV DL,32
    INT 21h
    INT 21h
    ;
    MSPDONE:
    POP DI
    POP DX
    POP CX
    POP BX
    POP AX
    RET
    MSPOS ENDP
    ;----------------------------- MSSSEN ----------
    ; Procedure MSSSEN = MouSe Set SENsitivity
    ;
    ; RECIEVES, BX = horizontal speed (32h = normal)
    ; CX = vertical speed (32h = normal)
    ; DX = double speed threshold (32h = normal)
    ; RETURNS, n/a
    MSSSEN PROC
    PUSH AX
    MOV AX,001Ah
    INT 33h
    POP AX
    RET
    MSSSEN ENDP

    [/code]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion