Vous êtes sur la page 1sur 4

;PROGRAM FOR MOUSE OPERATIONS ;ROLL NO-48 .model small .data x1 dw ? y1 dw ? b dw ?

msgexit db 'exit$' mm1 db 10,13,'left click $' mm2 db 10,13,'right click $' .code start: mov ax,@data mov ds,ax mov ax,0h int 33h mov mov mov mov mov mov mov int mov mov mov mov int mov mov int mov mov int mov mov mov mov int mov mov int mov mov int chkkey: mov ah,0bh int 21h cmp al,00 je down1 mov ah,01h int 21h ;to check any key is pressed or not ;al==0,then no key is pressed ah,06h al,00 bh,07h ch,00 cl,00 dh,50 dl,80 10h ah,02h bh,0 dh,3 dl,00 10h dl,'x' ah,02h 21h dl,':' ah,02h 21h ah,02h bh,0 dh,4 dl,00 10h dl,'y' ah,02h 21h dl,':' ah,02h 21h ;initialise mouse driver

;fullscrean ;attributes ;from top to left ;decimal 50 ;decimal 80

cmp al,'h' je hidemouse cmp al,'s' je showmouse cmp al ,'q' je po po: call exit hidemouse: mov ax,02h int 33h jmp down1 showmouse: mov ax,01h int 33h jmp down1 ;chk cursor position down1: mov mov mov mov int mov int cmp jne mov lea int jmp cmp jne mov lea int mov mov mov mov mov mov mov int ah,02h bh,00 dl,1 dh,23 10h ax,03h 33h bx,01 t1 ah,09h dx,mm1 21h st1 bx,02 st1 ah,09 dx,mm2 21h x1,cx y1,dx b,bx ah,02h bh,0 dh,3 dl,4 10h ;get mouse button status

t1:

;return buttons thrubx,xposition thru cx,y thru dx st1:

mov bx,x1 call disp mov ah,02h mov bh,0 mov dh,4

mov dl,4 int 10h mov bx,y1 call disp cmp x1,300 jb nxt1 cmp x1,340 ja nxt1 cmp y1,75 jb nxt1 cmp y1,125 ja nxt1 ;******beep****** ; ; ; ; ; ; nxt1: cmp x1,600 jb nxt2 cmp x1,640 ja nxt2 cmp y1,160 jb nxt2 cmp y1,200 ja nxt2 jne op op: call exit mov mov int mov mov int ah,02h dl,07h 21h ah,02h dl,07h 21h ;ascii for beep

;cursor position for exit nxt2: mov mov mov mov int mov lea int jmp ah,02h bh,00 dl,74 dh,24 10h ah,09h dx,msgexit 21h chkkey ;to set cursor position ;x col ;y col

exit proc mov ah,4ch int 21h ret exit endp

disp proc mov ch,04 mov cl,04 nxtchr: rol bx,cl mov ax,bx and al,0fh cmp al,09h jbe plus30 add al,07h plus30: add mov mov int dec jnz al,30h ah,02h dl,al 21h ch nxtchr

mov ah,02h mov dl,' ' int 21h ret disp endp end start

Vous aimerez peut-être aussi