MAGNIFY - checking for "rolled up" window

git-svn-id: svn://kolibrios.org@2063 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2011-08-18 18:57:54 +00:00
parent bb83b1c926
commit 1dd5e58c1c
3 changed files with 125 additions and 119 deletions

View File

@ -1,5 +1,6 @@
@erase lang.inc
@echo lang fix en >lang.inc
@fasm magnify.asm magnify
@kpack magnify
@erase lang.inc
@pause

View File

@ -1,5 +1,6 @@
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm magnify.asm magnify
@kpack magnify
@erase lang.inc
@pause

View File

@ -1,13 +1,16 @@
;---------------------------------------------------------------------
; MAGNIFY SCREEN v1.0
;
; MAGNIFY SCREEN
; Version for KolibriOS 2005-2011
;
; Compile with FASM for Menuet
;
; Version for Menuet to 2005
;---------------------------------------------------------------------
; last update: 08/18/2011
; changed by: Marat Zakiyanov aka Mario79, aka Mario
; changes: Checking for "rolled up" window
;---------------------------------------------------------------------
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 1 ; header version
dd START ; program start
@ -15,22 +18,21 @@ use32
dd 0x1000 ; required amount of memory
dd 0x1000 ; esp
dd 0, 0 ; no parameters, no path
;---------------------------------------------------------------------
include 'lang.inc'
include '..\..\..\macros.inc'
delay equ 20
magnify_width = 40
magnify_height = 30
;---------------------------------------------------------------------
START: ; start of execution
redraw:
call draw_window
still:
call draw_screen
call draw_magnify
wtevent:
mov eax, 23 ; wait here for event with timeout
mov ebx, delay
mcall
mcall 23,delay ; wait here for event with timeout
dec eax
js still
jz redraw
@ -40,24 +42,20 @@ wtevent:
mov al, 2
mcall
jmp wtevent
;---------------------------------------------------------------------
button:
; we have only one button, close
or eax, -1
mcall
; *********************************************
;---------------------------------------------------------------------
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
;---------------------------------------------------------------------
draw_window:
mov eax, 12 ; function 12:tell os about windowdraw
mov ebx, 1 ; 1, start of draw
mcall
mcall 12,1
mov al, 48 ; function 48 : graphics parameters
mov bl, 4 ; subfunction 4 : get skin height
mcall
; DRAW WINDOW
mov ebx, 100*65536 + 8*magnify_width + 8
lea ecx, [eax + 100*65536 + 8*magnify_height + 3]
@ -66,17 +64,16 @@ draw_window:
xor eax, eax ; function 0 : define and draw window
mcall
mov al, 12 ; function 12:tell os about windowdraw
mov ebx, 2 ; 2, end of draw
mcall
mcall 12,2
ret
draw_screen:
;---------------------------------------------------------------------
draw_magnify:
mov eax, 14
mcall ; get screen size
mcall 9,procinfo,-1
mov eax,[procinfo+70] ;status of window
test eax,100b
jne .end
mcall 14 ; get screen size
movzx ecx, ax
inc ecx
mov [size_y], ecx
@ -84,9 +81,8 @@ draw_magnify:
inc eax
mov [size_x], eax
mov eax, 37
xor ebx, ebx
mcall ; get mouse coordinates
mcall 37 ; get mouse coordinates
mov ecx, eax
shr ecx, 16 ; ecx = x
movzx edx, ax ; edx = y
@ -112,8 +108,7 @@ draw_magnify:
mov ebx, edx
imul ebx, [size_x]
add ebx, ecx
mov eax, 35
mcall ; read pixel
mcall 35 ; read pixel
.nopix:
push ecx edx
sub ecx, [m_x]
@ -125,8 +120,7 @@ draw_magnify:
shl ecx, 3+16
mov cl, 7
mov edx, eax
mov eax, 13
mcall
mcall 13
pop edx ecx
inc ecx
cmp ecx, [m_xe]
@ -135,12 +129,18 @@ draw_magnify:
inc edx
cmp edx, [m_ye]
jnz .loop_y
.end:
ret
;---------------------------------------------------------------------
; DATA AREA
;---------------------------------------------------------------------
if lang eq ru
labelt:
db 'MAGNIFIER - „‚ˆƒ€‰’… Š“<C5A0>Ž<E28098> Œ›˜ˆ', 0
else
labelt:
db 'MAGNIFIER - MOVE MOUSE POINTER', 0
end if
I_END:
align 4
@ -150,3 +150,7 @@ m_xe dd ?
m_ye dd ?
size_x dd ?
size_y dd ?
;---------------------------------------------------------------------
procinfo:
rb 1024
;---------------------------------------------------------------------