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 | ; IMGVIEW.ASM |
2 | ; |
||
3 | ; This program displays jpeg images. The window can be resized. |
||
4 | ; |
||
5 | ; Version 0.0 END OF 2003 |
||
6 | ; Octavio Vega |
||
7 | ; Version 0.1 7th March 2004 |
||
8 | ; Mike Hibbett ( very small part! ) |
||
9 | ; Version 0.11 7th April 2004 |
||
10 | ; Ville Turjanmaa ( 'set_as_bgr' function ) |
||
11 | ; Version 0.12 29th May 2004 |
||
12 | ; Ivan Poddubny (correct "set_as_bgr"+parameters+boot+...) |
||
13 | ; Version 0.12 30 de mayo 2004 |
||
14 | ; Octavio Vega |
||
15 | ; bugs correction and slideshow |
||
16 | ; version 0.13 3 de junio 2004 |
||
17 | ; Octavio Vega |
||
18 | ; unos retoques |
||
19 | ; version 0.14 10th August 2004 |
||
20 | ; Mike Hibbett Added setting default colours |
||
135 | diamond | 21 | ; version 0.15 24th August 2006 |
22 | ; diamond (rewritten to function 70) |
||
526 | diamond | 23 | ; version 0.16 19th May 2007 |
24 | ; Mario79 |
||
25 | ; 1) correction for changed function 15, |
||
26 | ; 2) use monochrome background if free memory there are less than 2 MB |
||
27 | ; 3) use COL0 - COL9 boot parameter |
||
28 | ; 0=black,1=white,2=green,3=lilas,4=grey |
||
29 | ; 5=light-blue,6=blue,7=salad,8=pink,9=yellow |
||
30 | |||
31 | halyavin | 31 | memsize=20000h |
32 | org 0 |
||
33 | PARAMS = memsize - 1024 |
||
34 | |||
180 | heavyiron | 35 | appname equ 'Jpegview ' |
532 | diamond | 36 | version equ '0.16' |
180 | heavyiron | 37 | |
31 | halyavin | 38 | use32 |
39 | |||
40 | db 'MENUET01' ; 8 byte id |
||
41 | dd 0x01 ; header version |
||
42 | dd START ; start of code |
||
43 | dd I_END ; size of image |
||
44 | dd memsize ; memory for app |
||
45 | dd memsize - 1024 ; esp |
||
46 | dd PARAMS , 0x0 ; I_Param , I_Icon |
||
47 | |||
48 | stack_size=4096 + 1024 |
||
49 | |||
485 | heavyiron | 50 | include '..\..\..\macros.inc' |
31 | halyavin | 51 | |
52 | START: ; start of execution |
||
53 | |||
54 | cmp [PARAMS], byte 0 |
||
55 | jne check_parameters |
||
56 | |||
57 | ; Calculate the 'free' memory available |
||
58 | ; to the application, and create the malloc block from it |
||
59 | .l1: |
||
60 | mov ecx,memsize-fin-stack_size |
||
61 | mov edi,fin |
||
62 | call add_mem |
||
63 | |||
64 | call colorprecalc ;inicializa tablas usadas para pasar de ybr a bgr |
||
65 | call draw_window |
||
66 | call read_string.rs_done |
||
67 | |||
68 | still: |
||
69 | push still |
||
70 | mov ebx,100 ;1 second |
||
71 | mov eax,23 ; wait here for event |
||
485 | heavyiron | 72 | mcall |
31 | halyavin | 73 | cmp eax,1 ; redraw request ? |
74 | je draw_window |
||
75 | cmp eax,2 ; key in buffer ? |
||
76 | je read_string |
||
77 | cmp eax,3 ; button in buffer ? |
||
78 | je button |
||
79 | jmp display_next |
||
80 | |||
81 | button: ; BUTTON |
||
82 | mov eax,17 |
||
485 | heavyiron | 83 | mcall |
31 | halyavin | 84 | cmp ah,3 |
85 | je set_as_bgr2 |
||
86 | cmp ah,2 |
||
87 | je slideshow |
||
88 | cmp ah,1 ; CLOSE PROGRAM |
||
89 | jne close_program.exit |
||
90 | close_program: |
||
91 | mov eax,-1 |
||
485 | heavyiron | 92 | mcall |
31 | halyavin | 93 | .exit: |
94 | ret |
||
95 | |||
96 | ; Put a 'chunk' of the image on the window |
||
97 | put_image: |
||
98 | pushad |
||
99 | |||
100 | lea ebp,[edx+eax+7] |
||
101 | cmp [winxs],bp |
||
102 | jc .l1 |
||
103 | lea ebp,[ecx+ebx+20+2+17] |
||
104 | cmp [winys],bp |
||
105 | jc .l1 |
||
106 | |||
195 | heavyiron | 107 | add eax,2 ; offset for boarder |
108 | add ebx,2 ; offset for title bar |
||
31 | halyavin | 109 | push ax ; pox |
110 | push bx ; pos |
||
111 | push cx ; size |
||
112 | push dx ; size |
||
113 | pop ecx |
||
114 | pop edx |
||
115 | mov ebx,edi |
||
116 | mov eax,7 |
||
117 | |||
485 | heavyiron | 118 | mcall ; Put image function |
31 | halyavin | 119 | .l1: |
120 | popad |
||
121 | ret |
||
122 | |||
123 | |||
124 | |||
125 | ;****************************************************************************** |
||
126 | |||
127 | check_parameters: |
||
128 | cmp [PARAMS], dword "BOOT" ; received BOOT parameter -> goto handler |
||
129 | je boot_set_background |
||
526 | diamond | 130 | cmp [PARAMS], word "CO" |
131 | jne @f |
||
132 | cmp [PARAMS+2], byte "L" |
||
133 | je boot_set_background |
||
134 | @@: |
||
532 | diamond | 135 | cmp byte [PARAMS], 1 |
136 | jz ipc_service |
||
31 | halyavin | 137 | mov edi, name_string ; clear string with file name |
138 | mov al, 0 |
||
139 | mov ecx, 100 |
||
140 | rep stosb |
||
141 | |||
142 | mov ecx, 100 ; calculate length of parameter string |
||
143 | mov edi, PARAMS |
||
144 | repne scasb |
||
145 | sub edi, PARAMS |
||
146 | mov ecx, edi |
||
147 | |||
148 | mov esi, PARAMS ; copy parameters to file name |
||
149 | mov edi, name_string |
||
150 | cld |
||
151 | rep movsb |
||
152 | |||
153 | jmp START.l1 ; return to beggining of the progra |
||
154 | |||
155 | ;****************************************************************************** |
||
156 | boot_set_background: |
||
526 | diamond | 157 | mcall 18,16 |
158 | cmp eax,1024*2 |
||
159 | jb set_mono |
||
31 | halyavin | 160 | mov ecx,memsize-fin-stack_size ; size |
161 | mov edi,fin ; pointer |
||
162 | call add_mem ; mark memory from fin to 0x100000-1024 as free |
||
163 | call colorprecalc ; calculate colors |
||
164 | mov esi,name_string |
||
165 | call open |
||
166 | test eax,eax |
||
167 | jz close_program |
||
168 | call jpeg_info |
||
169 | mov dword [jpeg_st],ebp |
||
170 | call set_as_bgr2 ; set wallpaper |
||
171 | jmp close_program ; close the program right now |
||
172 | |||
173 | ;****************************************************************************** |
||
526 | diamond | 174 | set_mono: |
175 | mov eax, 15 |
||
176 | mov ebx, 1 |
||
177 | mov ecx, 1 |
||
178 | mov edx, 1 |
||
179 | mcall |
||
180 | |||
181 | cmp [PARAMS], dword "BOOT" ; received BOOT parameter -> goto handler |
||
182 | jne @f |
||
183 | .green: |
||
184 | mov ecx,mono+6 |
||
185 | jmp .set |
||
186 | @@: |
||
187 | ; cmp [PARAMS], word "CO" ; received BOOT parameter -> goto handler |
||
188 | ; jne .green |
||
189 | xor ecx,ecx |
||
190 | mov cl,[PARAMS+3] |
||
191 | sub cl,0x30 |
||
192 | cmp ecx,0 |
||
193 | jb .green |
||
194 | cmp ecx,9 |
||
195 | ja .green |
||
196 | imul ecx,3 |
||
197 | add ecx,mono |
||
198 | .set: |
||
199 | mcall 15,5, ,0,3 |
||
200 | |||
201 | ; Stretch the image to fit |
||
202 | mov eax, 15 |
||
203 | mov ebx, 4 |
||
204 | mov ecx, 1 |
||
205 | mcall |
||
206 | |||
207 | mov eax, 15 |
||
208 | mov ebx, 3 |
||
209 | mcall |
||
210 | jmp close_program |
||
211 | |||
212 | mono: |
||
213 | db 0,0,0 ; black |
||
214 | db 255,255,255 ; white |
||
215 | db 128,128,0 ; green |
||
216 | db 240,202,166 ; lilas |
||
217 | db 192,192,192 ; grey |
||
218 | db 255,255,0 ; light-blue |
||
219 | db 255,0,0 ; blue |
||
220 | db 192,220,192 ; salad |
||
221 | db 255,0,255 ; pink |
||
222 | db 0,255,255 ; yellow |
||
31 | halyavin | 223 | ;****************************************************************************** |
224 | |||
225 | set_as_bgr2: |
||
226 | mov ebp,dword[jpeg_st] |
||
227 | test ebp,ebp |
||
228 | jz .end |
||
470 | serge | 229 | |
31 | halyavin | 230 | mov eax, 15 |
231 | mov ebx, 1 |
||
232 | mov ecx, [ebp + x_size] |
||
233 | mov edx, [ebp + y_size] |
||
485 | heavyiron | 234 | mcall |
31 | halyavin | 235 | |
470 | serge | 236 | mov dword [ebp+draw_ptr],put_chunk_to_bgr |
237 | call jpeg_display |
||
238 | |||
31 | halyavin | 239 | ; Stretch the image to fit |
240 | mov eax, 15 |
||
241 | mov ebx, 4 |
||
242 | mov ecx, 2 |
||
485 | heavyiron | 243 | mcall |
31 | halyavin | 244 | |
245 | mov eax, 15 |
||
246 | mov ebx, 3 |
||
485 | heavyiron | 247 | mcall |
31 | halyavin | 248 | |
249 | |||
250 | .end: |
||
251 | ret |
||
252 | |||
253 | ;****************************************************************************** |
||
254 | |||
532 | diamond | 255 | ipc_service: |
256 | mcall 68, 11 |
||
257 | mov esi, PARAMS+1 |
||
258 | xor eax, eax |
||
259 | xor ecx, ecx |
||
260 | @@: |
||
261 | lodsb |
||
262 | test al, al |
||
263 | jz @f |
||
264 | lea ecx, [ecx*5] |
||
265 | lea ecx, [ecx*2+eax-'0'] |
||
266 | jmp @b |
||
267 | @@: |
||
268 | add ecx, 16 |
||
269 | mov edx, ecx |
||
270 | mcall 68, 12 |
||
271 | test eax, eax |
||
272 | jnz @f |
||
273 | .exit: |
||
274 | mcall -1 |
||
275 | @@: |
||
276 | mov ecx, eax |
||
277 | and dword [ecx], 0 |
||
278 | mov dword [ecx+4], 8 |
||
279 | mov [ipc_mem], ecx |
||
280 | mcall 60, 1 |
||
281 | mcall 40, 1 shl 6 |
||
282 | mcall 23, 500 ; wait up to 5 seconds for IPC message |
||
283 | test eax, eax |
||
284 | jz .exit |
||
285 | ; we got message with JPEG data, now decode it |
||
286 | mov eax, [ecx+12] |
||
287 | mov [ipc_mem_size], eax |
||
288 | ; init JPEG decoder |
||
289 | mov ecx,memsize-fin-stack_size ; size |
||
290 | mov edi,fin ; pointer |
||
291 | call add_mem ; mark memory from fin to 0x100000-1024 as free |
||
292 | call colorprecalc ; calculate colors |
||
293 | ; hook file functions |
||
294 | mov ecx, 4 |
||
295 | call malloc |
||
296 | and dword [edi], 0 |
||
297 | lea eax, [edi-file_handler.position] |
||
298 | mov byte [read], 0xE9 |
||
299 | mov dword [read+1], read_from_mem - (read+5) |
||
300 | ; decode |
||
301 | call jpeg_info |
||
302 | mov dword [jpeg_st],ebp |
||
303 | test ebp,ebp |
||
304 | jz .end |
||
305 | |||
306 | mov eax, [ebp + x_size] |
||
307 | mul dword [ebp + y_size] |
||
308 | lea eax, [eax*3+8] |
||
309 | mov ecx, eax |
||
310 | mcall 68, 12 |
||
311 | test eax, eax |
||
312 | jz .end |
||
313 | mov [ipc_mem_out], eax |
||
314 | mov ebx, [ebp + x_size] |
||
315 | mov [eax], ebx |
||
316 | mov ebx, [ebp + y_size] |
||
317 | mov [eax+4], ebx |
||
318 | |||
319 | mov dword [ebp+draw_ptr],put_chunk_to_mem |
||
320 | call jpeg_display |
||
321 | |||
322 | ; IPC response |
||
323 | mov esi, [ebp + x_size] |
||
324 | imul esi, [ebp + y_size] |
||
325 | lea esi, [esi*3+8] |
||
326 | mov edx, [ipc_mem_out] |
||
327 | .response: |
||
328 | mov ecx, [ipc_mem] |
||
329 | mov ecx, [ecx+8] |
||
330 | mcall 60,2 |
||
331 | |||
332 | jmp close_program ; close the program right now |
||
333 | |||
334 | .end: |
||
335 | mov esi, 8 |
||
336 | mov edx, x_pointer ; points to 2 null dwords |
||
337 | jmp .response |
||
338 | |||
339 | read_from_mem: |
||
340 | ; in: eax=handle, ecx=size, edi=pointer to buffer |
||
341 | ; out: ecx=number of read bytes, buffer filled |
||
342 | pushad |
||
343 | mov esi, [ipc_mem] |
||
344 | add esi, 16 |
||
345 | add esi, [eax+file_handler.position] |
||
346 | add ecx, [eax+file_handler.position] |
||
347 | cmp ecx, [ipc_mem_size] |
||
348 | jb @f |
||
349 | mov ecx, [ipc_mem_size] |
||
350 | @@: |
||
351 | sub ecx, [eax+file_handler.position] |
||
352 | add [eax+file_handler.position], ecx |
||
353 | rep movsb |
||
354 | popad |
||
355 | ret |
||
356 | |||
357 | ;****************************************************************************** |
||
358 | |||
31 | halyavin | 359 | put_chunk_to_bgr: |
360 | pushad |
||
361 | |||
362 | mov [x_pointer], edi |
||
363 | mov esi, ecx |
||
364 | imul esi, 3 |
||
365 | mov [x_numofbytes], esi |
||
366 | mov ecx, [ebp + x_size] |
||
367 | imul ecx, ebx |
||
368 | add ecx, eax |
||
369 | imul ecx, 3 |
||
370 | mov [x_offset], ecx |
||
371 | mov [x_counter], edx |
||
372 | mov eax, [ebp + x_size] |
||
373 | imul eax, 3 |
||
374 | mov [x_numofb2], eax |
||
375 | .new_string: |
||
376 | mov eax, 15 |
||
377 | mov ebx, 5 |
||
378 | mov ecx, [x_pointer] |
||
379 | mov edx, [x_offset] |
||
380 | mov esi, [x_numofbytes] |
||
485 | heavyiron | 381 | mcall |
31 | halyavin | 382 | mov eax, [x_numofbytes] |
383 | add [x_pointer], eax |
||
384 | mov eax, [x_numofb2] |
||
385 | add [x_offset], eax |
||
386 | dec [x_counter] |
||
387 | jnz .new_string |
||
388 | |||
389 | popad |
||
390 | ret |
||
391 | |||
392 | ;****************************************************************************** |
||
393 | |||
532 | diamond | 394 | put_chunk_to_mem: |
395 | ; in: (eax,ebx) = start coordinates of chunk |
||
396 | ; (ecx,edx) = sizes of chunk |
||
397 | ; edi -> chunk data |
||
398 | push esi edi edx |
||
399 | mov esi, edi |
||
400 | mov edi, ebx |
||
401 | imul edi, [ebp + x_size] |
||
402 | add edi, eax |
||
403 | lea edi, [edi*3+8] |
||
404 | add edi, [ipc_mem_out] |
||
405 | @@: |
||
406 | push ecx edi |
||
407 | lea ecx, [ecx*3] |
||
408 | rep movsb |
||
409 | pop edi ecx |
||
410 | add edi, [ebp + x_size] |
||
411 | add edi, [ebp + x_size] |
||
412 | add edi, [ebp + x_size] |
||
413 | dec edx |
||
414 | jnz @b |
||
415 | pop edx edi esi |
||
416 | ret |
||
31 | halyavin | 417 | |
532 | diamond | 418 | ;****************************************************************************** |
31 | halyavin | 419 | |
532 | diamond | 420 | |
421 | |||
31 | halyavin | 422 | ; ********************************************* |
423 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
424 | ; ********************************************* |
||
425 | |||
426 | |||
427 | draw_window: |
||
428 | |||
195 | heavyiron | 429 | mov eax,48 |
430 | mov ebx,3 |
||
431 | mov ecx,sc |
||
432 | mov edx,sizeof.system_colors |
||
485 | heavyiron | 433 | mcall |
195 | heavyiron | 434 | |
31 | halyavin | 435 | mov eax,12 |
436 | mov ebx,1 |
||
485 | heavyiron | 437 | mcall |
31 | halyavin | 438 | |
439 | ; Draw the window to the appropriate size - it may have |
||
440 | ; been resized by the user |
||
135 | diamond | 441 | cmp [winxs], 0 |
31 | halyavin | 442 | jne dw_001 |
443 | |||
444 | ; Give the screen some inital defaults |
||
135 | diamond | 445 | mov [winxs], 400 |
446 | mov [winys], 300 |
||
31 | halyavin | 447 | mov ax, 100 |
448 | mov [winxo], ax |
||
449 | mov [winyo], ax |
||
450 | jmp dw_002 |
||
451 | |||
452 | dw_001: |
||
453 | mov eax, 9 |
||
454 | mov ebx, memsize - 1024 |
||
455 | mov ecx, -1 |
||
485 | heavyiron | 456 | mcall |
31 | halyavin | 457 | mov eax, [ebx + 34] |
458 | mov [winxo], ax |
||
459 | mov eax, [ebx + 38] |
||
460 | mov [winyo], ax |
||
461 | mov eax, [ebx + 42] |
||
462 | mov [winxs], ax |
||
463 | mov eax, [ebx + 46] |
||
464 | mov [winys], ax |
||
465 | |||
466 | dw_002: |
||
135 | diamond | 467 | mov ebx, dword [winxo-2] |
468 | mov bx, [winxs] |
||
469 | mov ecx, dword [winyo-2] |
||
470 | mov cx, [winys] |
||
31 | halyavin | 471 | |
135 | diamond | 472 | xor eax,eax ; DRAW WINDOW |
195 | heavyiron | 473 | mov edx,[sc.work] |
474 | or edx,0x33000000 |
||
485 | heavyiron | 475 | mov edi,title ; WINDOW LABEL |
476 | mcall |
||
31 | halyavin | 477 | |
478 | |||
195 | heavyiron | 479 | mov eax,8 ; BUTTON 2: slideshow |
480 | mov ebx,57 |
||
31 | halyavin | 481 | mov cx, [winys] |
195 | heavyiron | 482 | sub cx, 39 |
31 | halyavin | 483 | shl ecx, 16 |
484 | add ecx, 12 |
||
195 | heavyiron | 485 | mov esi, [sc.work_button] |
31 | halyavin | 486 | mov edx,2 |
485 | heavyiron | 487 | mcall |
31 | halyavin | 488 | |
489 | mov eax,4 ; Button text |
||
490 | movzx ebx, word [winys] |
||
195 | heavyiron | 491 | add ebx, 3 shl 16 - 36 |
492 | mov ecx,[sc.work_button_text] |
||
31 | halyavin | 493 | mov edx,setname |
494 | mov esi,setnamelen-setname |
||
485 | heavyiron | 495 | mcall |
31 | halyavin | 496 | |
497 | |||
498 | mov eax,8 ; BUTTON 3: set as background |
||
499 | mov bx, [winxs] |
||
195 | heavyiron | 500 | sub bx, 65 |
31 | halyavin | 501 | shl ebx, 16 |
502 | mov bx,55 |
||
503 | mov cx, [winys] |
||
195 | heavyiron | 504 | sub cx, 39 |
31 | halyavin | 505 | shl ecx, 16 |
506 | add ecx, 12 |
||
195 | heavyiron | 507 | mov esi, [sc.work_button] |
31 | halyavin | 508 | mov edx,3 |
485 | heavyiron | 509 | mcall |
31 | halyavin | 510 | |
511 | mov eax,4 ; Button text |
||
512 | movzx ebx, word [winxs] |
||
195 | heavyiron | 513 | sub ebx, 63 |
31 | halyavin | 514 | shl ebx,16 |
515 | mov bx, word [winys] |
||
195 | heavyiron | 516 | sub bx,36 |
517 | mov ecx,[sc.work_button_text] |
||
31 | halyavin | 518 | mov edx,setbgr |
519 | mov esi,setbgrlen-setbgr |
||
485 | heavyiron | 520 | mcall |
31 | halyavin | 521 | call print_strings |
522 | call load_image |
||
523 | mov eax,12 ; function 12:tell os about windowdraw |
||
524 | mov ebx,2 ; 2, end of draw |
||
485 | heavyiron | 525 | mcall |
31 | halyavin | 526 | |
527 | ret |
||
528 | |||
529 | |||
530 | |||
531 | ; Read in the image file name. |
||
532 | read_string: |
||
533 | movzx edi,byte[name_string.cursor] |
||
534 | add edi,name_string |
||
535 | mov eax,2 |
||
485 | heavyiron | 536 | mcall ; Get the key value |
31 | halyavin | 537 | shr eax,8 |
538 | cmp eax,13 ; Return key ends input |
||
539 | je .rs_done |
||
540 | cmp eax,8 |
||
541 | jnz .nobsl |
||
542 | cmp edi,name_string |
||
543 | je .exit |
||
544 | dec edi |
||
545 | mov [edi],byte 0;'_' |
||
546 | dec byte[name_string.cursor] |
||
547 | jmp print_strings |
||
548 | .exit: ret |
||
549 | .nobsl: |
||
550 | cmp eax,31 |
||
551 | jbe .exit |
||
552 | cmp eax,97 |
||
553 | jb .keyok |
||
554 | sub eax,32 |
||
555 | .keyok: |
||
556 | mov ah,0 |
||
557 | stosw |
||
558 | cmp edi,name_string.end |
||
559 | jnc print_strings |
||
560 | inc byte[name_string.cursor] |
||
561 | jmp print_strings |
||
562 | .rs_done: |
||
563 | call print_strings |
||
564 | mov esi,name_string |
||
565 | call open |
||
566 | test eax,eax |
||
567 | jz .exit |
||
568 | call jpeg_info |
||
569 | test ebp,ebp |
||
570 | jz close |
||
571 | xchg [jpeg_st],ebp |
||
572 | call jpeg_close |
||
573 | |||
574 | load_image: |
||
575 | |||
576 | mov eax,13 ; clear picture area |
||
577 | movzx ebx, word [winxs] |
||
195 | heavyiron | 578 | add ebx, 1 shl 16 -10 |
31 | halyavin | 579 | movzx ecx, word [winys] |
195 | heavyiron | 580 | sub ecx, 40 |
581 | add ecx, 1 shl 16 |
||
31 | halyavin | 582 | |
195 | heavyiron | 583 | mov edx,[sc.work] |
485 | heavyiron | 584 | mcall |
31 | halyavin | 585 | mov ebp,[jpeg_st] |
586 | test ebp,ebp |
||
587 | jz .exit |
||
588 | mov dword [ebp+draw_ptr],put_image |
||
589 | jmp jpeg_display |
||
590 | .exit: ret |
||
591 | |||
592 | print_strings: |
||
593 | pusha |
||
594 | mov eax,13 ; clear text area |
||
595 | movzx ebx, word [winxs] |
||
195 | heavyiron | 596 | add ebx, 59 shl 16 -125 |
31 | halyavin | 597 | mov cx, [winys] |
195 | heavyiron | 598 | sub cx, 39 |
31 | halyavin | 599 | shl ecx, 16 |
600 | add ecx, 12 |
||
601 | mov edx,0xffffff |
||
485 | heavyiron | 602 | mcall |
31 | halyavin | 603 | |
604 | mov eax,4 ; |
||
605 | movzx ebx, word [winys] |
||
195 | heavyiron | 606 | add ebx, 61 shl 16 - 37 |
31 | halyavin | 607 | mov ecx,0x000000 |
608 | mov edx,name_string |
||
609 | mov esi,60 |
||
485 | heavyiron | 610 | mcall |
31 | halyavin | 611 | popa |
612 | ret |
||
613 | |||
614 | slideshow: |
||
135 | diamond | 615 | cmp [file_dir], 0 |
616 | jnz .exit |
||
617 | cmp [jpeg_st], 0 |
||
618 | jz .exit |
||
619 | mov esi, name_string |
||
620 | movzx ecx, byte [name_string.cursor] |
||
621 | .l1: |
||
622 | cmp byte [esi+ecx], '/' |
||
623 | jz .l2 |
||
624 | loop .l1 |
||
625 | .exit: |
||
626 | ret |
||
627 | .l2: |
||
628 | mov byte [esi+ecx], 0 |
||
629 | call open |
||
630 | mov byte [esi+ecx], '/' |
||
631 | test eax, eax |
||
632 | jz .exit |
||
633 | test byte [fileattr], 0x10 |
||
634 | jz .exit |
||
635 | mov [file_dir], eax |
||
636 | inc ecx |
||
637 | mov [name_string.cursor], cl |
||
31 | halyavin | 638 | display_next: |
135 | diamond | 639 | mov ebx, [file_dir] |
640 | test ebx, ebx |
||
641 | jnz @f |
||
642 | ret |
||
643 | @@: |
||
644 | mov byte [ebx], 1 |
||
645 | mov byte [ebx+12], 1 |
||
646 | mov dword [ebx+16], dirinfo |
||
647 | mov eax, 70 |
||
485 | heavyiron | 648 | mcall |
135 | diamond | 649 | mov eax, [file_dir] |
650 | inc dword [eax+4] |
||
651 | cmp ebx, 1 |
||
652 | jz @f |
||
653 | mov eax, [file_dir] |
||
654 | and [file_dir], 0 |
||
655 | jmp close |
||
656 | @@: |
||
657 | movzx edi, byte [name_string.cursor] |
||
658 | add edi, name_string |
||
659 | lea esi, [dirinfo+32+40] |
||
660 | @@: |
||
661 | lodsb |
||
662 | stosb |
||
663 | test al, al |
||
664 | jnz @b |
||
665 | mov ecx, name_string.end |
||
666 | sub ecx, edi |
||
667 | rep stosb |
||
31 | halyavin | 668 | call print_strings |
669 | mov esi,name_string |
||
670 | call open |
||
671 | test eax,eax |
||
672 | jz display_next |
||
673 | call jpeg_info |
||
674 | test ebp,ebp |
||
675 | jnz .l6 |
||
676 | call close |
||
677 | jmp display_next |
||
678 | .l6: |
||
679 | mov dword[ebp+draw_ptr],put_image |
||
680 | push ebp |
||
681 | xchg [jpeg_st],ebp |
||
682 | call jpeg_close |
||
683 | pop ebp |
||
684 | jmp jpeg_display |
||
685 | |||
686 | |||
687 | include 'filelib.asm' |
||
688 | include 'memlib.asm' |
||
689 | include 'jpeglib.asm' |
||
690 | |||
691 | |||
692 | ; DATA AREA |
||
693 | |||
694 | wcolor dd 0x000000 |
||
485 | heavyiron | 695 | title db appname,version,0 |
31 | halyavin | 696 | setname db 'SLIDESHOW' |
697 | setnamelen: |
||
698 | |||
699 | setbgr db ' BGR ' |
||
700 | setbgrlen: |
||
701 | |||
702 | x_pointer dd 0 |
||
703 | x_offset dd 0 |
||
704 | x_numofbytes dd 0 |
||
705 | x_numofb2 dd 0 |
||
706 | x_counter dd 0 |
||
135 | diamond | 707 | winxo dw 0 |
708 | winyo dw 0 |
||
709 | winxs dw 0 |
||
710 | winys dw 0 |
||
711 | jpeg_st dd 0 |
||
712 | file_dir dd 0 |
||
529 | spraid | 713 | name_string: db '/sys/jpegview.jpg',0 |
135 | diamond | 714 | rb 256 |
31 | halyavin | 715 | .end: |
716 | .cursor: db 19 |
||
717 | .cursor2: db 0 |
||
718 | |||
719 | align 4 |
||
720 | |||
721 | rgb16: db 0,4,8,13,17,21,25,29,34,38,42,46,50,55,59,63 |
||
722 | rgb4: db 0,21,42,63 |
||
723 | |||
724 | include 'jpegdat.asm' |
||
725 | |||
726 | align 4 |
||
727 | |||
728 | iniciomemoria: |
||
729 | dd -(iniciomemoria+4),-(iniciomemoria+4),(iniciomemoria+4),.l1,0 |
||
730 | .l1 dd 0 |
||
731 | |||
732 | I_END: |
||
195 | heavyiron | 733 | sc system_colors |
532 | diamond | 734 | ipc_mem dd ? |
735 | ipc_mem_size dd ? |
||
736 | ipc_mem_out dd ? |
||
135 | diamond | 737 | fileattr: rb 40 |
738 | dirinfo: rb 32+304 |
||
532 | diamond | 739 | fin: |