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