Rev 485 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ; GIF VIEWER FOR MENUET v1.0 |
2 | ; Written in pure assembler by Ivushkin Andrey aka Willow |
||
3 | ; |
||
4 | ; Uses GIF_LITE 2.0 |
||
5 | ; |
||
6 | ; Created: August 31, 2004 |
||
135 | diamond | 7 | ; Last changed: August 25, 2006 |
31 | halyavin | 8 | ; |
9 | ; COMPILE WITH FASM |
||
10 | |||
195 | heavyiron | 11 | appname equ 'GIF VIEWER' |
12 | |||
31 | halyavin | 13 | ; input line dimensions |
195 | heavyiron | 14 | INP_X equ 5 shl 16+680 |
15 | INP_Y equ 5 shl 16+16 |
||
16 | INP_XY equ 10 shl 16+10 |
||
31 | halyavin | 17 | |
18 | use32 |
||
19 | |||
20 | org 0x0 |
||
21 | |||
22 | db 'MENUET01' |
||
23 | dd 0x01 |
||
24 | dd START |
||
25 | dd I_END |
||
26 | dd 0x300000 |
||
27 | dd 0x27fff0 |
||
28 | dd filename ;0x0 |
||
29 | dd 0x0 |
||
30 | |||
31 | include 'lang.inc' |
||
485 | heavyiron | 32 | include '..\..\..\macros.inc' ; decrease code size (optional) |
31 | halyavin | 33 | include 'debug.inc' |
34 | COLOR_ORDER equ MENUETOS |
||
35 | |||
36 | DELAY equ 20 ; animation speed |
||
37 | |||
38 | ;include '/hd/1/gif/gif_lite.inc' |
||
39 | include 'gif_lite.inc' |
||
40 | |||
41 | START: |
||
42 | cmp [filename],byte 0 |
||
43 | jne openfile2 |
||
44 | ; jmp openfile2 |
||
45 | openfile: |
||
46 | and [entered],0 |
||
47 | xor eax,eax |
||
48 | mov [imgcount],eax |
||
49 | mov esi,fn_input |
||
50 | mov edi,filename |
||
51 | mov ecx,[inp_pos] |
||
52 | rep movsb |
||
135 | diamond | 53 | stosb |
31 | halyavin | 54 | openfile2: |
135 | diamond | 55 | mov eax,70 |
31 | halyavin | 56 | mov ebx,file_info |
485 | heavyiron | 57 | mcall |
31 | halyavin | 58 | cmp eax,6 |
59 | je temp |
||
60 | test eax,eax |
||
61 | jnz ok2 |
||
62 | temp: |
||
135 | diamond | 63 | ; cmp ebx,64 |
64 | ; jbe ok2 |
||
31 | halyavin | 65 | |
66 | and [entered],0 |
||
67 | xor eax,eax |
||
68 | mov [imgcount],eax |
||
69 | mov esi,filename |
||
70 | mov edi,fn_input |
||
135 | diamond | 71 | mov ecx,256/4 ;[filename_len] |
72 | rep movsd |
||
31 | halyavin | 73 | |
74 | mov edi,fn_input |
||
135 | diamond | 75 | mov ecx,256 |
31 | halyavin | 76 | xor eax,eax |
77 | repne scasb |
||
78 | sub edi,fn_input |
||
79 | dec edi |
||
80 | mov [inp_pos],edi |
||
81 | inc [inp_pos] |
||
82 | |||
83 | ; test eax,eax |
||
84 | ; jnz .ok2 |
||
85 | ; cmp ebx,64 |
||
86 | ; jbe .ok2 |
||
87 | mov esi,workarea |
||
88 | mov edi,Image |
||
89 | mov eax,hashtable |
||
90 | call ReadGIF |
||
91 | test eax,eax |
||
92 | jz .ok |
||
93 | xor ecx,ecx |
||
94 | .ok: |
||
95 | mov [imgcount],ecx |
||
96 | ok2: |
||
97 | and dword[img_index],0 |
||
98 | |||
485 | heavyiron | 99 | mov eax,48 |
100 | mov ebx,3 |
||
101 | mov ecx,sc |
||
102 | mov edx,sizeof.system_colors |
||
103 | mcall |
||
104 | |||
31 | halyavin | 105 | red: |
106 | |||
107 | call draw_window |
||
108 | |||
109 | still: |
||
135 | diamond | 110 | cmp [imgcount], 1 |
111 | jnz .delay |
||
112 | mov eax, 10 |
||
113 | int 0x40 |
||
114 | jmp @f |
||
115 | .delay: |
||
31 | halyavin | 116 | mov ebx,DELAY |
117 | mov eax,23 |
||
485 | heavyiron | 118 | mcall |
135 | diamond | 119 | @@: |
120 | dec eax |
||
121 | jz red |
||
122 | dec eax |
||
123 | jz key |
||
124 | dec eax |
||
125 | jz button |
||
31 | halyavin | 126 | mov eax,[imgcount] |
127 | cmp eax,1 |
||
128 | je still |
||
129 | inc [img_index] |
||
130 | cmp eax,[img_index] |
||
131 | jne redsub |
||
132 | and [img_index],0 |
||
133 | redsub: |
||
134 | mov ecx,[img_index] |
||
135 | call draw_subimage |
||
136 | jmp still |
||
137 | |||
138 | key: |
||
139 | mov eax,2 |
||
485 | heavyiron | 140 | mcall |
31 | halyavin | 141 | cmp ah,13 |
142 | je is_input |
||
143 | jmp still |
||
144 | |||
145 | button: |
||
146 | mov eax,17 |
||
485 | heavyiron | 147 | mcall |
31 | halyavin | 148 | |
149 | cmp ah,1 |
||
150 | jne noclose |
||
151 | _close: |
||
152 | or eax,-1 |
||
485 | heavyiron | 153 | mcall |
31 | halyavin | 154 | |
155 | noclose: |
||
156 | is_input: ; simple input line with backspace feature |
||
157 | inc [entered] ; sorry - no cursor |
||
158 | wait_input: |
||
159 | call draw_input |
||
160 | mov eax,10 |
||
485 | heavyiron | 161 | mcall |
31 | halyavin | 162 | cmp eax,2 |
163 | jne still |
||
164 | mov edi,[inp_pos] |
||
165 | mov eax,2 |
||
485 | heavyiron | 166 | mcall |
31 | halyavin | 167 | shr eax,8 |
168 | cmp eax,27 |
||
169 | je still |
||
170 | cmp eax,13 |
||
171 | je openfile |
||
172 | cmp eax,8 |
||
173 | je backsp |
||
174 | mov [fn_input+edi],al |
||
175 | inc [inp_pos] |
||
176 | jmp wait_input |
||
177 | backsp: |
||
178 | test edi,edi |
||
179 | jz wait_input |
||
180 | dec [inp_pos] |
||
181 | jmp wait_input |
||
135 | diamond | 182 | ; jmp still |
31 | halyavin | 183 | |
184 | ;**************************************** |
||
185 | ;******* DRAW CONTENTS OF INPUT LINE **** |
||
186 | ;**************************************** |
||
187 | draw_input: |
||
188 | push edi |
||
189 | cmp [entered],0 |
||
190 | jne highlight |
||
195 | heavyiron | 191 | mov esi,0x00aabbcc |
31 | halyavin | 192 | jmp di_draw |
193 | highlight: |
||
194 | mov esi,0xe0e0e0 |
||
195 | di_draw: |
||
196 | mov eax,8 |
||
197 | mov ebx,INP_X |
||
198 | mov ecx,INP_Y |
||
199 | mov edx,2 |
||
485 | heavyiron | 200 | mcall |
31 | halyavin | 201 | mov eax,4 |
195 | heavyiron | 202 | mov ecx,0x00107a30 |
31 | halyavin | 203 | mov ebx,INP_XY |
204 | mov edx,fn_input |
||
205 | mov esi,[inp_pos] |
||
485 | heavyiron | 206 | mcall |
31 | halyavin | 207 | pop edi |
208 | ret |
||
209 | |||
210 | ; ********************************************* |
||
211 | ; ******* ******* |
||
212 | ; ********************************************* |
||
213 | |||
214 | draw_window: |
||
215 | |||
216 | mov eax,12 |
||
217 | mov ebx,1 |
||
485 | heavyiron | 218 | mcall |
31 | halyavin | 219 | |
220 | mov eax,0 |
||
221 | mov ebx,50*65536+700 |
||
222 | mov ecx,50*65536+500 |
||
195 | heavyiron | 223 | mov edx,[sc.work] |
224 | or edx,0x33000000 |
||
485 | heavyiron | 225 | mov edi,title |
226 | mcall |
||
31 | halyavin | 227 | |
228 | call draw_input |
||
229 | |||
230 | xor ecx,ecx |
||
231 | call draw_subimage |
||
232 | cmp [imgcount],1 |
||
233 | je .enddraw |
||
234 | |||
235 | mov ecx,[img_index] |
||
236 | call draw_subimage |
||
237 | .enddraw: |
||
238 | mov eax,12 |
||
239 | mov ebx,2 |
||
485 | heavyiron | 240 | mcall |
31 | halyavin | 241 | ret |
242 | |||
243 | draw_subimage: |
||
244 | cmp [imgcount],0 |
||
245 | jz .enddraw |
||
246 | mov esi,Image |
||
247 | mov edi,gif_inf |
||
248 | call GetGIFinfo |
||
249 | test eax,eax |
||
250 | jz .enddraw |
||
251 | movzx ebx,[gif_inf.Width] |
||
252 | shl ebx,16 |
||
253 | movzx ecx,[gif_inf.Height] |
||
254 | add ecx,ebx |
||
255 | mov ebx,eax |
||
256 | movzx eax,[gif_inf.Top] |
||
257 | movzx edx,[gif_inf.Left] |
||
258 | shl edx,16 |
||
259 | add edx,eax |
||
195 | heavyiron | 260 | add edx,5 shl 16 +25 |
31 | halyavin | 261 | mov eax,7 |
485 | heavyiron | 262 | mcall |
31 | halyavin | 263 | .enddraw: |
264 | ret |
||
265 | |||
266 | ; ¤„įģ 室ļāįļ ¤ ė„ Æą®£ą ¬¬ė: |
||
267 | |||
485 | heavyiron | 268 | title db appname,0 ; įāą®Ŗ § £®«®¢Ŗ |
31 | halyavin | 269 | |
270 | inp_pos dd inp_end-fn_input |
||
271 | fn_input: |
||
272 | ; db '/hd/1/gif/smileys/sm100000.gif' |
||
529 | spraid | 273 | db '/sys/meos.gif' |
31 | halyavin | 274 | ; db '/hd/1/1/tex256.gif',0 |
275 | ; db '/rd/1/tex256.gif' |
||
276 | inp_end: |
||
277 | rb 256-(inp_end-fn_input) |
||
278 | |||
279 | file_info: |
||
280 | dd 0 |
||
281 | dd 0 |
||
135 | diamond | 282 | dd 0 |
283 | dd 0x100000;0x200000 |
||
284 | dd workarea;0x100000 |
||
31 | halyavin | 285 | I_END: ; Ŗ®„ę Æą®£ą ¬¬ė |
286 | filename: |
||
287 | ; db '/hd/1/gif/smileys/sm112000.gif',0 |
||
288 | ; db '/hd/1/gif/test.gif',0 |
||
289 | ; db '/hd/1/gif/explode1.gif',0 |
||
290 | ; db '/hd/1/gif/tapeta.gif',0 |
||
291 | ; db '/hd/1/gif/meos.gif',0 |
||
135 | diamond | 292 | rb 257 |
31 | halyavin | 293 | ;filename_len dd 0 |
294 | entered rd 1 |
||
195 | heavyiron | 295 | sc system_colors |
31 | halyavin | 296 | |
297 | imgcount rd 1 |
||
298 | img_index rd 1 |
||
299 | gif_inf GIF_info |
||
300 | |||
301 | hashtable rd 4096 |
||
302 | workarea rb 0x100000 |
||
303 | |||
304 | Image: |