so Im trying to write a code that a part of it is getting the pixel color when I left click
here is the code:
proc mouse_click
mov ax,0h ;resets the mouse
int 33h
mov ax,1h ;shows the mouse
int 33h
not_pressed:
mov ax,3h
int 33h
cmp bx, 1 ;checks if left key is pressed
jne not_pressed
shr cx, 1 ;devide the x coordinates in 2 to get correct x coordinates
mov [left_pressed_x], cx ;moves x cordinates to left_pressed_x when left button is pressed
mov [left_pressed_y], dx ;moves y cordinates to left_pressed_y when left button is pressed
mov bh, 0 ;sets page to zero
mov ah, 0Dh ; checks pixel color in mouse coordinates(left_pressed_x, left_pressed_y)
int 010h ; al = color
mov [left_pressed_color], al ; moves the color to left_pressed_color
cmp [left_pressed_color], 01h ;checks if color in (left_pressed_x, left_pressed_y) coordinates is green
je text_mode ; jumps to text mode label that switches from graphic mode to text mode (for testing, currently not working)
ret
endp mouse_click
I know I need to use ah = 0dh int 10h, but its still not working and I cant see where I got it wrong.
Im expecting the code to turn into text mode when I click on the green color, but it just does nothing(the text mode is just for testing).
New contributor