Rev 180 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 180 | Rev 195 | ||
---|---|---|---|
1 | ; IMGVIEW.ASM |
1 | ; IMGVIEW.ASM |
2 | ; |
2 | ; |
3 | ; This program displays jpeg images. The window can be resized. |
3 | ; This program displays jpeg images. The window can be resized. |
4 | ; |
4 | ; |
5 | ; Version 0.0 END OF 2003 |
5 | ; Version 0.0 END OF 2003 |
6 | ; Octavio Vega |
6 | ; Octavio Vega |
7 | ; Version 0.1 7th March 2004 |
7 | ; Version 0.1 7th March 2004 |
8 | ; Mike Hibbett ( very small part! ) |
8 | ; Mike Hibbett ( very small part! ) |
9 | ; Version 0.11 7th April 2004 |
9 | ; Version 0.11 7th April 2004 |
10 | ; Ville Turjanmaa ( 'set_as_bgr' function ) |
10 | ; Ville Turjanmaa ( 'set_as_bgr' function ) |
11 | ; Version 0.12 29th May 2004 |
11 | ; Version 0.12 29th May 2004 |
12 | ; Ivan Poddubny (correct "set_as_bgr"+parameters+boot+...) |
12 | ; Ivan Poddubny (correct "set_as_bgr"+parameters+boot+...) |
13 | ; Version 0.12 30 de mayo 2004 |
13 | ; Version 0.12 30 de mayo 2004 |
14 | ; Octavio Vega |
14 | ; Octavio Vega |
15 | ; bugs correction and slideshow |
15 | ; bugs correction and slideshow |
16 | ; version 0.13 3 de junio 2004 |
16 | ; version 0.13 3 de junio 2004 |
17 | ; Octavio Vega |
17 | ; Octavio Vega |
18 | ; unos retoques |
18 | ; unos retoques |
19 | ; version 0.14 10th August 2004 |
19 | ; version 0.14 10th August 2004 |
20 | ; Mike Hibbett Added setting default colours |
20 | ; Mike Hibbett Added setting default colours |
21 | ; version 0.15 24th August 2006 |
21 | ; version 0.15 24th August 2006 |
22 | ; diamond (rewritten to function 70) |
22 | ; diamond (rewritten to function 70) |
23 | ; |
23 | ; |
24 | 24 | ||
25 | memsize=20000h |
25 | memsize=20000h |
26 | org 0 |
26 | org 0 |
27 | PARAMS = memsize - 1024 |
27 | PARAMS = memsize - 1024 |
28 | 28 | ||
29 | appname equ 'Jpegview ' |
29 | appname equ 'Jpegview ' |
30 | version equ '0.15' |
30 | version equ '0.15' |
31 | 31 | ||
32 | use32 |
32 | use32 |
33 | 33 | ||
34 | db 'MENUET01' ; 8 byte id |
34 | db 'MENUET01' ; 8 byte id |
35 | dd 0x01 ; header version |
35 | dd 0x01 ; header version |
36 | dd START ; start of code |
36 | dd START ; start of code |
37 | dd I_END ; size of image |
37 | dd I_END ; size of image |
38 | dd memsize ; memory for app |
38 | dd memsize ; memory for app |
39 | dd memsize - 1024 ; esp |
39 | dd memsize - 1024 ; esp |
40 | dd PARAMS , 0x0 ; I_Param , I_Icon |
40 | dd PARAMS , 0x0 ; I_Param , I_Icon |
41 | 41 | ||
42 | stack_size=4096 + 1024 |
42 | stack_size=4096 + 1024 |
43 | 43 | ||
44 | include 'macros.inc' |
44 | include 'macros.inc' |
45 | 45 | ||
46 | START: ; start of execution |
46 | START: ; start of execution |
47 | 47 | ||
48 | cmp [PARAMS], byte 0 |
48 | cmp [PARAMS], byte 0 |
49 | jne check_parameters |
49 | jne check_parameters |
50 | 50 | ||
51 | ; Calculate the 'free' memory available |
51 | ; Calculate the 'free' memory available |
52 | ; to the application, and create the malloc block from it |
52 | ; to the application, and create the malloc block from it |
53 | .l1: |
53 | .l1: |
54 | mov ecx,memsize-fin-stack_size |
54 | mov ecx,memsize-fin-stack_size |
55 | mov edi,fin |
55 | mov edi,fin |
56 | call add_mem |
56 | call add_mem |
57 | 57 | ||
58 | call colorprecalc ;inicializa tablas usadas para pasar de ybr a bgr |
58 | call colorprecalc ;inicializa tablas usadas para pasar de ybr a bgr |
59 | call draw_window |
59 | call draw_window |
60 | call read_string.rs_done |
60 | call read_string.rs_done |
61 | 61 | ||
62 | still: |
62 | still: |
63 | push still |
63 | push still |
64 | mov ebx,100 ;1 second |
64 | mov ebx,100 ;1 second |
65 | mov eax,23 ; wait here for event |
65 | mov eax,23 ; wait here for event |
66 | int 0x40 |
66 | int 0x40 |
67 | cmp eax,1 ; redraw request ? |
67 | cmp eax,1 ; redraw request ? |
68 | je draw_window |
68 | je draw_window |
69 | cmp eax,2 ; key in buffer ? |
69 | cmp eax,2 ; key in buffer ? |
70 | je read_string |
70 | je read_string |
71 | cmp eax,3 ; button in buffer ? |
71 | cmp eax,3 ; button in buffer ? |
72 | je button |
72 | je button |
73 | jmp display_next |
73 | jmp display_next |
74 | 74 | ||
75 | button: ; BUTTON |
75 | button: ; BUTTON |
76 | mov eax,17 |
76 | mov eax,17 |
77 | int 0x40 |
77 | int 0x40 |
78 | cmp ah,3 |
78 | cmp ah,3 |
79 | je set_as_bgr2 |
79 | je set_as_bgr2 |
80 | cmp ah,2 |
80 | cmp ah,2 |
81 | je slideshow |
81 | je slideshow |
82 | cmp ah,1 ; CLOSE PROGRAM |
82 | cmp ah,1 ; CLOSE PROGRAM |
83 | jne close_program.exit |
83 | jne close_program.exit |
84 | close_program: |
84 | close_program: |
85 | mov eax,-1 |
85 | mov eax,-1 |
86 | int 0x40 |
86 | int 0x40 |
87 | .exit: |
87 | .exit: |
88 | ret |
88 | ret |
89 | 89 | ||
90 | ; Put a 'chunk' of the image on the window |
90 | ; Put a 'chunk' of the image on the window |
91 | put_image: |
91 | put_image: |
92 | pushad |
92 | pushad |
93 | 93 | ||
94 | lea ebp,[edx+eax+7] |
94 | lea ebp,[edx+eax+7] |
95 | cmp [winxs],bp |
95 | cmp [winxs],bp |
96 | jc .l1 |
96 | jc .l1 |
97 | lea ebp,[ecx+ebx+20+2+17] |
97 | lea ebp,[ecx+ebx+20+2+17] |
98 | cmp [winys],bp |
98 | cmp [winys],bp |
99 | jc .l1 |
99 | jc .l1 |
100 | 100 | ||
101 | add eax,5 ; offset for boarder |
101 | add eax,2 ; offset for boarder |
102 | add ebx,20 ; offset for title bar |
102 | add ebx,2 ; offset for title bar |
103 | push ax ; pox |
103 | push ax ; pox |
104 | push bx ; pos |
104 | push bx ; pos |
105 | push cx ; size |
105 | push cx ; size |
106 | push dx ; size |
106 | push dx ; size |
107 | pop ecx |
107 | pop ecx |
108 | pop edx |
108 | pop edx |
109 | mov ebx,edi |
109 | mov ebx,edi |
110 | mov eax,7 |
110 | mov eax,7 |
111 | 111 | ||
112 | int 40h ; Put image function |
112 | int 40h ; Put image function |
113 | .l1: |
113 | .l1: |
114 | popad |
114 | popad |
115 | ret |
115 | ret |
116 | 116 | ||
117 | 117 | ||
118 | 118 | ||
119 | ;****************************************************************************** |
119 | ;****************************************************************************** |
120 | 120 | ||
121 | check_parameters: |
121 | check_parameters: |
122 | cmp [PARAMS], dword "BOOT" ; received BOOT parameter -> goto handler |
122 | cmp [PARAMS], dword "BOOT" ; received BOOT parameter -> goto handler |
123 | je boot_set_background |
123 | je boot_set_background |
124 | 124 | ||
125 | mov edi, name_string ; clear string with file name |
125 | mov edi, name_string ; clear string with file name |
126 | mov al, 0 |
126 | mov al, 0 |
127 | mov ecx, 100 |
127 | mov ecx, 100 |
128 | rep stosb |
128 | rep stosb |
129 | 129 | ||
130 | mov ecx, 100 ; calculate length of parameter string |
130 | mov ecx, 100 ; calculate length of parameter string |
131 | mov edi, PARAMS |
131 | mov edi, PARAMS |
132 | repne scasb |
132 | repne scasb |
133 | sub edi, PARAMS |
133 | sub edi, PARAMS |
134 | mov ecx, edi |
134 | mov ecx, edi |
135 | 135 | ||
136 | mov esi, PARAMS ; copy parameters to file name |
136 | mov esi, PARAMS ; copy parameters to file name |
137 | mov edi, name_string |
137 | mov edi, name_string |
138 | cld |
138 | cld |
139 | rep movsb |
139 | rep movsb |
140 | 140 | ||
141 | jmp START.l1 ; return to beggining of the progra |
141 | jmp START.l1 ; return to beggining of the progra |
142 | 142 | ||
143 | ;****************************************************************************** |
143 | ;****************************************************************************** |
144 | 144 | ||
145 | 145 | ||
146 | 146 | ||
147 | boot_set_background: |
147 | boot_set_background: |
148 | 148 | ||
149 | mov ecx,memsize-fin-stack_size ; size |
149 | mov ecx,memsize-fin-stack_size ; size |
150 | mov edi,fin ; pointer |
150 | mov edi,fin ; pointer |
151 | call add_mem ; mark memory from fin to 0x100000-1024 as free |
151 | call add_mem ; mark memory from fin to 0x100000-1024 as free |
152 | call colorprecalc ; calculate colors |
152 | call colorprecalc ; calculate colors |
153 | mov esi,name_string |
153 | mov esi,name_string |
154 | call open |
154 | call open |
155 | test eax,eax |
155 | test eax,eax |
156 | jz close_program |
156 | jz close_program |
157 | call jpeg_info |
157 | call jpeg_info |
158 | mov dword [jpeg_st],ebp |
158 | mov dword [jpeg_st],ebp |
159 | call set_as_bgr2 ; set wallpaper |
159 | call set_as_bgr2 ; set wallpaper |
160 | jmp close_program ; close the program right now |
160 | jmp close_program ; close the program right now |
161 | 161 | ||
162 | ;****************************************************************************** |
162 | ;****************************************************************************** |
163 | ;****************************************************************************** |
163 | ;****************************************************************************** |
164 | 164 | ||
165 | set_as_bgr2: |
165 | set_as_bgr2: |
166 | mov ebp,dword[jpeg_st] |
166 | mov ebp,dword[jpeg_st] |
167 | test ebp,ebp |
167 | test ebp,ebp |
168 | jz .end |
168 | jz .end |
169 | 169 | ||
170 | mov dword [ebp+draw_ptr],put_chunk_to_bgr |
170 | mov dword [ebp+draw_ptr],put_chunk_to_bgr |
171 | call jpeg_display |
171 | call jpeg_display |
172 | mov eax, 15 |
172 | mov eax, 15 |
173 | mov ebx, 1 |
173 | mov ebx, 1 |
174 | mov ecx, [ebp + x_size] |
174 | mov ecx, [ebp + x_size] |
175 | mov edx, [ebp + y_size] |
175 | mov edx, [ebp + y_size] |
176 | int 0x40 |
176 | int 0x40 |
177 | 177 | ||
178 | ; Stretch the image to fit |
178 | ; Stretch the image to fit |
179 | mov eax, 15 |
179 | mov eax, 15 |
180 | mov ebx, 4 |
180 | mov ebx, 4 |
181 | mov ecx, 2 |
181 | mov ecx, 2 |
182 | int 0x40 |
182 | int 0x40 |
183 | 183 | ||
184 | mov eax, 15 |
184 | mov eax, 15 |
185 | mov ebx, 3 |
185 | mov ebx, 3 |
186 | int 0x40 |
186 | int 0x40 |
187 | 187 | ||
188 | 188 | ||
189 | .end: |
189 | .end: |
190 | ret |
190 | ret |
191 | 191 | ||
192 | ;****************************************************************************** |
192 | ;****************************************************************************** |
193 | 193 | ||
194 | put_chunk_to_bgr: |
194 | put_chunk_to_bgr: |
195 | pushad |
195 | pushad |
196 | 196 | ||
197 | mov [x_pointer], edi |
197 | mov [x_pointer], edi |
198 | mov esi, ecx |
198 | mov esi, ecx |
199 | imul esi, 3 |
199 | imul esi, 3 |
200 | mov [x_numofbytes], esi |
200 | mov [x_numofbytes], esi |
201 | mov ecx, [ebp + x_size] |
201 | mov ecx, [ebp + x_size] |
202 | imul ecx, ebx |
202 | imul ecx, ebx |
203 | add ecx, eax |
203 | add ecx, eax |
204 | imul ecx, 3 |
204 | imul ecx, 3 |
205 | mov [x_offset], ecx |
205 | mov [x_offset], ecx |
206 | mov [x_counter], edx |
206 | mov [x_counter], edx |
207 | mov eax, [ebp + x_size] |
207 | mov eax, [ebp + x_size] |
208 | imul eax, 3 |
208 | imul eax, 3 |
209 | mov [x_numofb2], eax |
209 | mov [x_numofb2], eax |
210 | .new_string: |
210 | .new_string: |
211 | mov eax, 15 |
211 | mov eax, 15 |
212 | mov ebx, 5 |
212 | mov ebx, 5 |
213 | mov ecx, [x_pointer] |
213 | mov ecx, [x_pointer] |
214 | mov edx, [x_offset] |
214 | mov edx, [x_offset] |
215 | mov esi, [x_numofbytes] |
215 | mov esi, [x_numofbytes] |
216 | int 0x40 |
216 | int 0x40 |
217 | mov eax, [x_numofbytes] |
217 | mov eax, [x_numofbytes] |
218 | add [x_pointer], eax |
218 | add [x_pointer], eax |
219 | mov eax, [x_numofb2] |
219 | mov eax, [x_numofb2] |
220 | add [x_offset], eax |
220 | add [x_offset], eax |
221 | dec [x_counter] |
221 | dec [x_counter] |
222 | jnz .new_string |
222 | jnz .new_string |
223 | 223 | ||
224 | popad |
224 | popad |
225 | ret |
225 | ret |
226 | 226 | ||
227 | ;****************************************************************************** |
227 | ;****************************************************************************** |
228 | 228 | ||
229 | 229 | ||
230 | 230 | ||
231 | ; ********************************************* |
231 | ; ********************************************* |
232 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
232 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
233 | ; ********************************************* |
233 | ; ********************************************* |
234 | 234 | ||
235 | 235 | ||
236 | draw_window: |
236 | draw_window: |
- | 237 | ||
- | 238 | mov eax,48 |
|
- | 239 | mov ebx,3 |
|
- | 240 | mov ecx,sc |
|
- | 241 | mov edx,sizeof.system_colors |
|
- | 242 | int 0x40 |
|
237 | 243 | ||
238 | mov eax,12 |
244 | mov eax,12 |
239 | mov ebx,1 |
245 | mov ebx,1 |
240 | int 0x40 |
246 | int 0x40 |
241 | 247 | ||
242 | ; Draw the window to the appropriate size - it may have |
248 | ; Draw the window to the appropriate size - it may have |
243 | ; been resized by the user |
249 | ; been resized by the user |
244 | cmp [winxs], 0 |
250 | cmp [winxs], 0 |
245 | jne dw_001 |
251 | jne dw_001 |
246 | 252 | ||
247 | ; Give the screen some inital defaults |
253 | ; Give the screen some inital defaults |
248 | mov [winxs], 400 |
254 | mov [winxs], 400 |
249 | mov [winys], 300 |
255 | mov [winys], 300 |
250 | mov ax, 100 |
256 | mov ax, 100 |
251 | mov [winxo], ax |
257 | mov [winxo], ax |
252 | mov [winyo], ax |
258 | mov [winyo], ax |
253 | jmp dw_002 |
259 | jmp dw_002 |
254 | 260 | ||
255 | dw_001: |
261 | dw_001: |
256 | mov eax, 9 |
262 | mov eax, 9 |
257 | mov ebx, memsize - 1024 |
263 | mov ebx, memsize - 1024 |
258 | mov ecx, -1 |
264 | mov ecx, -1 |
259 | int 0x40 |
265 | int 0x40 |
260 | mov eax, [ebx + 34] |
266 | mov eax, [ebx + 34] |
261 | mov [winxo], ax |
267 | mov [winxo], ax |
262 | mov eax, [ebx + 38] |
268 | mov eax, [ebx + 38] |
263 | mov [winyo], ax |
269 | mov [winyo], ax |
264 | mov eax, [ebx + 42] |
270 | mov eax, [ebx + 42] |
265 | mov [winxs], ax |
271 | mov [winxs], ax |
266 | mov eax, [ebx + 46] |
272 | mov eax, [ebx + 46] |
267 | mov [winys], ax |
273 | mov [winys], ax |
268 | 274 | ||
269 | dw_002: |
275 | dw_002: |
270 | mov ebx, dword [winxo-2] |
276 | mov ebx, dword [winxo-2] |
271 | mov bx, [winxs] |
277 | mov bx, [winxs] |
272 | mov ecx, dword [winyo-2] |
278 | mov ecx, dword [winyo-2] |
273 | mov cx, [winys] |
279 | mov cx, [winys] |
274 | 280 | ||
275 | xor eax,eax ; DRAW WINDOW |
281 | xor eax,eax ; DRAW WINDOW |
276 | mov edx,[wcolor] |
282 | mov edx,[sc.work] |
277 | add edx,0x13000000 |
283 | or edx,0x33000000 |
278 | mov edi,header ; WINDOW LABEL |
284 | mov edi,header ; WINDOW LABEL |
279 | int 0x40 |
285 | int 0x40 |
280 | 286 | ||
281 | - | ||
282 | ; draw status bar |
- | |
283 | mov eax, 13 |
287 | |
284 | movzx ebx, word [winxs] |
288 | mov eax,8 ; BUTTON 2: slideshow |
285 | sub ebx, 5 |
- | |
286 | add ebx, 4*65536 |
289 | mov ebx,57 |
287 | mov cx, [winys] |
- | |
288 | sub ecx, 19 |
- | |
289 | shl ecx, 16 |
- | |
290 | add ecx, 3 |
- | |
291 | mov edx, 0x00557799 |
- | |
292 | int 0x40 |
- | |
293 | - | ||
294 | mov eax,8 ; BUTTON 2: filename |
- | |
295 | mov ebx,4*65536+55 |
- | |
296 | mov cx, [winys] |
290 | mov cx, [winys] |
297 | sub cx, 16 |
291 | sub cx, 39 |
298 | shl ecx, 16 |
292 | shl ecx, 16 |
299 | add ecx, 12 |
293 | add ecx, 12 |
300 | mov esi, 0x00557799 |
294 | mov esi, [sc.work_button] |
301 | mov edx,2 |
295 | mov edx,2 |
302 | int 0x40 |
296 | int 0x40 |
303 | 297 | ||
304 | mov eax,4 ; Button text |
298 | mov eax,4 ; Button text |
305 | movzx ebx, word [winys] |
299 | movzx ebx, word [winys] |
306 | sub ebx, 13 |
- | |
307 | add ebx, 6*65536 |
300 | add ebx, 3 shl 16 - 36 |
308 | mov ecx,0x00ffffff |
301 | mov ecx,[sc.work_button_text] |
309 | mov edx,setname |
302 | mov edx,setname |
310 | mov esi,setnamelen-setname |
303 | mov esi,setnamelen-setname |
311 | int 0x40 |
304 | int 0x40 |
312 | 305 | ||
313 | 306 | ||
314 | mov eax,8 ; BUTTON 3: set as background |
307 | mov eax,8 ; BUTTON 3: set as background |
315 | mov bx, [winxs] |
308 | mov bx, [winxs] |
316 | sub bx, 60 |
309 | sub bx, 65 |
317 | shl ebx, 16 |
310 | shl ebx, 16 |
318 | mov bx,55 |
311 | mov bx,55 |
319 | mov cx, [winys] |
312 | mov cx, [winys] |
320 | sub cx, 16 |
313 | sub cx, 39 |
321 | shl ecx, 16 |
314 | shl ecx, 16 |
322 | add ecx, 12 |
315 | add ecx, 12 |
323 | mov esi, 0x00557799 |
316 | mov esi, [sc.work_button] |
324 | mov edx,3 |
317 | mov edx,3 |
325 | int 0x40 |
318 | int 0x40 |
326 | 319 | ||
327 | mov eax,4 ; Button text |
320 | mov eax,4 ; Button text |
328 | movzx ebx, word [winxs] |
321 | movzx ebx, word [winxs] |
329 | sub ebx, 60 |
322 | sub ebx, 63 |
330 | shl ebx,16 |
323 | shl ebx,16 |
331 | mov bx, word [winys] |
324 | mov bx, word [winys] |
332 | sub bx,13 |
325 | sub bx,36 |
333 | mov ecx,0x00ffffff |
326 | mov ecx,[sc.work_button_text] |
334 | mov edx,setbgr |
327 | mov edx,setbgr |
335 | mov esi,setbgrlen-setbgr |
328 | mov esi,setbgrlen-setbgr |
336 | int 0x40 |
329 | int 0x40 |
337 | call print_strings |
330 | call print_strings |
338 | call load_image |
331 | call load_image |
339 | mov eax,12 ; function 12:tell os about windowdraw |
332 | mov eax,12 ; function 12:tell os about windowdraw |
340 | mov ebx,2 ; 2, end of draw |
333 | mov ebx,2 ; 2, end of draw |
341 | int 0x40 |
334 | int 0x40 |
342 | 335 | ||
343 | ret |
336 | ret |
344 | 337 | ||
345 | 338 | ||
346 | 339 | ||
347 | ; Read in the image file name. |
340 | ; Read in the image file name. |
348 | read_string: |
341 | read_string: |
349 | movzx edi,byte[name_string.cursor] |
342 | movzx edi,byte[name_string.cursor] |
350 | add edi,name_string |
343 | add edi,name_string |
351 | mov eax,2 |
344 | mov eax,2 |
352 | int 0x40 ; Get the key value |
345 | int 0x40 ; Get the key value |
353 | shr eax,8 |
346 | shr eax,8 |
354 | cmp eax,13 ; Return key ends input |
347 | cmp eax,13 ; Return key ends input |
355 | je .rs_done |
348 | je .rs_done |
356 | cmp eax,8 |
349 | cmp eax,8 |
357 | jnz .nobsl |
350 | jnz .nobsl |
358 | cmp edi,name_string |
351 | cmp edi,name_string |
359 | je .exit |
352 | je .exit |
360 | dec edi |
353 | dec edi |
361 | mov [edi],byte 0;'_' |
354 | mov [edi],byte 0;'_' |
362 | dec byte[name_string.cursor] |
355 | dec byte[name_string.cursor] |
363 | jmp print_strings |
356 | jmp print_strings |
364 | .exit: ret |
357 | .exit: ret |
365 | .nobsl: |
358 | .nobsl: |
366 | cmp eax,31 |
359 | cmp eax,31 |
367 | jbe .exit |
360 | jbe .exit |
368 | cmp eax,97 |
361 | cmp eax,97 |
369 | jb .keyok |
362 | jb .keyok |
370 | sub eax,32 |
363 | sub eax,32 |
371 | .keyok: |
364 | .keyok: |
372 | mov ah,0 |
365 | mov ah,0 |
373 | stosw |
366 | stosw |
374 | cmp edi,name_string.end |
367 | cmp edi,name_string.end |
375 | jnc print_strings |
368 | jnc print_strings |
376 | inc byte[name_string.cursor] |
369 | inc byte[name_string.cursor] |
377 | jmp print_strings |
370 | jmp print_strings |
378 | .rs_done: |
371 | .rs_done: |
379 | call print_strings |
372 | call print_strings |
380 | mov esi,name_string |
373 | mov esi,name_string |
381 | call open |
374 | call open |
382 | test eax,eax |
375 | test eax,eax |
383 | jz .exit |
376 | jz .exit |
384 | call jpeg_info |
377 | call jpeg_info |
385 | test ebp,ebp |
378 | test ebp,ebp |
386 | jz close |
379 | jz close |
387 | xchg [jpeg_st],ebp |
380 | xchg [jpeg_st],ebp |
388 | call jpeg_close |
381 | call jpeg_close |
389 | 382 | ||
390 | load_image: |
383 | load_image: |
391 | 384 | ||
392 | mov eax,13 ; clear picture area |
385 | mov eax,13 ; clear picture area |
393 | movzx ebx, word [winxs] |
386 | movzx ebx, word [winxs] |
394 | sub ebx, 7 |
- | |
395 | add ebx, 4 * 65536 |
387 | add ebx, 1 shl 16 -10 |
396 | movzx ecx, word [winys] |
388 | movzx ecx, word [winys] |
397 | sub ecx, 39 |
389 | sub ecx, 40 |
398 | add ecx, 20 * 65536 |
390 | add ecx, 1 shl 16 |
399 | 391 | ||
400 | mov edx,0 |
392 | mov edx,[sc.work] |
401 | int 0x40 |
393 | int 0x40 |
402 | mov ebp,[jpeg_st] |
394 | mov ebp,[jpeg_st] |
403 | test ebp,ebp |
395 | test ebp,ebp |
404 | jz .exit |
396 | jz .exit |
405 | mov dword [ebp+draw_ptr],put_image |
397 | mov dword [ebp+draw_ptr],put_image |
406 | jmp jpeg_display |
398 | jmp jpeg_display |
407 | .exit: ret |
399 | .exit: ret |
408 | 400 | ||
409 | print_strings: |
401 | print_strings: |
410 | pusha |
402 | pusha |
411 | mov eax,13 ; clear text area |
403 | mov eax,13 ; clear text area |
412 | movzx ebx, word [winxs] |
404 | movzx ebx, word [winxs] |
413 | sub ebx, 64+58 |
- | |
414 | add ebx, 60*65536 |
405 | add ebx, 59 shl 16 -125 |
415 | mov cx, [winys] |
406 | mov cx, [winys] |
416 | sub cx, 16 |
407 | sub cx, 39 |
417 | shl ecx, 16 |
408 | shl ecx, 16 |
418 | add ecx, 12 |
409 | add ecx, 12 |
419 | mov edx,0xffffff |
410 | mov edx,0xffffff |
420 | int 0x40 |
411 | int 0x40 |
421 | 412 | ||
422 | mov eax,4 ; |
413 | mov eax,4 ; |
423 | movzx ebx, word [winys] |
414 | movzx ebx, word [winys] |
424 | sub ebx, 14 |
- | |
425 | add ebx, 60*65536 |
415 | add ebx, 61 shl 16 - 37 |
426 | mov ecx,0x000000 |
416 | mov ecx,0x000000 |
427 | mov edx,name_string |
417 | mov edx,name_string |
428 | mov esi,60 |
418 | mov esi,60 |
429 | int 0x40 |
419 | int 0x40 |
430 | popa |
420 | popa |
431 | ret |
421 | ret |
432 | 422 | ||
433 | slideshow: |
423 | slideshow: |
434 | cmp [file_dir], 0 |
424 | cmp [file_dir], 0 |
435 | jnz .exit |
425 | jnz .exit |
436 | cmp [jpeg_st], 0 |
426 | cmp [jpeg_st], 0 |
437 | jz .exit |
427 | jz .exit |
438 | mov esi, name_string |
428 | mov esi, name_string |
439 | movzx ecx, byte [name_string.cursor] |
429 | movzx ecx, byte [name_string.cursor] |
440 | .l1: |
430 | .l1: |
441 | cmp byte [esi+ecx], '/' |
431 | cmp byte [esi+ecx], '/' |
442 | jz .l2 |
432 | jz .l2 |
443 | loop .l1 |
433 | loop .l1 |
444 | .exit: |
434 | .exit: |
445 | ret |
435 | ret |
446 | .l2: |
436 | .l2: |
447 | mov byte [esi+ecx], 0 |
437 | mov byte [esi+ecx], 0 |
448 | call open |
438 | call open |
449 | mov byte [esi+ecx], '/' |
439 | mov byte [esi+ecx], '/' |
450 | test eax, eax |
440 | test eax, eax |
451 | jz .exit |
441 | jz .exit |
452 | test byte [fileattr], 0x10 |
442 | test byte [fileattr], 0x10 |
453 | jz .exit |
443 | jz .exit |
454 | mov [file_dir], eax |
444 | mov [file_dir], eax |
455 | inc ecx |
445 | inc ecx |
456 | mov [name_string.cursor], cl |
446 | mov [name_string.cursor], cl |
457 | display_next: |
447 | display_next: |
458 | mov ebx, [file_dir] |
448 | mov ebx, [file_dir] |
459 | test ebx, ebx |
449 | test ebx, ebx |
460 | jnz @f |
450 | jnz @f |
461 | ret |
451 | ret |
462 | @@: |
452 | @@: |
463 | mov byte [ebx], 1 |
453 | mov byte [ebx], 1 |
464 | mov byte [ebx+12], 1 |
454 | mov byte [ebx+12], 1 |
465 | mov dword [ebx+16], dirinfo |
455 | mov dword [ebx+16], dirinfo |
466 | mov eax, 70 |
456 | mov eax, 70 |
467 | int 0x40 |
457 | int 0x40 |
468 | mov eax, [file_dir] |
458 | mov eax, [file_dir] |
469 | inc dword [eax+4] |
459 | inc dword [eax+4] |
470 | cmp ebx, 1 |
460 | cmp ebx, 1 |
471 | jz @f |
461 | jz @f |
472 | mov eax, [file_dir] |
462 | mov eax, [file_dir] |
473 | and [file_dir], 0 |
463 | and [file_dir], 0 |
474 | jmp close |
464 | jmp close |
475 | @@: |
465 | @@: |
476 | movzx edi, byte [name_string.cursor] |
466 | movzx edi, byte [name_string.cursor] |
477 | add edi, name_string |
467 | add edi, name_string |
478 | lea esi, [dirinfo+32+40] |
468 | lea esi, [dirinfo+32+40] |
479 | @@: |
469 | @@: |
480 | lodsb |
470 | lodsb |
481 | stosb |
471 | stosb |
482 | test al, al |
472 | test al, al |
483 | jnz @b |
473 | jnz @b |
484 | mov ecx, name_string.end |
474 | mov ecx, name_string.end |
485 | sub ecx, edi |
475 | sub ecx, edi |
486 | rep stosb |
476 | rep stosb |
487 | call print_strings |
477 | call print_strings |
488 | mov esi,name_string |
478 | mov esi,name_string |
489 | call open |
479 | call open |
490 | test eax,eax |
480 | test eax,eax |
491 | jz display_next |
481 | jz display_next |
492 | call jpeg_info |
482 | call jpeg_info |
493 | test ebp,ebp |
483 | test ebp,ebp |
494 | jnz .l6 |
484 | jnz .l6 |
495 | call close |
485 | call close |
496 | jmp display_next |
486 | jmp display_next |
497 | .l6: |
487 | .l6: |
498 | mov dword[ebp+draw_ptr],put_image |
488 | mov dword[ebp+draw_ptr],put_image |
499 | push ebp |
489 | push ebp |
500 | xchg [jpeg_st],ebp |
490 | xchg [jpeg_st],ebp |
501 | call jpeg_close |
491 | call jpeg_close |
502 | pop ebp |
492 | pop ebp |
503 | jmp jpeg_display |
493 | jmp jpeg_display |
504 | 494 | ||
505 | 495 | ||
506 | include 'filelib.asm' |
496 | include 'filelib.asm' |
507 | include 'memlib.asm' |
497 | include 'memlib.asm' |
508 | include 'jpeglib.asm' |
498 | include 'jpeglib.asm' |
509 | 499 | ||
510 | 500 | ||
511 | ; DATA AREA |
501 | ; DATA AREA |
512 | 502 | ||
513 | wcolor dd 0x000000 |
503 | wcolor dd 0x000000 |
514 | header db appname,version,0 |
504 | header db appname,version,0 |
515 | setname db 'SLIDESHOW' |
505 | setname db 'SLIDESHOW' |
516 | setnamelen: |
506 | setnamelen: |
517 | 507 | ||
518 | setbgr db ' BGR ' |
508 | setbgr db ' BGR ' |
519 | setbgrlen: |
509 | setbgrlen: |
520 | 510 | ||
521 | x_pointer dd 0 |
511 | x_pointer dd 0 |
522 | x_offset dd 0 |
512 | x_offset dd 0 |
523 | x_numofbytes dd 0 |
513 | x_numofbytes dd 0 |
524 | x_numofb2 dd 0 |
514 | x_numofb2 dd 0 |
525 | x_counter dd 0 |
515 | x_counter dd 0 |
526 | winxo dw 0 |
516 | winxo dw 0 |
527 | winyo dw 0 |
517 | winyo dw 0 |
528 | winxs dw 0 |
518 | winxs dw 0 |
529 | winys dw 0 |
519 | winys dw 0 |
530 | jpeg_st dd 0 |
520 | jpeg_st dd 0 |
531 | file_dir dd 0 |
521 | file_dir dd 0 |
532 | tcolor dd 0x000000 |
- | |
533 | btcolor dd 0x224466+0x808080 |
- | |
534 | name_string: db '/rd/1/jpegview.jpg',0 |
522 | name_string: db '/rd/1/jpegview.jpg',0 |
535 | rb 256 |
523 | rb 256 |
536 | .end: |
524 | .end: |
537 | .cursor: db 19 |
525 | .cursor: db 19 |
538 | .cursor2: db 0 |
526 | .cursor2: db 0 |
539 | 527 | ||
540 | align 4 |
528 | align 4 |
541 | 529 | ||
542 | rgb16: db 0,4,8,13,17,21,25,29,34,38,42,46,50,55,59,63 |
530 | rgb16: db 0,4,8,13,17,21,25,29,34,38,42,46,50,55,59,63 |
543 | rgb4: db 0,21,42,63 |
531 | rgb4: db 0,21,42,63 |
544 | 532 | ||
545 | include 'jpegdat.asm' |
533 | include 'jpegdat.asm' |
546 | 534 | ||
547 | align 4 |
535 | align 4 |
548 | 536 | ||
549 | iniciomemoria: |
537 | iniciomemoria: |
550 | dd -(iniciomemoria+4),-(iniciomemoria+4),(iniciomemoria+4),.l1,0 |
538 | dd -(iniciomemoria+4),-(iniciomemoria+4),(iniciomemoria+4),.l1,0 |
551 | .l1 dd 0 |
539 | .l1 dd 0 |
552 | 540 | ||
553 | fin: |
541 | fin: |
554 | I_END: |
542 | I_END: |
555 | - | ||
- | 543 | sc system_colors |
|
556 | fileattr: rb 40 |
544 | fileattr: rb 40 |
557 | dirinfo: rb 32+304 |
545 | dirinfo: rb 32+304 |