Subversion Repositories Kolibri OS

Rev

Rev 551 | Rev 2096 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 551 Rev 2063
Line -... Line 1...
-
 
1
;---------------------------------------------------------------------
-
 
2
;    MAGNIFY SCREEN v1.0
1
;
3
;
2
;    MAGNIFY SCREEN
4
;    Version for KolibriOS 2005-2011
3
;
5
;
4
;    Compile with FASM for Menuet
6
;    Version for Menuet to 2005
5
;
-
 
6
 
-
 
-
 
7
;---------------------------------------------------------------------
-
 
8
; last update:  08/18/2011
-
 
9
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
-
 
10
; changes:      Checking for "rolled up" window
-
 
11
;---------------------------------------------------------------------
7
use32
12
	use32
8
 
-
 
9
                org     0x0
13
	org     0x0
10
 
-
 
11
                db      'MENUET01'              ; 8 byte id
14
	db      'MENUET01'              ; 8 byte id
12
                dd      1                       ; header version
15
	dd      1                       ; header version
13
                dd      START                   ; program start
16
	dd      START                   ; program start
14
                dd      I_END                   ; program image size
17
	dd      I_END                   ; program image size
15
                dd      0x1000                  ; required amount of memory
18
	dd      0x1000                  ; required amount of memory
16
                dd      0x1000                  ; esp
19
	dd      0x1000                  ; esp
17
                dd      0, 0                    ; no parameters, no path
20
	dd      0, 0                    ; no parameters, no path
18
 
-
 
-
 
21
;---------------------------------------------------------------------
-
 
22
include 'lang.inc'
19
include '..\..\..\macros.inc'
23
include '..\..\..\macros.inc'
20
delay   equ     20
24
delay   equ     20
Line 21... Line 25...
21
 
25
 
22
magnify_width = 40
26
magnify_width = 40
23
magnify_height = 30
-
 
-
 
27
magnify_height = 30
24
 
28
;---------------------------------------------------------------------
25
START:                          ; start of execution
29
START:                          ; start of execution
26
redraw:
30
redraw:
27
        call    draw_window
31
	call	draw_window
28
still:
32
still:
29
        call    draw_screen
33
	call	draw_magnify
30
wtevent:
34
wtevent:
31
        mov     eax, 23         ; wait here for event with timeout
-
 
32
        mov     ebx, delay
-
 
33
        mcall
35
	mcall	23,delay	; wait here for event with timeout
34
        dec     eax
36
	dec	eax
35
        js      still
37
	js	still
36
        jz      redraw
38
	jz	redraw
37
        dec     eax
39
	dec	eax
38
        jnz     button
40
	jnz	button
39
; key in buffer
41
; key in buffer
40
        mov     al, 2
42
	mov	al, 2
41
        mcall
43
	mcall
-
 
44
	jmp	wtevent
42
        jmp     wtevent
45
;---------------------------------------------------------------------
43
button:
46
button:
44
; we have only one button, close
47
; we have only one button, close
45
        or      eax, -1
48
	or	eax, -1
46
        mcall
-
 
47
 
49
	mcall
48
;   *********************************************
50
;---------------------------------------------------------------------
49
;   *******  WINDOW DEFINITIONS AND DRAW ********
51
;   *******  WINDOW DEFINITIONS AND DRAW ********
50
;   *********************************************
-
 
51
 
52
;---------------------------------------------------------------------
52
draw_window:
-
 
53
        mov     eax, 12         ; function 12:tell os about windowdraw
-
 
54
        mov     ebx, 1          ; 1, start of draw
53
draw_window:
55
        mcall
54
	mcall	12,1
56
 
55
	
57
        mov     al, 48          ; function 48 : graphics parameters
56
	mov	al, 48          ; function 48 : graphics parameters
58
        mov     bl, 4           ; subfunction 4 : get skin height
57
	mov	bl, 4           ; subfunction 4 : get skin height
59
        mcall
-
 
60
 
58
	mcall
61
                                        ; DRAW WINDOW
59
					; DRAW WINDOW
62
        mov     ebx, 100*65536 + 8*magnify_width + 8
60
	mov	ebx, 100*65536 + 8*magnify_width + 8
63
        lea     ecx, [eax + 100*65536 + 8*magnify_height + 3]
61
	lea	ecx, [eax + 100*65536 + 8*magnify_height + 3]
64
        mov     edx, 0x34000000         ; color of work area RRGGBB
62
	mov	edx, 0x34000000         ; color of work area RRGGBB
65
        mov     edi, labelt             ; header
63
	mov	edi, labelt             ; header
66
        xor     eax, eax                ; function 0 : define and draw window
64
	xor	eax, eax                ; function 0 : define and draw window
67
        mcall
-
 
68
 
65
	mcall
69
 
-
 
70
        mov     al, 12                  ; function 12:tell os about windowdraw
-
 
71
        mov     ebx, 2                  ; 2, end of draw
66
	
72
        mcall
-
 
73
 
67
	mcall	12,2
74
        ret
-
 
75
 
-
 
-
 
68
	ret
76
draw_screen:
69
;---------------------------------------------------------------------
77
draw_magnify:
70
draw_magnify:
-
 
71
	mcall	9,procinfo,-1
-
 
72
	mov	eax,[procinfo+70] ;status of window
-
 
73
	test	eax,100b
-
 
74
	jne	.end
78
        mov     eax, 14
75
 
79
        mcall            ; get screen size
76
	mcall	14	; get screen size
80
        movzx   ecx, ax
77
	movzx	ecx, ax
81
        inc     ecx
78
	inc	ecx
82
        mov     [size_y], ecx
79
	mov	[size_y], ecx
83
        shr     eax, 16
80
	shr	eax, 16
84
        inc     eax
81
	inc	eax
85
        mov     [size_x], eax
82
	mov	[size_x], eax
86
 
-
 
87
        mov     eax, 37
83
	
88
        xor     ebx, ebx
84
	xor	ebx, ebx
89
        mcall            ; get mouse coordinates
85
	mcall	37	; get mouse coordinates
90
        mov     ecx, eax
86
	mov	ecx, eax
91
        shr     ecx, 16         ; ecx = x
87
	shr	ecx, 16         ; ecx = x
92
        movzx   edx, ax         ; edx = y
88
	movzx	edx, ax         ; edx = y
93
        inc     ecx
89
	inc	ecx
94
        mov     [m_xe], ecx
90
	mov	[m_xe], ecx
95
        inc     edx
91
	inc	edx
96
        mov     [m_ye], edx
92
	mov	[m_ye], edx
97
        sub     ecx, magnify_width
93
	sub	ecx, magnify_width
98
        sub     edx, magnify_height
94
	sub	edx, magnify_height
99
        mov     [m_x], ecx
95
	mov	[m_x], ecx
100
        mov     [m_y], edx
96
	mov	[m_y], edx
101
.loop_y:
97
.loop_y:
102
.loop_x:
98
.loop_x:
103
        xor     eax, eax        ; assume black color for invalid pixels
99
	xor	eax, eax        ; assume black color for invalid pixels
104
        test    ecx, ecx
100
	test	ecx, ecx
105
        js      .nopix
101
	js	.nopix
106
        cmp     ecx, [size_x]
102
	cmp	ecx, [size_x]
107
        jge     .nopix
103
	jge	.nopix
108
        test    edx, edx
104
	test	edx, edx
109
        js      .nopix
105
	js	.nopix
110
        cmp     edx, [size_y]
106
	cmp	edx, [size_y]
111
        jge     .nopix
107
	jge	.nopix
112
        mov     ebx, edx
108
	mov	ebx, edx
113
        imul    ebx, [size_x]
109
	imul	ebx, [size_x]
114
        add     ebx, ecx
-
 
115
        mov     eax, 35
110
	add	ebx, ecx
116
        mcall            ; read pixel
111
	mcall	35	; read pixel
117
.nopix:
112
.nopix:
118
        push    ecx edx
113
	push	ecx edx
119
        sub     ecx, [m_x]
114
	sub	ecx, [m_x]
120
        sub     edx, [m_y]
115
	sub	edx, [m_y]
121
        mov     ebx, ecx
116
	mov	ebx, ecx
122
        shl     ebx, 3+16
117
	shl	ebx, 3+16
123
        mov     bl, 7
118
	mov	bl, 7
124
        mov     ecx, edx
119
	mov	ecx, edx
125
        shl     ecx, 3+16
120
	shl	ecx, 3+16
126
        mov     cl, 7
121
	mov	cl, 7
127
        mov     edx, eax
-
 
128
        mov     eax, 13
122
	mov	edx, eax
129
        mcall
123
	mcall	13
130
        pop     edx ecx
124
	pop	edx ecx
131
        inc     ecx
125
	inc	ecx
132
        cmp     ecx, [m_xe]
126
	cmp	ecx, [m_xe]
133
        jnz     .loop_x
127
	jnz	.loop_x
134
        mov     ecx, [m_x]
128
	mov	ecx, [m_x]
135
        inc     edx
129
	inc	edx
136
        cmp     edx, [m_ye]
130
	cmp	edx, [m_ye]
137
        jnz     .loop_y
131
	jnz	.loop_y
138
        ret
132
.end:
-
 
133
	ret
139
 
134
;---------------------------------------------------------------------
-
 
135
; DATA AREA
-
 
136
;---------------------------------------------------------------------
-
 
137
if lang eq ru
-
 
138
labelt:
140
; DATA AREA
139
    db   'MAGNIFIER - „‚ˆƒ€‰’… Š“‘Ž Œ›˜ˆ', 0
141
 
140
else
142
labelt:
141
labelt:
-
 
142
    db   'MAGNIFIER - MOVE MOUSE POINTER', 0
Line 143... Line 143...
143
    db   'MAGNIFIER - MOVE MOUSE POINTER', 0
143
end if
144
 
144
 
145
I_END:
145
I_END:
146
align 4
146
align 4
147
m_x     dd      ?
147
m_x     dd      ?
148
m_y     dd      ?
148
m_y     dd      ?
149
m_xe    dd      ?
149
m_xe    dd      ?
150
m_ye    dd      ?
150
m_ye    dd      ?
-
 
151
size_x  dd      ?
-
 
152
size_y  dd      ?
-
 
153
;---------------------------------------------------------------------
-
 
154
procinfo:
151
size_x  dd      ?
155
	rb 1024