Netoff 0 Newbie Poster

I need to draw rectangle where coordinate x1 y1(left up corner)left mouse button click and x2 y2(right down corner) - right down click
this how I draw rectangle

prug:                   ;cx - x left up
                        ;dx - y left  up
                        ;si - x right down
                        ;di - y right down
                        ;al - color
        mov ah,0ch
lp200:  push dx         ;save vertical coordinate
lp201:  int 10h         ;draw vertical line
        inc dx          ;inc coordinate
        cmp dx,di       ;while not end
        jng lp201
        pop dx        
        inc cx          ;inc horizontal coordinate
        cmp cx,si       ;draw
        jng lp200
 
ret

this is code in main

.model  tiny
                .code
                org             100h                    ; COM
start:
                mov             ax, 12h
                int             10h                  ; 640*480.
                mov             ax, 0           ; initialize mouse
                int             33h
                mov             ax, 1              ; show cursor
                int             33h
                
                mov             ax, 000Ch           ;set handler
                mov             cx, 0002h           ; left button click
               ;.....handler
                int             33h
                
                mov             ah, 0                           ; waiting
                int             16h
                mov             ax, 000Ch
                mov             cx, 0000h               ; delete handler
                int             33h
                mov             ax, 3                           ; test
                int             10h
                ret                                             ; end
 ........

But I don't know how to write handler for clicks