forked from KolibriOS/kolibrios
MAGNIFY - checking for "rolled up" window
git-svn-id: svn://kolibrios.org@2063 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
bb83b1c926
commit
1dd5e58c1c
@ -1,5 +1,6 @@
|
|||||||
@erase lang.inc
|
@erase lang.inc
|
||||||
@echo lang fix en >lang.inc
|
@echo lang fix en >lang.inc
|
||||||
@fasm magnify.asm magnify
|
@fasm magnify.asm magnify
|
||||||
|
@kpack magnify
|
||||||
@erase lang.inc
|
@erase lang.inc
|
||||||
@pause
|
@pause
|
@ -1,5 +1,6 @@
|
|||||||
@erase lang.inc
|
@erase lang.inc
|
||||||
@echo lang fix ru >lang.inc
|
@echo lang fix ru >lang.inc
|
||||||
@fasm magnify.asm magnify
|
@fasm magnify.asm magnify
|
||||||
|
@kpack magnify
|
||||||
@erase lang.inc
|
@erase lang.inc
|
||||||
@pause
|
@pause
|
@ -1,146 +1,146 @@
|
|||||||
|
;---------------------------------------------------------------------
|
||||||
|
; 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
|
||||||
use32
|
; changed by: Marat Zakiyanov aka Mario79, aka Mario
|
||||||
|
; changes: Checking for "rolled up" window
|
||||||
org 0x0
|
;---------------------------------------------------------------------
|
||||||
|
use32
|
||||||
db 'MENUET01' ; 8 byte id
|
org 0x0
|
||||||
dd 1 ; header version
|
db 'MENUET01' ; 8 byte id
|
||||||
dd START ; program start
|
dd 1 ; header version
|
||||||
dd I_END ; program image size
|
dd START ; program start
|
||||||
dd 0x1000 ; required amount of memory
|
dd I_END ; program image size
|
||||||
dd 0x1000 ; esp
|
dd 0x1000 ; required amount of memory
|
||||||
dd 0, 0 ; no parameters, no path
|
dd 0x1000 ; esp
|
||||||
|
dd 0, 0 ; no parameters, no path
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
include 'lang.inc'
|
||||||
include '..\..\..\macros.inc'
|
include '..\..\..\macros.inc'
|
||||||
delay equ 20
|
delay equ 20
|
||||||
|
|
||||||
magnify_width = 40
|
magnify_width = 40
|
||||||
magnify_height = 30
|
magnify_height = 30
|
||||||
|
;---------------------------------------------------------------------
|
||||||
START: ; start of execution
|
START: ; start of execution
|
||||||
redraw:
|
redraw:
|
||||||
call draw_window
|
call draw_window
|
||||||
still:
|
still:
|
||||||
call draw_screen
|
call draw_magnify
|
||||||
wtevent:
|
wtevent:
|
||||||
mov eax, 23 ; wait here for event with timeout
|
mcall 23,delay ; wait here for event with timeout
|
||||||
mov ebx, delay
|
dec eax
|
||||||
mcall
|
js still
|
||||||
dec eax
|
jz redraw
|
||||||
js still
|
dec eax
|
||||||
jz redraw
|
jnz button
|
||||||
dec eax
|
|
||||||
jnz button
|
|
||||||
; key in buffer
|
; key in buffer
|
||||||
mov al, 2
|
mov al, 2
|
||||||
mcall
|
mcall
|
||||||
jmp wtevent
|
jmp wtevent
|
||||||
|
;---------------------------------------------------------------------
|
||||||
button:
|
button:
|
||||||
; we have only one button, close
|
; we have only one button, close
|
||||||
or eax, -1
|
or eax, -1
|
||||||
mcall
|
mcall
|
||||||
|
;---------------------------------------------------------------------
|
||||||
; *********************************************
|
|
||||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||||
; *********************************************
|
;---------------------------------------------------------------------
|
||||||
|
|
||||||
draw_window:
|
draw_window:
|
||||||
mov eax, 12 ; function 12:tell os about windowdraw
|
mcall 12,1
|
||||||
mov ebx, 1 ; 1, start of draw
|
|
||||||
mcall
|
mov al, 48 ; function 48 : graphics parameters
|
||||||
|
mov bl, 4 ; subfunction 4 : get skin height
|
||||||
mov al, 48 ; function 48 : graphics parameters
|
mcall
|
||||||
mov bl, 4 ; subfunction 4 : get skin height
|
; DRAW WINDOW
|
||||||
mcall
|
mov ebx, 100*65536 + 8*magnify_width + 8
|
||||||
|
lea ecx, [eax + 100*65536 + 8*magnify_height + 3]
|
||||||
; DRAW WINDOW
|
mov edx, 0x34000000 ; color of work area RRGGBB
|
||||||
mov ebx, 100*65536 + 8*magnify_width + 8
|
mov edi, labelt ; header
|
||||||
lea ecx, [eax + 100*65536 + 8*magnify_height + 3]
|
xor eax, eax ; function 0 : define and draw window
|
||||||
mov edx, 0x34000000 ; color of work area RRGGBB
|
mcall
|
||||||
mov edi, labelt ; header
|
|
||||||
xor eax, eax ; function 0 : define and draw window
|
mcall 12,2
|
||||||
mcall
|
ret
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
|
||||||
mov al, 12 ; function 12:tell os about windowdraw
|
|
||||||
mov ebx, 2 ; 2, end of draw
|
|
||||||
mcall
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
draw_screen:
|
|
||||||
draw_magnify:
|
draw_magnify:
|
||||||
mov eax, 14
|
mcall 9,procinfo,-1
|
||||||
mcall ; get screen size
|
mov eax,[procinfo+70] ;status of window
|
||||||
movzx ecx, ax
|
test eax,100b
|
||||||
inc ecx
|
jne .end
|
||||||
mov [size_y], ecx
|
|
||||||
shr eax, 16
|
|
||||||
inc eax
|
|
||||||
mov [size_x], eax
|
|
||||||
|
|
||||||
mov eax, 37
|
mcall 14 ; get screen size
|
||||||
xor ebx, ebx
|
movzx ecx, ax
|
||||||
mcall ; get mouse coordinates
|
inc ecx
|
||||||
mov ecx, eax
|
mov [size_y], ecx
|
||||||
shr ecx, 16 ; ecx = x
|
shr eax, 16
|
||||||
movzx edx, ax ; edx = y
|
inc eax
|
||||||
inc ecx
|
mov [size_x], eax
|
||||||
mov [m_xe], ecx
|
|
||||||
inc edx
|
xor ebx, ebx
|
||||||
mov [m_ye], edx
|
mcall 37 ; get mouse coordinates
|
||||||
sub ecx, magnify_width
|
mov ecx, eax
|
||||||
sub edx, magnify_height
|
shr ecx, 16 ; ecx = x
|
||||||
mov [m_x], ecx
|
movzx edx, ax ; edx = y
|
||||||
mov [m_y], edx
|
inc ecx
|
||||||
|
mov [m_xe], ecx
|
||||||
|
inc edx
|
||||||
|
mov [m_ye], edx
|
||||||
|
sub ecx, magnify_width
|
||||||
|
sub edx, magnify_height
|
||||||
|
mov [m_x], ecx
|
||||||
|
mov [m_y], edx
|
||||||
.loop_y:
|
.loop_y:
|
||||||
.loop_x:
|
.loop_x:
|
||||||
xor eax, eax ; assume black color for invalid pixels
|
xor eax, eax ; assume black color for invalid pixels
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
js .nopix
|
js .nopix
|
||||||
cmp ecx, [size_x]
|
cmp ecx, [size_x]
|
||||||
jge .nopix
|
jge .nopix
|
||||||
test edx, edx
|
test edx, edx
|
||||||
js .nopix
|
js .nopix
|
||||||
cmp edx, [size_y]
|
cmp edx, [size_y]
|
||||||
jge .nopix
|
jge .nopix
|
||||||
mov ebx, edx
|
mov ebx, edx
|
||||||
imul ebx, [size_x]
|
imul ebx, [size_x]
|
||||||
add ebx, ecx
|
add ebx, ecx
|
||||||
mov eax, 35
|
mcall 35 ; read pixel
|
||||||
mcall ; read pixel
|
|
||||||
.nopix:
|
.nopix:
|
||||||
push ecx edx
|
push ecx edx
|
||||||
sub ecx, [m_x]
|
sub ecx, [m_x]
|
||||||
sub edx, [m_y]
|
sub edx, [m_y]
|
||||||
mov ebx, ecx
|
mov ebx, ecx
|
||||||
shl ebx, 3+16
|
shl ebx, 3+16
|
||||||
mov bl, 7
|
mov bl, 7
|
||||||
mov ecx, edx
|
mov ecx, edx
|
||||||
shl ecx, 3+16
|
shl ecx, 3+16
|
||||||
mov cl, 7
|
mov cl, 7
|
||||||
mov edx, eax
|
mov edx, eax
|
||||||
mov eax, 13
|
mcall 13
|
||||||
mcall
|
pop edx ecx
|
||||||
pop edx ecx
|
inc ecx
|
||||||
inc ecx
|
cmp ecx, [m_xe]
|
||||||
cmp ecx, [m_xe]
|
jnz .loop_x
|
||||||
jnz .loop_x
|
mov ecx, [m_x]
|
||||||
mov ecx, [m_x]
|
inc edx
|
||||||
inc edx
|
cmp edx, [m_ye]
|
||||||
cmp edx, [m_ye]
|
jnz .loop_y
|
||||||
jnz .loop_y
|
.end:
|
||||||
ret
|
ret
|
||||||
|
;---------------------------------------------------------------------
|
||||||
; DATA AREA
|
; DATA AREA
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
if lang eq ru
|
||||||
|
labelt:
|
||||||
|
db 'MAGNIFIER - „‚ˆƒ€‰’… Š“<C5A0>‘Ž<E28098> Œ›˜ˆ', 0
|
||||||
|
else
|
||||||
labelt:
|
labelt:
|
||||||
db 'MAGNIFIER - MOVE MOUSE POINTER', 0
|
db 'MAGNIFIER - MOVE MOUSE POINTER', 0
|
||||||
|
end if
|
||||||
|
|
||||||
I_END:
|
I_END:
|
||||||
align 4
|
align 4
|
||||||
@ -150,3 +150,7 @@ m_xe dd ?
|
|||||||
m_ye dd ?
|
m_ye dd ?
|
||||||
size_x dd ?
|
size_x dd ?
|
||||||
size_y dd ?
|
size_y dd ?
|
||||||
|
;---------------------------------------------------------------------
|
||||||
|
procinfo:
|
||||||
|
rb 1024
|
||||||
|
;---------------------------------------------------------------------
|
Loading…
Reference in New Issue
Block a user