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