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