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