在1280 * 1024视频模式下显示鼠标光标 - 汇编语言

时间:2017-11-29 19:16:20

标签: assembly cursor mouse x86-16 bochs

示例输出:

enter image description here

我试图获得鼠标点击位置,但是当我点击屏幕时,鼠标变得隐藏,但点击得到正确的位置!我展示它们 虽然我使用了使鼠标光标可见的中断! 我可以让鼠标可见或者我必须通过获取位置制作自己的光标吗?

我的示例代码是:

include MainMacro.inc
.MODEL SMALL
.STACK 64
.DATA
OUTPUT1              DB    5 DUP('$') 
OUTPUT2              DB    5 DUP('$')
OUTPUTS              DB    '     $' 

.CODE        
MAIN PROC FAR             
        MOV AX,@DATA
        MOV DS,AX 

        MOV AX,4F02h                        ;OPEN 1280*1024 SCREEN
        MOV BX,107h  
        INT 10h  

        mov ax,7                            ;SET HORIZONTAL RANGE
        MOV CX,0
        MOV DX,1279
        int 33h  

        mov ax,8                            ;SET VERTICAL RANGE
        MOV CX,0
        MOV DX,1023
        int 33h 

        ;;;;;;;;;;;;; 

        mov ax, 1           ;TURN MOUSE CURSOR ON.
        int 33h         
        ;;;;;;;;;;;;;;

        JMP MAINLOOP
        REL0:
            MOV AX,6
            MOV BX,0
            INT 33H
            CMP BX,0
            JNE REL0
            JMP MOUSE              ;IF LEFT BUTTON IS RELEASED
        REL1:
            MOV AX,6
            MOV BX,1
            INT 33H
            CMP BX,0
            JNE REL1
            JMP MOUSE             ;IF RIGHT BUTTON IS RELEASED

        MOUSE:
        PUSHA
            REGISTER_TO_STRING 4 0AH CX OUTPUT1   ;PUT X THE VALUE IN OUTPUT
        POPA 
        PUSHA
            REGISTER_TO_STRING 4 0AH DX OUTPUT2   ;PUT Y THE VALUE IN OUTPUT
        POPA
        DISPLAY_STRING OUTPUT1  
        DISPLAY_STRING OUTPUTS
        DISPLAY_STRING OUTPUT2 
        LINE_DOWN 1
        MAINLOOP:
            MOV AX,6          ;LEFT BUTTON PREESED
            MOV BX,0
            INT 33H
            CMP BX,0
            JNE REL0

            MOV AX,6           ;RIGHT BUTTON PREESED
            MOV BX,1
            INT 33H
            CMP BX,0
            JNE REL1
            JMP MAINLOOP


        HLT 
        MAIN ENDP
END MAIN

0 个答案:

没有答案