Rev 109 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 109 | Rev 132 | ||
---|---|---|---|
1 | ; Picture browser by lisovin@26.ru |
1 | ; Picture browser by lisovin@26.ru |
2 | ; Modified by Ivan Poddubny - v.0.3 |
2 | ; Modified by Ivan Poddubny - v.0.3 |
3 | ; Compile with FASM for Menuet |
3 | ; Compile with FASM for Menuet |
4 | 4 | ||
5 | ;****************************************************************************** |
5 | ;****************************************************************************** |
6 | use32 |
6 | use32 |
7 | org 0x0 |
7 | org 0x0 |
8 | db 'MENUET01' ; 8 byte id |
8 | db 'MENUET01' ; 8 byte id |
9 | dd 0x01 ; header version |
9 | dd 0x01 ; header version |
10 | dd START ; start of code |
10 | dd START ; start of code |
11 | dd IM_END ; size of image |
11 | dd IM_END ; size of image |
12 | dd 0x300000 ; memory for app |
12 | dd 0x300000 ; memory for app |
13 | dd 0x300000 ; esp |
13 | dd 0x300000 ; esp |
14 | dd temp_area , 0x0 ; I_Param , I_Icon |
14 | dd temp_area , 0x0 ; I_Param , I_Icon |
- | 15 | ||
15 | include 'lang.inc' |
16 | include 'lang.inc' |
16 | include 'macros.inc' |
17 | include 'macros.inc' |
17 | ;****************************************************************************** |
18 | ;****************************************************************************** |
18 | - | ||
19 | tmp_param dd 0 |
- | |
20 | 19 | ||
21 | START: ; start of execution |
20 | START: ; start of execution |
22 | 21 | ||
23 | ; check for parameters |
22 | ; check for parameters |
24 | cmp dword [temp_area],'BOOT' |
23 | cmp dword [temp_area],'BOOT' |
25 | jne .no_boot |
24 | jne .no_boot |
26 | call load_image |
25 | call load_image |
27 | call convert |
26 | call convert |
28 | call background |
27 | call background |
29 | or eax,-1 |
28 | or eax,-1 |
30 | int 0x40 |
29 | int 0x40 |
31 | .no_boot: |
30 | .no_boot: |
32 | 31 | ||
33 | cmp byte [temp_area],0 |
32 | cmp byte [temp_area],0 |
34 | jz .no_param |
33 | jz .no_param |
35 | mov edi,string ; clear string |
34 | mov edi,string ; clear string |
36 | mov ecx,43*3 ; length of a string |
35 | mov ecx,43*3 ; length of a string |
37 | xor eax,eax ; symbol <0> |
36 | xor eax,eax ; symbol <0> |
- | 37 | add al,14h |
|
38 | cld |
38 | cld |
39 | rep stosb |
39 | rep stosb |
40 | 40 | ||
41 | mov edi,temp_area ; look for <0> in temp_area |
41 | mov edi,temp_area ; look for <0> in temp_area |
42 | mov ecx,43*3+1 ; strlen |
42 | mov ecx,43*3+1 ; strlen |
43 | repne scasb |
43 | repne scasb |
44 | add edi,-temp_area ; get length of the string |
44 | add edi,-temp_area ; get length of the string |
45 | dec edi |
45 | dec edi |
46 | 46 | ||
47 | mov ecx,edi |
47 | mov ecx,edi |
48 | mov esi,temp_area |
48 | mov esi,temp_area |
49 | mov edi,string |
49 | mov edi,string |
50 | rep movsb ; copy string from temp_area to "string" (filename) |
50 | rep movsb ; copy string from temp_area to "string" (filename) |
51 | 51 | ||
52 | call draw_window |
52 | call load_image |
- | 53 | call convert |
|
53 | mov [tmp_param],0xdeadbeef |
54 | |
54 | .no_param: |
55 | .no_param: |
55 | 56 | ||
56 | 57 | ||
57 | mov ecx,-1 ; get information about me |
58 | mov ecx,-1 ; get information about me |
58 | call getappinfo |
59 | call getappinfo |
59 | 60 | ||
60 | mov edx,[process_info+30] ; ⥯¥àì ¢ edx è ¨¤¥â¨ä¨ª â®à |
61 | mov edx,[process_info+30] ; ⥯¥àì ¢ edx è ¨¤¥â¨ä¨ª â®à |
61 | mov ecx,eax |
62 | mov ecx,eax |
62 | 63 | ||
63 | @@: |
64 | @@: |
64 | call getappinfo |
65 | call getappinfo |
65 | cmp edx,[process_info+30] |
66 | cmp edx,[process_info+30] |
66 | je @f ; ¥á«¨ è PID ᮢ¯ « á PID à áᬠâਢ ¥¬®£® ¯à®æ¥áá , ¬ë 諨 ᥡï |
67 | je @f ; ¥á«¨ è PID ᮢ¯ « á PID à áᬠâਢ ¥¬®£® ¯à®æ¥áá , ¬ë 諨 ᥡï |
67 | dec ecx ; ¨ ç¥ á¬®âਬ á«¥¤ãî騩 ¯à®æ¥áá |
68 | dec ecx ; ¨ ç¥ á¬®âਬ á«¥¤ãî騩 ¯à®æ¥áá |
68 | jne @b ; ¢®§¢à é ¥¬áï, ¥á«¨ ¥ ¢á¥ ¯à®æ¥ááë à áᬮâà¥ë |
69 | jne @b ; ¢®§¢à é ¥¬áï, ¥á«¨ ¥ ¢á¥ ¯à®æ¥ááë à áᬮâà¥ë |
69 | @@: |
70 | @@: |
70 | 71 | ||
71 | ; ⥯¥àì ¢ ecx ®¬¥à ¯à®æ¥áá |
72 | ; ⥯¥àì ¢ ecx ®¬¥à ¯à®æ¥áá |
72 | mov [process],ecx |
73 | mov [process],ecx |
73 | - | ||
74 | cmp [tmp_param],0xdeadbeef |
- | |
75 | jne @f |
- | |
76 | jmp kopen |
- | |
77 | @@: |
- | |
78 | 74 | ||
79 | call draw_window |
75 | call draw_window |
80 | 76 | ||
81 | still: |
77 | still: |
82 | 78 | ||
83 | mov eax,10 ; wait here for event |
79 | mov eax,10 ; wait here for event |
84 | int 0x40 |
80 | int 0x40 |
85 | 81 | ||
86 | cmp eax,1 ; redraw request ? |
82 | cmp eax,1 ; redraw request ? |
87 | je red |
83 | je red |
88 | cmp eax,2 ; key in buffer ? |
84 | cmp eax,2 ; key in buffer ? |
89 | je key |
85 | je key |
90 | cmp eax,3 ; button in buffer ? |
86 | cmp eax,3 ; button in buffer ? |
91 | je button |
87 | je button |
92 | 88 | ||
93 | jmp still |
89 | jmp still |
94 | 90 | ||
95 | red: |
91 | red: |
96 | bt [status],2 |
92 | bt [status],2 |
97 | jnc @f |
93 | jnc @f |
98 | mov eax,18 |
94 | mov eax,18 |
99 | mov ebx,3 |
95 | mov ebx,3 |
100 | mov ecx,[process] |
96 | mov ecx,[process] |
101 | int 0x40 |
97 | int 0x40 |
102 | btr [status],2 |
98 | btr [status],2 |
103 | jmp still |
99 | jmp still |
104 | @@: |
100 | @@: |
105 | call draw_window |
101 | call draw_window |
106 | jmp still |
102 | jmp still |
107 | 103 | ||
108 | key: ; key |
104 | key: ; key |
109 | int 0x40 |
105 | int 0x40 |
110 | cmp ah,6 |
106 | cmp ah,6 |
111 | je kfile |
107 | je kfile |
112 | cmp ah,15 |
108 | cmp ah,15 |
113 | je kopen |
109 | je kopen |
114 | cmp ah,9 |
110 | cmp ah,9 |
115 | je kinfo |
111 | je kinfo |
116 | cmp ah,2 |
112 | cmp ah,2 |
117 | je kbgrd |
113 | je kbgrd |
118 | jmp still |
114 | jmp still |
119 | 115 | ||
120 | button: ; button |
116 | button: ; button |
121 | mov eax,17 ; get id |
117 | mov eax,17 ; get id |
122 | int 0x40 |
118 | int 0x40 |
123 | 119 | ||
124 | cmp ah,1 ; button id=1 ? |
120 | cmp ah,1 ; button id=1 ? |
125 | jne noclose |
121 | jne noclose |
126 | 122 | ||
127 | mov eax,-1 ; close this program |
123 | mov eax,-1 ; close this program |
128 | int 0x40 |
124 | int 0x40 |
129 | noclose: |
125 | noclose: |
130 | cmp ah,2 |
126 | cmp ah,2 |
131 | jne nofile |
127 | jne nofile |
132 | kfile: |
128 | kfile: |
133 | bt dword [status],0 |
129 | bt dword [status],0 |
134 | jc still |
130 | jc still |
135 | bts dword [status],0 |
131 | bts dword [status],0 |
136 | mov eax,51 |
132 | mov eax,51 |
137 | mov ebx,1 |
133 | mov ebx,1 |
138 | mov ecx,thread1 |
134 | mov ecx,thread1 |
139 | mov edx,0x29fff0 |
135 | mov edx,0x29fff0 |
140 | int 0x40 |
136 | int 0x40 |
141 | jmp still |
137 | jmp still |
142 | nofile: |
138 | nofile: |
143 | cmp ah,3 |
139 | cmp ah,3 |
144 | jne noopen |
140 | jne noopen |
145 | 141 | ||
146 | kopen: |
142 | kopen: |
147 | mov ecx,-1 |
143 | mov ecx,-1 |
148 | call getappinfo |
144 | call getappinfo |
149 | mov ebx,dword [I_END+42] |
145 | mov ebx,dword [I_END+42] |
150 | mov ecx,dword [I_END+46] |
146 | mov ecx,dword [I_END+46] |
151 | add ebx,10*65536-15 |
147 | add ebx,10*65536-15 |
152 | add ecx,50*65536-55 |
148 | add ecx,50*65536-55 |
153 | mov edx,0xffffff |
149 | mov edx,0xffffff |
154 | mov eax,13 |
150 | mov eax,13 |
155 | int 0x40 |
151 | int 0x40 |
156 | 152 | ||
157 | call load_image |
153 | call load_image |
158 | 154 | ||
159 | open1: |
155 | open1: |
160 | cmp word [I_END],word 'BM' |
156 | cmp word [I_END],word 'BM' |
161 | jne still |
157 | jne still |
162 | call convert |
158 | call convert |
163 | call drawimage |
159 | call drawimage |
164 | jmp still |
160 | jmp still |
165 | noopen: |
161 | noopen: |
166 | 162 | ||
167 | cmp ah,4 |
163 | cmp ah,4 |
168 | jne noinfo |
164 | jne noinfo |
169 | kinfo: |
165 | kinfo: |
170 | bt dword [status],1 |
166 | bt dword [status],1 |
171 | jc still |
167 | jc still |
172 | bts dword [status],1 |
168 | bts dword [status],1 |
173 | mov eax,51 |
169 | mov eax,51 |
174 | mov ebx,1 |
170 | mov ebx,1 |
175 | mov ecx,thread2 |
171 | mov ecx,thread2 |
176 | mov edx,0x2afff0 |
172 | mov edx,0x2afff0 |
177 | int 0x40 |
173 | int 0x40 |
178 | jmp still |
174 | jmp still |
179 | noinfo: |
175 | noinfo: |
180 | 176 | ||
181 | ; |
177 | ; |
182 | cmp ah,5 |
178 | cmp ah,5 |
183 | jne still |
179 | jne still |
184 | kbgrd: |
180 | kbgrd: |
185 | bt dword [status],3 |
181 | bt dword [status],3 |
186 | jc still |
182 | jc still |
187 | bts dword [status],3 |
183 | bts dword [status],3 |
188 | mov eax,51 |
184 | mov eax,51 |
189 | mov ebx,1 |
185 | mov ebx,1 |
190 | mov ecx,thread3 |
186 | mov ecx,thread3 |
191 | mov edx,0x2bfff0 |
187 | mov edx,0x2bfff0 |
192 | int 0x40 |
188 | int 0x40 |
193 | jmp still |
189 | jmp still |
194 | ;call background |
190 | ;call background |
195 | 191 | ||
196 | getappinfo: |
192 | getappinfo: |
197 | mov eax,9 |
193 | mov eax,9 |
198 | mov ebx,I_END |
194 | mov ebx,process_info |
199 | int 0x40 |
195 | int 0x40 |
200 | ret |
196 | ret |
201 | 197 | ||
202 | 198 | ||
203 | load_image: |
199 | load_image: |
204 | mov dword [fileinfo+8],1 ; how many blocks to read (1) |
200 | mov dword [fileinfo+8],1 ; how many blocks to read (1) |
205 | mov eax,58 |
201 | mov eax,58 |
206 | mov ebx,fileinfo |
202 | mov ebx,fileinfo |
207 | int 0x40 |
203 | int 0x40 |
208 | cmp [I_END+2],dword 512 ; à §¬¥à ä ©« (file size) |
204 | cmp [I_END+2],dword 512 ; à §¬¥à ä ©« (file size) |
209 | jbe open1 |
205 | jbe @f |
210 | mov eax,[I_END+2] |
206 | mov eax,[I_END+2] |
211 | shr eax,9 ; ¯®¤¥«¨¬ 512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢ |
207 | shr eax,9 ; ¯®¤¥«¨¬ 512 ¨ ¯à¨¡ ¢¨¬ 1 - ¯®«ã稬 ç¨á«® ¡«®ª®¢ |
212 | inc eax |
208 | inc eax |
213 | 209 | ||
214 | mov dword [fileinfo+8],eax |
210 | mov dword [fileinfo+8],eax |
215 | mov eax,58 |
211 | mov eax,58 |
216 | mov ebx,fileinfo |
212 | mov ebx,fileinfo |
217 | int 0x40 |
213 | int 0x40 |
- | 214 | @@: |
|
- | 215 | mov eax,[I_END+18] |
|
- | 216 | mov ebx,[I_END+22] |
|
- | 217 | add eax,20 |
|
- | 218 | cmp eax,210 |
|
- | 219 | jae @f |
|
- | 220 | mov eax,210 |
|
- | 221 | @@: |
|
- | 222 | add ebx,58 |
|
- | 223 | cmp ebx,56 |
|
- | 224 | jae @f |
|
- | 225 | mov ebx,56 |
|
- | 226 | @@: |
|
- | 227 | mov [wnd_width],eax |
|
- | 228 | mov [wnd_height],ebx |
|
- | 229 | test [bWasDraw],1 |
|
- | 230 | jz @f |
|
- | 231 | mov esi,ebx |
|
- | 232 | mov edx,eax |
|
- | 233 | mov ecx,-1 |
|
- | 234 | mov ebx,-1 |
|
- | 235 | mov eax,67 |
|
- | 236 | int 40h |
|
- | 237 | @@: |
|
218 | ret |
238 | ret |
219 | 239 | ||
220 | 240 | ||
221 | drawimage: |
241 | drawimage: |
222 | cmp word [I_END],word 'BM' |
242 | cmp word [I_END],word 'BM' |
223 | jne nodrawimage |
243 | jne nodrawimage |
224 | mov eax,7 |
244 | mov eax,7 |
225 | mov ebx,[soi] |
245 | mov ebx,[soi] |
226 | mov ecx,[I_END+18] |
246 | mov ecx,[I_END+18] |
227 | shl ecx,16 |
247 | shl ecx,16 |
228 | add ecx,[I_END+22] |
248 | add ecx,[I_END+22] |
229 | mov edx,10*65536+50 |
249 | mov edx,10*65536+50 |
230 | int 0x40 |
250 | int 0x40 |
231 | nodrawimage: |
251 | nodrawimage: |
232 | ret |
252 | ret |
233 | 253 | ||
234 | ; |
254 | ; |
235 | background: |
255 | background: |
236 | cmp word [I_END],word 'BM' |
256 | cmp word [I_END],word 'BM' |
237 | jne @f |
257 | jne @f |
238 | mov eax,15 |
258 | mov eax,15 |
239 | mov ebx,1 |
259 | mov ebx,1 |
240 | mov ecx,[I_END+18] ; è¨à¨ |
260 | mov ecx,[I_END+18] ; è¨à¨ |
241 | mov edx,[I_END+22] ; ¢ëá®â |
261 | mov edx,[I_END+22] ; ¢ëá®â |
242 | int 0x40 |
262 | int 0x40 |
243 | 263 | ||
244 | mov esi, ecx |
264 | mov esi, ecx |
245 | imul esi, edx |
265 | imul esi, edx |
246 | imul esi, 3 |
266 | imul esi, 3 |
247 | mov ebx,5 |
267 | mov ebx,5 |
248 | mov ecx,[soi] |
268 | mov ecx,[soi] |
249 | xor edx,edx |
269 | xor edx,edx |
250 | ;;; mov esi, ;640*480*3 |
270 | ;;; mov esi, ;640*480*3 |
251 | int 0x40 |
271 | int 0x40 |
252 | 272 | ||
253 | dec ebx ;tile/stretch |
273 | dec ebx ;tile/stretch |
254 | mov ecx,dword [bgrmode] |
274 | mov ecx,dword [bgrmode] |
255 | int 0x40 |
275 | int 0x40 |
256 | 276 | ||
257 | dec ebx |
277 | dec ebx |
258 | int 0x40 |
278 | int 0x40 |
259 | @@: |
279 | @@: |
260 | ret |
280 | ret |
261 | 281 | ||
262 | convert: |
282 | convert: |
263 | movzx eax,word [I_END+28] |
283 | movzx eax,word [I_END+28] |
264 | mul dword [I_END+18] |
284 | mul dword [I_END+18] |
265 | mov ebx,32 |
285 | mov ebx,32 |
266 | div ebx |
286 | div ebx |
267 | test edx,edx |
287 | test edx,edx |
268 | je noaddword |
288 | je noaddword |
269 | inc eax |
289 | inc eax |
270 | noaddword: |
290 | noaddword: |
271 | mov [dwps],eax ;dwps-doublewords per string |
291 | mov [dwps],eax ;dwps-doublewords per string |
272 | shl eax,2 |
292 | shl eax,2 |
273 | mov [bps],eax ;bps-bytes per string |
293 | mov [bps],eax ;bps-bytes per string |
274 | 294 | ||
275 | cmp dword [I_END+34],0 |
295 | cmp dword [I_END+34],0 |
276 | jne yespicsize ;if picture size is defined |
296 | jne yespicsize ;if picture size is defined |
277 | mul dword [I_END+22] |
297 | mul dword [I_END+22] |
278 | mov dword [I_END+34],eax |
298 | mov dword [I_END+34],eax |
279 | 299 | ||
280 | yespicsize: |
300 | yespicsize: |
281 | mov eax,I_END |
301 | mov eax,I_END |
282 | push eax |
302 | push eax |
283 | add eax, [I_END+2];file size |
303 | add eax, [I_END+2];file size |
284 | inc eax |
304 | inc eax |
285 | mov [soi],eax ;soi-start of image area for drawing |
305 | mov [soi],eax ;soi-start of image area for drawing |
286 | pop eax |
306 | pop eax |
287 | add eax, [I_END+10] |
307 | add eax, [I_END+10] |
288 | mov [sop],eax ;sop-start of picture in file |
308 | mov [sop],eax ;sop-start of picture in file |
289 | add eax, [I_END+34] |
309 | add eax, [I_END+34] |
290 | mov [eop],eax ;eop-end of picture in file |
310 | mov [eop],eax ;eop-end of picture in file |
291 | mov eax, [I_END+18] |
311 | mov eax, [I_END+18] |
292 | mov ebx,3 |
312 | mov ebx,3 |
293 | mul ebx ;3x pixels in eax |
313 | mul ebx ;3x pixels in eax |
294 | 314 | ||
295 | mov edi,[soi] ;initializing |
315 | mov edi,[soi] ;initializing |
296 | mov esi,[eop] |
316 | mov esi,[eop] |
297 | sub esi,[bps] |
317 | sub esi,[bps] |
298 | 318 | ||
299 | 319 | ||
300 | nextstring: |
320 | nextstring: |
301 | push edi |
321 | push edi |
302 | cmp word [I_END+28],24 |
322 | cmp word [I_END+28],24 |
303 | jne convertno32 |
323 | jne convertno32 |
304 | 324 | ||
305 | mov ecx,[dwps] |
325 | mov ecx,[dwps] |
306 | cld |
326 | cld |
307 | rep movsd |
327 | rep movsd |
308 | convert1: |
328 | convert1: |
309 | pop edi |
329 | pop edi |
310 | sub esi,[bps] |
330 | sub esi,[bps] |
311 | sub esi,[bps] |
331 | sub esi,[bps] |
312 | cmp esi,[sop] |
332 | cmp esi,[sop] |
313 | jb nomorestring |
333 | jb nomorestring |
314 | add edi,eax |
334 | add edi,eax |
315 | jmp nextstring |
335 | jmp nextstring |
316 | 336 | ||
317 | nomorestring: |
337 | nomorestring: |
318 | ret |
338 | ret |
319 | 339 | ||
320 | convertno32: |
340 | convertno32: |
321 | mov ebx,I_END |
341 | mov ebx,I_END |
322 | add ebx, [I_END+14] |
342 | add ebx, [I_END+14] |
323 | add ebx,14 ;start of color table |
343 | add ebx,14 ;start of color table |
324 | push esi |
344 | push esi |
325 | add esi,[bps] |
345 | add esi,[bps] |
326 | mov [eos],esi |
346 | mov [eos],esi |
327 | pop esi |
347 | pop esi |
328 | nextelem: |
348 | nextelem: |
329 | push eax |
349 | push eax |
330 | movzx eax,byte [esi] |
350 | movzx eax,byte [esi] |
331 | cmp word [I_END+28],4 |
351 | cmp word [I_END+28],4 |
332 | je convert4bpp |
352 | je convert4bpp |
333 | cmp word [I_END+28],1 |
353 | cmp word [I_END+28],1 |
334 | je convert1bpp |
354 | je convert1bpp |
335 | call converttable |
355 | call converttable |
336 | convert2: |
356 | convert2: |
337 | pop eax |
357 | pop eax |
338 | inc esi |
358 | inc esi |
339 | cmp esi,[eos] |
359 | cmp esi,[eos] |
340 | jae convert1 |
360 | jae convert1 |
341 | add edi,3 |
361 | add edi,3 |
342 | jmp nextelem |
362 | jmp nextelem |
343 | 363 | ||
344 | convert4bpp: |
364 | convert4bpp: |
345 | shl ax,4 |
365 | shl ax,4 |
346 | shr al,4 |
366 | shr al,4 |
347 | push ax |
367 | push ax |
348 | movzx eax,ah |
368 | movzx eax,ah |
349 | call converttable |
369 | call converttable |
350 | add edi,3 |
370 | add edi,3 |
351 | pop ax |
371 | pop ax |
352 | movzx eax,al |
372 | movzx eax,al |
353 | call converttable |
373 | call converttable |
354 | jmp convert2 |
374 | jmp convert2 |
355 | 375 | ||
356 | convert1bpp: |
376 | convert1bpp: |
357 | mov ecx,eax |
377 | mov ecx,eax |
358 | mov edx,7 |
378 | mov edx,7 |
359 | nextbit: |
379 | nextbit: |
360 | xor eax,eax |
380 | xor eax,eax |
361 | bt ecx,edx |
381 | bt ecx,edx |
362 | jnc noaddelem |
382 | jnc noaddelem |
363 | inc eax |
383 | inc eax |
364 | noaddelem: |
384 | noaddelem: |
365 | push edx |
385 | push edx |
366 | call converttable |
386 | call converttable |
367 | pop edx |
387 | pop edx |
368 | dec edx |
388 | dec edx |
369 | cmp edx,0xffffffff |
389 | cmp edx,0xffffffff |
370 | je convert2 |
390 | je convert2 |
371 | add edi,3 |
391 | add edi,3 |
372 | jmp nextbit |
392 | jmp nextbit |
373 | 393 | ||
374 | converttable: |
394 | converttable: |
375 | shl eax,2 |
395 | shl eax,2 |
376 | add eax,ebx |
396 | add eax,ebx |
377 | mov edx, [eax] |
397 | mov edx, [eax] |
378 | mov dword [edi],edx |
398 | mov dword [edi],edx |
379 | ret |
399 | ret |
380 | 400 | ||
381 | ; ********************************************* |
401 | ; ********************************************* |
382 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
402 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
383 | ; ********************************************* |
403 | ; ********************************************* |
384 | 404 | ||
385 | 405 | ||
386 | draw_window: |
406 | draw_window: |
387 | - | ||
- | 407 | or [bWasDraw],1 |
|
388 | 408 | ||
389 | mov eax,12 ; function 12:tell os about windowdraw |
409 | mov eax,12 ; function 12:tell os about windowdraw |
390 | mov ebx,1 ; 1, start of draw |
410 | mov ebx,1 ; 1, start of draw |
391 | int 0x40 |
411 | int 0x40 |
392 | 412 | ||
393 | ; DRAW WINDOW |
413 | ; DRAW WINDOW |
394 | xor eax,eax ; function 0 : define and draw window |
414 | xor eax,eax ; function 0 : define and draw window |
395 | mov ebx,350 ; [x start] *65536 + [x size] |
415 | ; mov ebx,350 ; [x start] *65536 + [x size] |
396 | mov ecx,400 ; [y start] *65536 + [y size] |
416 | ; mov ecx,400 ; [y start] *65536 + [y size] |
- | 417 | mov ebx,100*65536 |
|
- | 418 | mov ecx,100*65536 |
|
- | 419 | add ebx,[wnd_width] |
|
- | 420 | add ecx,[wnd_height] |
|
397 | mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl |
421 | mov edx,0x03ffffff ; color of work area RRGGBB,8->color gl |
398 | int 0x40 |
422 | int 0x40 |
399 | 423 | ||
400 | mov eax,8 |
424 | mov eax,8 |
401 | mov ebx,10*65536+46 |
425 | mov ebx,10*65536+46 |
402 | mov ecx,25*65536+20 |
426 | mov ecx,25*65536+20 |
403 | mov edx,2 |
427 | mov edx,2 |
404 | mov esi,0x780078 |
428 | mov esi,0x780078 |
405 | newbutton: |
429 | newbutton: |
406 | int 0x40 |
430 | int 0x40 |
407 | add ebx,48*65536 |
431 | add ebx,48*65536 |
408 | inc edx |
432 | inc edx |
409 | cmp edx,6 |
433 | cmp edx,6 |
410 | jb newbutton |
434 | jb newbutton |
411 | 435 | ||
412 | ; WINDOW LABEL |
436 | ; WINDOW LABEL |
413 | mov eax,4 ; function 4 : write text to window |
437 | mov eax,4 ; function 4 : write text to window |
414 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
438 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
415 | mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
439 | mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
416 | mov edx,labelt ; pointer to text beginning |
440 | mov edx,labelt ; pointer to text beginning |
417 | mov esi,12 ; text length |
441 | mov esi,12 ; text length |
418 | int 0x40 |
442 | int 0x40 |
419 | 443 | ||
420 | mov ebx,14*65536+32 |
444 | mov ebx,14*65536+32 |
421 | mov edx,buttext |
445 | mov edx,buttext |
422 | mov esi,26 |
446 | mov esi,26 |
423 | int 0x40 |
447 | int 0x40 |
424 | 448 | ||
425 | call drawimage |
449 | call drawimage |
426 | 450 | ||
427 | mov eax,12 ; function 12:tell os about windowdraw |
451 | mov eax,12 ; function 12:tell os about windowdraw |
428 | mov ebx,2 ; 2, end of draw |
452 | mov ebx,2 ; 2, end of draw |
429 | int 0x40 |
453 | int 0x40 |
430 | 454 | ||
431 | ret |
455 | ret |
432 | 456 | ||
433 | 457 | ||
434 | ; DATA AREA |
458 | ; DATA AREA |
435 | 459 | ||
436 | labelt: |
460 | labelt: |
437 | db 'MeView v.0.3' |
461 | db 'MeView v.0.3' |
438 | 462 | ||
439 | lsz buttext,\ |
463 | lsz buttext,\ |
440 | en, ' FILE OPEN INFO BGRD',\ |
464 | en, ' FILE OPEN INFO BGRD',\ |
441 | ru, ' ' |
465 | ru, ' ' |
442 | 466 | ||
443 | status dd 0 ;bit0=1 if file thread is created |
467 | status dd 0 ;bit0=1 if file thread is created |
444 | bps dd 0 |
468 | bps dd 0 |
445 | dwps dd 0 |
469 | dwps dd 0 |
446 | soi dd 0 |
470 | soi dd 0 |
447 | sop dd 0 |
471 | sop dd 0 |
448 | eop dd 0 |
472 | eop dd 0 |
449 | eos dd 0 |
473 | eos dd 0 |
450 | process dd 0 |
474 | process dd 0 |
- | 475 | ||
- | 476 | bWasDraw db 0 |
|
451 | 477 | ||
452 | thread1: ; start of thread1 |
478 | thread1: ; start of thread1 |
453 | 479 | ||
454 | call draw_window1 |
480 | call draw_window1 |
455 | 481 | ||
456 | still1: |
482 | still1: |
457 | 483 | ||
458 | mov eax,10 ; wait here for event |
484 | mov eax,10 ; wait here for event |
459 | int 0x40 |
485 | int 0x40 |
460 | 486 | ||
461 | cmp eax,1 ; redraw request ? |
487 | cmp eax,1 ; redraw request ? |
462 | je thread1 |
488 | je thread1 |
463 | cmp eax,2 ; key in buffer ? |
489 | cmp eax,2 ; key in buffer ? |
464 | je key1 |
490 | je key1 |
465 | cmp eax,3 ; button in buffer ? |
491 | cmp eax,3 ; button in buffer ? |
466 | je button1 |
492 | je button1 |
467 | 493 | ||
468 | jmp still1 |
494 | jmp still1 |
469 | 495 | ||
470 | key1: ; key |
496 | key1: ; key |
471 | int 0x40 |
497 | int 0x40 |
472 | cmp ah,179 |
498 | cmp ah,179 |
473 | jne noright |
499 | jne noright |
474 | mov eax,[pos] |
500 | mov eax,[pos] |
475 | cmp eax,41 |
501 | cmp eax,41 |
476 | ja still1 |
502 | ja still1 |
477 | inc eax |
503 | inc eax |
478 | mov [pos],eax |
504 | mov [pos],eax |
479 | call drawstring |
505 | call drawstring |
480 | jmp still1 |
506 | jmp still1 |
481 | noright: |
507 | noright: |
482 | cmp ah,176 |
508 | cmp ah,176 |
483 | jne noleft |
509 | jne noleft |
484 | mov eax,[pos] |
510 | mov eax,[pos] |
485 | test eax,eax |
511 | test eax,eax |
486 | je still1 |
512 | je still1 |
487 | dec eax |
513 | dec eax |
488 | mov [pos],eax |
514 | mov [pos],eax |
489 | call drawstring |
515 | call drawstring |
490 | jmp still1 |
516 | jmp still1 |
491 | noleft: |
517 | noleft: |
492 | cmp ah,182 ;del |
518 | cmp ah,182 ;del |
493 | jne nodelet |
519 | jne nodelet |
494 | call shiftback |
520 | call shiftback |
495 | call drawstring |
521 | call drawstring |
496 | jmp still1 |
522 | jmp still1 |
497 | nodelet: |
523 | nodelet: |
498 | cmp ah,8 ;zaboy |
524 | cmp ah,8 ;zaboy |
499 | jne noback |
525 | jne noback |
500 | mov eax,[pos] |
526 | mov eax,[pos] |
501 | test eax,eax |
527 | test eax,eax |
502 | je still1 |
528 | je still1 |
503 | dec eax |
529 | dec eax |
504 | mov [pos],eax |
530 | mov [pos],eax |
505 | call shiftback |
531 | call shiftback |
506 | call drawstring |
532 | call drawstring |
507 | jmp still1 |
533 | jmp still1 |
508 | noback: |
534 | noback: |
509 | cmp ah,13 |
535 | cmp ah,13 |
510 | jne noenter |
536 | jne noenter |
511 | enter1: |
537 | enter1: |
512 | mov al,byte ' ' |
538 | mov al,byte ' ' |
513 | mov edi,string |
539 | mov edi,string |
514 | mov ecx,43 |
540 | mov ecx,43 |
515 | cld |
541 | cld |
516 | repne scasb |
542 | repne scasb |
517 | dec edi |
543 | dec edi |
518 | mov byte [edi],0 |
544 | mov byte [edi],0 |
519 | jmp close1 |
545 | jmp close1 |
520 | noenter: |
546 | noenter: |
521 | cmp ah,27 |
547 | cmp ah,27 |
522 | jne noesc |
548 | jne noesc |
523 | jmp enter1 |
549 | jmp enter1 |
524 | noesc: |
550 | noesc: |
525 | cmp dword [pos],42 |
551 | cmp dword [pos],42 |
526 | jae still1 |
552 | jae still1 |
527 | 553 | ||
528 | mov edi,string |
554 | mov edi,string |
529 | add edi,42 |
555 | add edi,42 |
530 | mov esi,edi |
556 | mov esi,edi |
531 | dec esi |
557 | dec esi |
532 | mov ecx,42 |
558 | mov ecx,42 |
533 | sub ecx,[pos] |
559 | sub ecx,[pos] |
534 | std |
560 | std |
535 | rep movsb |
561 | rep movsb |
536 | 562 | ||
537 | shr eax,8 |
563 | shr eax,8 |
538 | mov esi,string |
564 | mov esi,string |
539 | add esi,[pos] |
565 | add esi,[pos] |
540 | mov byte [esi],al |
566 | mov byte [esi],al |
541 | inc dword [pos] |
567 | inc dword [pos] |
542 | call drawstring |
568 | call drawstring |
543 | 569 | ||
544 | jmp still1 |
570 | jmp still1 |
545 | 571 | ||
546 | button1: ; button |
572 | button1: ; button |
547 | mov eax,17 ; get id |
573 | mov eax,17 ; get id |
548 | int 0x40 |
574 | int 0x40 |
549 | 575 | ||
550 | cmp ah,1 ; button id=1 ? |
576 | cmp ah,1 ; button id=1 ? |
551 | jne noclose1 |
577 | jne noclose1 |
552 | jmp enter1 |
578 | jmp enter1 |
553 | close1: |
579 | close1: |
554 | bts dword [status],2 |
580 | bts dword [status],2 |
555 | btr dword [status],0 |
581 | btr dword [status],0 |
556 | mov eax,-1 ; close this program |
582 | mov eax,-1 ; close this program |
557 | int 0x40 |
583 | int 0x40 |
558 | noclose1: |
584 | noclose1: |
559 | cmp ah,2 |
585 | cmp ah,2 |
560 | jne nosetcur |
586 | jne nosetcur |
561 | mov eax,37 |
587 | mov eax,37 |
562 | mov ebx,1 |
588 | mov ebx,1 |
563 | int 0x40 |
589 | int 0x40 |
564 | shr eax,16 |
590 | shr eax,16 |
565 | sub eax,21 |
591 | sub eax,21 |
566 | xor edx,edx |
592 | xor edx,edx |
567 | mov ebx,6 |
593 | mov ebx,6 |
568 | div ebx |
594 | div ebx |
569 | mov [pos],eax |
595 | mov [pos],eax |
570 | call drawstring |
596 | call drawstring |
571 | jmp still1 |
597 | jmp still1 |
572 | nosetcur: |
598 | nosetcur: |
573 | jmp still1 |
599 | jmp still1 |
574 | 600 | ||
575 | 601 | ||
576 | shiftback: |
602 | shiftback: |
577 | mov edi,string |
603 | mov edi,string |
578 | add edi,[pos] |
604 | add edi,[pos] |
579 | mov esi,edi |
605 | mov esi,edi |
580 | inc esi |
606 | inc esi |
581 | mov ecx,43 |
607 | mov ecx,43 |
582 | sub ecx,[pos] |
608 | sub ecx,[pos] |
583 | cld |
609 | cld |
584 | rep movsb |
610 | rep movsb |
585 | ret |
611 | ret |
586 | 612 | ||
587 | ; ********************************************* |
613 | ; ********************************************* |
588 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
614 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
589 | ; ********************************************* |
615 | ; ********************************************* |
590 | 616 | ||
591 | 617 | ||
592 | draw_window1: |
618 | draw_window1: |
593 | 619 | ||
594 | 620 | ||
595 | mov eax,12 ; function 12:tell os about windowdraw |
621 | mov eax,12 ; function 12:tell os about windowdraw |
596 | mov ebx,1 ; 1, start of draw |
622 | mov ebx,1 ; 1, start of draw |
597 | int 0x40 |
623 | int 0x40 |
598 | 624 | ||
599 | ; DRAW WINDOW |
625 | ; DRAW WINDOW |
600 | xor eax,eax ; function 0 : define and draw window |
626 | xor eax,eax ; function 0 : define and draw window |
601 | mov ebx,100*65536+300 ; [x start] *65536 + [x size] |
627 | mov ebx,100*65536+300 ; [x start] *65536 + [x size] |
602 | mov ecx,100*65536+80 ; [y start] *65536 + [y size] |
628 | mov ecx,100*65536+80 ; [y start] *65536 + [y size] |
603 | mov edx,0x03780078 ; color of work area RRGGBB,8->color gl |
629 | mov edx,0x03780078 ; color of work area RRGGBB,8->color gl |
604 | int 0x40 |
630 | int 0x40 |
605 | 631 | ||
606 | ; WINDOW LABEL |
632 | ; WINDOW LABEL |
607 | mov eax,4 ; function 4 : write text to window |
633 | mov eax,4 ; function 4 : write text to window |
608 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
634 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
609 | mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
635 | mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
610 | mov edx,labelt1 ; pointer to text beginning |
636 | mov edx,labelt1 ; pointer to text beginning |
611 | mov esi,4 ; text length |
637 | mov esi,4 ; text length |
612 | int 0x40 |
638 | int 0x40 |
613 | 639 | ||
614 | call drawstring |
640 | call drawstring |
615 | 641 | ||
616 | mov eax,12 ; function 12:tell os about windowdraw |
642 | mov eax,12 ; function 12:tell os about windowdraw |
617 | mov ebx,2 ; 2, end of draw |
643 | mov ebx,2 ; 2, end of draw |
618 | int 0x40 |
644 | int 0x40 |
619 | 645 | ||
620 | ret |
646 | ret |
621 | 647 | ||
622 | drawstring: |
648 | drawstring: |
623 | pusha |
649 | pusha |
624 | mov eax,8 ;invisible button |
650 | mov eax,8 ;invisible button |
625 | mov ebx,21*65536+258 |
651 | mov ebx,21*65536+258 |
626 | mov ecx,40*65536+15 |
652 | mov ecx,40*65536+15 |
627 | mov edx,0x40000002 |
653 | mov edx,0x60000002 |
628 | int 0x40 |
654 | int 0x40 |
629 | 655 | ||
630 | mov eax,13 ;bar |
656 | mov eax,13 ;bar |
631 | mov edx,0xe0e0e0 |
657 | mov edx,0xe0e0e0 |
632 | int 0x40 |
658 | int 0x40 |
633 | push eax ;cursor |
659 | push eax ;cursor |
634 | mov eax,6*65536 |
660 | mov eax,6*65536 |
635 | mul dword [pos] |
661 | mul dword [pos] |
636 | add eax,21*65536+6 |
662 | add eax,21*65536+6 |
637 | mov ebx,eax |
663 | mov ebx,eax |
638 | pop eax |
664 | pop eax |
639 | mov edx,0x6a73d0 |
665 | mov edx,0x6a73d0 |
640 | int 0x40 |
666 | int 0x40 |
641 | mov eax,4 ;path |
667 | mov eax,4 ;path |
642 | mov ebx,21*65536+44 |
668 | mov ebx,21*65536+44 |
643 | xor ecx,ecx |
669 | xor ecx,ecx |
644 | mov edx,string |
670 | mov edx,string |
645 | mov esi,43 |
671 | mov esi,43 |
646 | int 0x40 |
672 | int 0x40 |
647 | 673 | ||
648 | 674 | ||
649 | popa |
675 | popa |
650 | ret |
676 | ret |
651 | 677 | ||
652 | ; DATA AREA |
678 | ; DATA AREA |
653 | 679 | ||
654 | lsz labelt1,\ |
680 | lsz labelt1,\ |
655 | en, 'File',\ |
681 | en, 'File',\ |
656 | ru, ' ©«' |
682 | ru, ' ©«' |
657 | 683 | ||
658 | pos: dd 6 |
684 | pos: dd 6 |
659 | fileinfo: |
685 | fileinfo: |
660 | dd 0 |
686 | dd 0 |
661 | dd 0 |
687 | dd 0 |
662 | dd 1 ;number of blocks of 512 bytes |
688 | dd 1 ;number of blocks of 512 bytes |
663 | dd I_END |
689 | dd I_END |
664 | dd temp_area |
690 | dd temp_area |
665 | string: |
691 | string: |
666 | ; db '/HARDDISK/FIRST/1/DICK.BMP ' |
692 | ; db '/HARDDISK/FIRST/1/DICK.BMP ' |
667 | db '/hd/1/menuet/pics/new.bmp ' |
693 | ; db '/hd/1/menuet/pics/new.bmp ' |
- | 694 | db '/rd/1/bgr.bmp ' |
|
668 | db ' ' |
695 | db ' ' |
669 | db ' ' |
696 | db ' ' |
670 | 697 | ||
671 | thread2: ; start of info thread |
698 | thread2: ; start of info thread |
672 | 699 | ||
673 | call draw_window2 |
700 | call draw_window2 |
674 | 701 | ||
675 | still2: |
702 | still2: |
676 | 703 | ||
677 | mov eax,10 ; wait here for event |
704 | mov eax,10 ; wait here for event |
678 | int 0x40 |
705 | int 0x40 |
679 | 706 | ||
680 | cmp eax,1 ; redraw request ? |
707 | cmp eax,1 ; redraw request ? |
681 | je thread2 |
708 | je thread2 |
682 | cmp eax,2 ; key in buffer ? |
709 | cmp eax,2 ; key in buffer ? |
683 | je close2 |
710 | je close2 |
684 | cmp eax,3 ; button in buffer ? |
711 | cmp eax,3 ; button in buffer ? |
685 | je button2 |
712 | je button2 |
686 | 713 | ||
687 | jmp still2 |
714 | jmp still2 |
688 | 715 | ||
689 | button2: ; button |
716 | button2: ; button |
690 | mov eax,17 ; get id |
717 | mov eax,17 ; get id |
691 | int 0x40 |
718 | int 0x40 |
692 | 719 | ||
693 | cmp ah,1 ; button id=1 ? |
720 | cmp ah,1 ; button id=1 ? |
694 | jne noclose2 |
721 | jne noclose2 |
695 | close2: |
722 | close2: |
696 | btr dword [status],1 |
723 | btr dword [status],1 |
697 | bts dword [status],2 |
724 | bts dword [status],2 |
698 | mov eax,-1 ; close this program |
725 | mov eax,-1 ; close this program |
699 | int 0x40 |
726 | int 0x40 |
700 | noclose2: |
727 | noclose2: |
701 | 728 | ||
702 | jmp still2 |
729 | jmp still2 |
703 | 730 | ||
704 | 731 | ||
705 | 732 | ||
706 | 733 | ||
707 | ; ********************************************* |
734 | ; ********************************************* |
708 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
735 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
709 | ; ********************************************* |
736 | ; ********************************************* |
710 | 737 | ||
711 | 738 | ||
712 | draw_window2: |
739 | draw_window2: |
713 | 740 | ||
714 | 741 | ||
715 | mov eax,12 ; function 12:tell os about windowdraw |
742 | mov eax,12 ; function 12:tell os about windowdraw |
716 | mov ebx,1 ; 1, start of draw |
743 | mov ebx,1 ; 1, start of draw |
717 | int 0x40 |
744 | int 0x40 |
718 | 745 | ||
719 | ; DRAW WINDOW |
746 | ; DRAW WINDOW |
720 | xor eax,eax ; function 0 : define and draw window |
747 | xor eax,eax ; function 0 : define and draw window |
721 | mov ebx,100*65536+330 ; [x start] *65536 + [x size] |
748 | mov ebx,100*65536+330 ; [x start] *65536 + [x size] |
722 | mov ecx,100*65536+90 ; [y start] *65536 + [y size] |
749 | mov ecx,100*65536+90 ; [y start] *65536 + [y size] |
723 | mov edx,0x03780078 ; color of work area RRGGBB,8->color gl |
750 | mov edx,0x03780078 ; color of work area RRGGBB,8->color gl |
724 | int 0x40 |
751 | int 0x40 |
725 | 752 | ||
726 | ; WINDOW LABEL |
753 | ; WINDOW LABEL |
727 | mov eax,4 ; function 4 : write text to window |
754 | mov eax,4 ; function 4 : write text to window |
728 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
755 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
729 | mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
756 | mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
730 | mov edx,labelt2 ; pointer to text beginning |
757 | mov edx,labelt2 ; pointer to text beginning |
731 | mov esi,labelt2.size ; text length |
758 | mov esi,labelt2.size ; text length |
732 | int 0x40 |
759 | int 0x40 |
733 | 760 | ||
734 | mov ebx,10*65536+30 |
761 | mov ebx,10*65536+30 |
735 | mov edx,string |
762 | mov edx,string |
736 | mov esi,43 |
763 | mov esi,43 |
737 | int 0x40 |
764 | int 0x40 |
738 | mov edx,fitext |
765 | mov edx,fitext |
739 | mov esi,14 |
766 | mov esi,14 |
740 | add ebx,70*65536+10 |
767 | add ebx,70*65536+10 |
741 | followstring: |
768 | followstring: |
742 | int 0x40 |
769 | int 0x40 |
743 | add ebx,10 |
770 | add ebx,10 |
744 | add edx,esi |
771 | add edx,esi |
745 | cmp ebx,80*65536+70 |
772 | cmp ebx,80*65536+70 |
746 | jbe followstring |
773 | jbe followstring |
747 | mov eax,47 |
774 | mov eax,47 |
748 | mov edx,200*65536+40 |
775 | mov edx,200*65536+40 |
749 | mov esi,ecx |
776 | mov esi,ecx |
750 | mov ecx, [I_END+2] |
777 | mov ecx, [I_END+2] |
751 | call digitcorrect |
778 | call digitcorrect |
752 | int 0x40 |
779 | int 0x40 |
753 | add edx,10 |
780 | add edx,10 |
754 | mov ecx, [I_END+18] |
781 | mov ecx, [I_END+18] |
755 | call digitcorrect |
782 | call digitcorrect |
756 | int 0x40 |
783 | int 0x40 |
757 | add edx,10 |
784 | add edx,10 |
758 | mov ecx, [I_END+22] |
785 | mov ecx, [I_END+22] |
759 | call digitcorrect |
786 | call digitcorrect |
760 | int 0x40 |
787 | int 0x40 |
761 | add edx,10 |
788 | add edx,10 |
762 | movzx ecx,word [I_END+28] |
789 | movzx ecx,word [I_END+28] |
763 | call digitcorrect |
790 | call digitcorrect |
764 | int 0x40 |
791 | int 0x40 |
765 | 792 | ||
766 | mov eax,12 ; function 12:tell os about windowdraw |
793 | mov eax,12 ; function 12:tell os about windowdraw |
767 | mov ebx,2 ; 2, end of draw |
794 | mov ebx,2 ; 2, end of draw |
768 | int 0x40 |
795 | int 0x40 |
769 | 796 | ||
770 | ret |
797 | ret |
771 | 798 | ||
772 | digitcorrect: |
799 | digitcorrect: |
773 | xor ebx,ebx |
800 | xor ebx,ebx |
774 | mov bh,6 |
801 | mov bh,6 |
775 | cmp ecx,99999 |
802 | cmp ecx,99999 |
776 | ja c_end |
803 | ja c_end |
777 | dec bh |
804 | dec bh |
778 | cmp ecx,9999 |
805 | cmp ecx,9999 |
779 | ja c_end |
806 | ja c_end |
780 | dec bh |
807 | dec bh |
781 | cmp ecx,999 |
808 | cmp ecx,999 |
782 | ja c_end |
809 | ja c_end |
783 | dec bh |
810 | dec bh |
784 | cmp ecx,99 |
811 | cmp ecx,99 |
785 | ja c_end |
812 | ja c_end |
786 | dec bh |
813 | dec bh |
787 | cmp ecx,9 |
814 | cmp ecx,9 |
788 | ja c_end |
815 | ja c_end |
789 | dec bh |
816 | dec bh |
790 | c_end: |
817 | c_end: |
791 | bswap ebx |
818 | bswap ebx |
792 | ret |
819 | ret |
793 | 820 | ||
794 | 821 | ||
795 | ; DATA AREA |
822 | ; DATA AREA |
796 | 823 | ||
797 | lsz labelt2,\ |
824 | lsz labelt2,\ |
798 | en, 'File info',\ |
825 | en, 'File info',\ |
799 | ru, 'ä®à¬ æ¨ï ® ä ©«¥' |
826 | ru, 'ä®à¬ æ¨ï ® ä ©«¥' |
800 | 827 | ||
801 | lsz fitext,\ |
828 | lsz fitext,\ |
802 | en, 'FILE SIZE ',\ |
829 | en, 'FILE SIZE ',\ |
803 | en, 'X SIZE ',\ |
830 | en, 'X SIZE ',\ |
804 | en, 'Y SIZE ',\ |
831 | en, 'Y SIZE ',\ |
805 | en, 'BITS PER PIXEL',\ |
832 | en, 'BITS PER PIXEL',\ |
806 | \ |
833 | \ |
807 | ru, ' §¬¥à ä ©« ',\ |
834 | ru, ' §¬¥à ä ©« ',\ |
808 | ru, '¨à¨ ',\ |
835 | ru, '¨à¨ ',\ |
809 | ru, 'ëá®â ',\ |
836 | ru, 'ëá®â ',\ |
810 | ru, '¨â ¯¨ªá¥« ' |
837 | ru, '¨â ¯¨ªá¥« ' |
811 | 838 | ||
812 | thread3: ; start of bgrd thread |
839 | thread3: ; start of bgrd thread |
813 | 840 | ||
814 | call draw_window3 |
841 | call draw_window3 |
815 | 842 | ||
816 | still3: |
843 | still3: |
817 | 844 | ||
818 | mov eax,10 ; wait here for event |
845 | mov eax,10 ; wait here for event |
819 | int 0x40 |
846 | int 0x40 |
820 | 847 | ||
821 | cmp eax,1 ; redraw request ? |
848 | cmp eax,1 ; redraw request ? |
822 | je thread3 |
849 | je thread3 |
823 | cmp eax,2 ; key in buffer ? |
850 | cmp eax,2 ; key in buffer ? |
824 | je key3 |
851 | je key3 |
825 | cmp eax,3 ; button in buffer ? |
852 | cmp eax,3 ; button in buffer ? |
826 | je button3 |
853 | je button3 |
827 | 854 | ||
828 | jmp still3 |
855 | jmp still3 |
829 | 856 | ||
830 | key3: |
857 | key3: |
831 | int 0x40 |
858 | int 0x40 |
832 | cmp ah,27 |
859 | cmp ah,27 |
833 | je close3 |
860 | je close3 |
834 | cmp ah,13 |
861 | cmp ah,13 |
835 | je kok |
862 | je kok |
836 | cmp ah,178 ;up |
863 | cmp ah,178 ;up |
837 | jne nofup |
864 | jne nofup |
838 | cmp dword [bgrmode],1 |
865 | cmp dword [bgrmode],1 |
839 | je fdn |
866 | je fdn |
840 | fup: |
867 | fup: |
841 | dec dword [bgrmode] |
868 | dec dword [bgrmode] |
842 | jmp flagcont |
869 | jmp flagcont |
843 | nofup: |
870 | nofup: |
844 | cmp ah,177 ;down |
871 | cmp ah,177 ;down |
845 | jne still3 |
872 | jne still3 |
846 | cmp dword [bgrmode],2 |
873 | cmp dword [bgrmode],2 |
847 | je fup |
874 | je fup |
848 | fdn: |
875 | fdn: |
849 | inc dword [bgrmode] |
876 | inc dword [bgrmode] |
850 | jmp flagcont |
877 | jmp flagcont |
851 | 878 | ||
852 | 879 | ||
853 | button3: ; button |
880 | button3: ; button |
854 | mov eax,17 ; get id |
881 | mov eax,17 ; get id |
855 | int 0x40 |
882 | int 0x40 |
856 | 883 | ||
857 | cmp ah,1 ; button id=1 ? |
884 | cmp ah,1 ; button id=1 ? |
858 | jne noclose3 |
885 | jne noclose3 |
859 | close3: |
886 | close3: |
860 | btr dword [status],3 |
887 | btr dword [status],3 |
861 | bts dword [status],2 |
888 | bts dword [status],2 |
862 | mov eax,-1 ; close this program |
889 | mov eax,-1 ; close this program |
863 | int 0x40 |
890 | int 0x40 |
864 | noclose3: |
891 | noclose3: |
865 | cmp ah,4 |
892 | cmp ah,4 |
866 | jne nook |
893 | jne nook |
867 | kok: |
894 | kok: |
868 | call background |
895 | call background |
869 | jmp close3 |
896 | jmp close3 |
870 | nook: |
897 | nook: |
871 | cmp ah,2 |
898 | cmp ah,2 |
872 | jb still3 |
899 | jb still3 |
873 | cmp ah,3 |
900 | cmp ah,3 |
874 | ja still3 |
901 | ja still3 |
875 | dec ah |
902 | dec ah |
876 | mov byte [bgrmode],ah |
903 | mov byte [bgrmode],ah |
877 | flagcont: |
904 | flagcont: |
878 | call drawflags |
905 | call drawflags |
879 | jmp still3 |
906 | jmp still3 |
880 | 907 | ||
881 | 908 | ||
882 | 909 | ||
883 | 910 | ||
884 | ; ********************************************* |
911 | ; ********************************************* |
885 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
912 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
886 | ; ********************************************* |
913 | ; ********************************************* |
887 | 914 | ||
888 | 915 | ||
889 | draw_window3: |
916 | draw_window3: |
890 | 917 | ||
891 | 918 | ||
892 | mov eax,12 ; function 12:tell os about windowdraw |
919 | mov eax,12 ; function 12:tell os about windowdraw |
893 | mov ebx,1 ; 1, start of draw |
920 | mov ebx,1 ; 1, start of draw |
894 | int 0x40 |
921 | int 0x40 |
895 | 922 | ||
896 | ; DRAW WINDOW |
923 | ; DRAW WINDOW |
897 | xor eax,eax ; function 0 : define and draw window |
924 | xor eax,eax ; function 0 : define and draw window |
898 | mov ebx,100*65536+200 ; [x start] *65536 + [x size] |
925 | mov ebx,100*65536+200 ; [x start] *65536 + [x size] |
899 | mov ecx,100*65536+100 ; [y start] *65536 + [y size] |
926 | mov ecx,100*65536+100 ; [y start] *65536 + [y size] |
900 | mov edx,0x03780078 ; color of work area RRGGBB,8->color gl |
927 | mov edx,0x03780078 ; color of work area RRGGBB,8->color gl |
901 | int 0x40 |
928 | int 0x40 |
902 | 929 | ||
903 | mov eax,8 |
930 | mov eax,8 |
904 | mov ebx,70*65536+40 |
931 | mov ebx,70*65536+40 |
905 | mov ecx,70*65536+20 |
932 | mov ecx,70*65536+20 |
906 | mov edx,4 |
933 | mov edx,4 |
907 | mov esi,0xac0000 |
934 | mov esi,0xac0000 |
908 | int 0x40 |
935 | int 0x40 |
909 | 936 | ||
910 | ; WINDOW LABEL |
937 | ; WINDOW LABEL |
911 | mov eax,4 ; function 4 : write text to window |
938 | mov eax,4 ; function 4 : write text to window |
912 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
939 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
913 | mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
940 | mov ecx,0x10ddeeff ; font 1 & color ( 0xF0RRGGBB ) |
914 | mov edx,labelt3 ; pointer to text beginning |
941 | mov edx,labelt3 ; pointer to text beginning |
915 | mov esi,14 ; text length |
942 | mov esi,14 ; text length |
916 | int 0x40 |
943 | int 0x40 |
917 | add ebx,38*65536+20 |
944 | add ebx,38*65536+20 |
918 | mov ecx,0xddeeff |
945 | mov ecx,0xddeeff |
919 | mov edx, bgrdtext |
946 | mov edx, bgrdtext |
920 | mov esi, bgrdtext.size |
947 | mov esi, bgrdtext.size |
921 | int 0x40 |
948 | int 0x40 |
922 | add ebx,40*65536+15 |
949 | add ebx,40*65536+15 |
923 | mov edx, tiled |
950 | mov edx, tiled |
924 | mov esi, tiled.size |
951 | mov esi, tiled.size |
925 | int 0x40 |
952 | int 0x40 |
926 | add ebx,15 |
953 | add ebx,15 |
927 | mov edx, stretch |
954 | mov edx, stretch |
928 | mov esi, stretch.size ;7 |
955 | mov esi, stretch.size ;7 |
929 | int 0x40 |
956 | int 0x40 |
930 | add ebx,18 |
957 | add ebx,18 |
931 | mov edx, ok_btn |
958 | mov edx, ok_btn |
932 | mov esi, ok_btn.size ;2 |
959 | mov esi, ok_btn.size ;2 |
933 | int 0x40 |
960 | int 0x40 |
934 | 961 | ||
935 | call drawflags |
962 | call drawflags |
936 | 963 | ||
937 | mov eax,12 ; function 12:tell os about windowdraw |
964 | mov eax,12 ; function 12:tell os about windowdraw |
938 | mov ebx,2 ; 2, end of draw |
965 | mov ebx,2 ; 2, end of draw |
939 | int 0x40 |
966 | int 0x40 |
940 | 967 | ||
941 | ret |
968 | ret |
942 | 969 | ||
943 | drawflags: |
970 | drawflags: |
944 | mov eax,8 |
971 | mov eax,8 |
945 | mov ebx,70*65536+10 |
972 | mov ebx,70*65536+10 |
946 | mov ecx,40*65536+10 |
973 | mov ecx,40*65536+10 |
947 | mov edx,2 |
974 | mov edx,2 |
948 | mov esi,0xe0e0e0 |
975 | mov esi,0xe0e0e0 |
949 | int 0x40 |
976 | int 0x40 |
950 | add ecx,15*65536 |
977 | add ecx,15*65536 |
951 | inc edx |
978 | inc edx |
952 | int 0x40 |
979 | int 0x40 |
953 | mov eax,4 |
980 | mov eax,4 |
954 | mov ebx,73*65536+42 |
981 | mov ebx,73*65536+42 |
955 | xor ecx,ecx |
982 | xor ecx,ecx |
956 | mov edx,vflag |
983 | mov edx,vflag |
957 | mov esi,1 |
984 | mov esi,1 |
958 | cmp dword [bgrmode],1 |
985 | cmp dword [bgrmode],1 |
959 | je nodownflag |
986 | je nodownflag |
960 | add ebx,15 |
987 | add ebx,15 |
961 | nodownflag: |
988 | nodownflag: |
962 | int 0x40 |
989 | int 0x40 |
963 | ret |
990 | ret |
964 | 991 | ||
965 | 992 | ||
966 | ; DATA AREA |
993 | ; DATA AREA |
967 | vflag: db 'x' |
994 | vflag: db 'x' |
968 | bgrmode: dd 1 |
995 | bgrmode: dd 1 |
- | 996 | ||
- | 997 | wnd_width dd 210 |
|
- | 998 | wnd_height dd 53 |
|
969 | 999 | ||
970 | lsz labelt3,\ |
1000 | lsz labelt3,\ |
971 | en, 'Background set',\ |
1001 | en, 'Background set',\ |
972 | ru, "áâ ®¢ª ä® " |
1002 | ru, "áâ ®¢ª ä® " |
973 | 1003 | ||
974 | lsz bgrdtext,\ |
1004 | lsz bgrdtext,\ |
975 | en, 'SET AS BACKGROUND:',\ |
1005 | en, 'SET AS BACKGROUND:',\ |
976 | ru, '¨¯ ®¡®¥¢:' |
1006 | ru, '¨¯ ®¡®¥¢:' |
977 | 1007 | ||
978 | lsz tiled,\ |
1008 | lsz tiled,\ |
979 | en, 'TILED',\ |
1009 | en, 'TILED',\ |
980 | ru, '§ ¬®áâ¨âì' |
1010 | ru, '§ ¬®áâ¨âì' |
981 | 1011 | ||
982 | lsz stretch,\ |
1012 | lsz stretch,\ |
983 | en, 'STRETCH',\ |
1013 | en, 'STRETCH',\ |
984 | ru, 'à áâïãâì' |
1014 | ru, 'à áâïãâì' |
985 | 1015 | ||
986 | lsz ok_btn,\ |
1016 | lsz ok_btn,\ |
987 | en, 'Ok',\ |
1017 | en, 'Ok',\ |
988 | ru, 'Ok' |
1018 | ru, 'Ok' |
989 | 1019 | ||
990 | 1020 | ||
991 | 1021 | ||
992 | IM_END: |
1022 | IM_END: |
- | 1023 | process_info: |
|
993 | temp_area: |
1024 | temp_area: |
994 | rb 0x10000 |
1025 | rb 0x10000 |
995 | I_END: |
1026 | I_END:0>0> |
996 | process_info:0>0> |
- |