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 | ; 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 |
||
552 | diamond | 26 | dd 0x400000 |
27 | dd 0x400000 |
||
31 | halyavin | 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 | |
552 | diamond | 34 | COLOR_ORDER equ PALETTE |
35 | GIF_SUPPORT_INTERLACED = 1 |
||
31 | halyavin | 36 | include 'gif_lite.inc' |
37 | |||
38 | START: |
||
39 | cmp [filename],byte 0 |
||
40 | jne openfile2 |
||
41 | ; jmp openfile2 |
||
42 | openfile: |
||
43 | xor eax,eax |
||
552 | diamond | 44 | mov [entered], eax |
45 | mov [gif_img_count],eax |
||
31 | halyavin | 46 | mov esi,fn_input |
47 | mov edi,filename |
||
48 | mov ecx,[inp_pos] |
||
49 | rep movsb |
||
135 | diamond | 50 | stosb |
31 | halyavin | 51 | openfile2: |
552 | diamond | 52 | mov ebx,file_info |
135 | diamond | 53 | mov eax,70 |
485 | heavyiron | 54 | mcall |
31 | halyavin | 55 | cmp eax,6 |
56 | je temp |
||
57 | test eax,eax |
||
58 | jnz ok2 |
||
59 | temp: |
||
135 | diamond | 60 | ; cmp ebx,64 |
61 | ; jbe ok2 |
||
31 | halyavin | 62 | |
63 | xor eax,eax |
||
552 | diamond | 64 | mov [entered], eax |
31 | halyavin | 65 | mov esi,filename |
66 | mov edi,fn_input |
||
135 | diamond | 67 | mov ecx,256/4 ;[filename_len] |
68 | rep movsd |
||
31 | halyavin | 69 | |
70 | mov edi,fn_input |
||
135 | diamond | 71 | mov ecx,256 |
31 | halyavin | 72 | repne scasb |
73 | sub edi,fn_input |
||
74 | mov [inp_pos],edi |
||
75 | |||
76 | ; test eax,eax |
||
77 | ; jnz .ok2 |
||
78 | ; cmp ebx,64 |
||
79 | ; jbe .ok2 |
||
80 | mov esi,workarea |
||
81 | mov edi,Image |
||
82 | call ReadGIF |
||
83 | test eax,eax |
||
84 | jz .ok |
||
552 | diamond | 85 | and [gif_img_count], 0 |
31 | halyavin | 86 | .ok: |
87 | ok2: |
||
88 | and dword[img_index],0 |
||
89 | |||
485 | heavyiron | 90 | mov ebx,3 |
91 | mov ecx,sc |
||
92 | mov edx,sizeof.system_colors |
||
552 | diamond | 93 | mov eax,48 |
485 | heavyiron | 94 | mcall |
95 | |||
31 | halyavin | 96 | red: |
97 | |||
552 | diamond | 98 | ; ********************************************* |
99 | ; ******* ******* |
||
100 | ; ********************************************* |
||
31 | halyavin | 101 | |
552 | diamond | 102 | draw_window: |
103 | |||
104 | mov ebx,1 |
||
105 | mov eax,12 |
||
106 | mcall |
||
107 | |||
108 | xor eax,eax |
||
109 | mov ebx,50*65536+700 |
||
110 | mov ecx,50*65536+500 |
||
111 | mov edx,[sc.work] |
||
112 | or edx,0x33000000 |
||
113 | mov edi,title |
||
114 | mcall |
||
115 | |||
116 | call draw_input |
||
117 | |||
118 | xor ecx,ecx |
||
119 | call draw_subimage |
||
120 | cmp [gif_img_count],1 |
||
121 | jz @f |
||
122 | |||
123 | mov ecx,[img_index] |
||
124 | call draw_subimage |
||
125 | @@: |
||
126 | |||
127 | mov ebx,2 |
||
128 | mov eax,12 |
||
129 | mcall |
||
130 | |||
31 | halyavin | 131 | still: |
552 | diamond | 132 | cmp [gif_img_count], 1 |
133 | jbe .infinite |
||
134 | mov ebx, [cur_anim_delay] |
||
135 | test ebx, ebx |
||
136 | jz .infinite |
||
137 | mov eax, 23 |
||
138 | mcall |
||
139 | jmp @f |
||
140 | .infinite: |
||
135 | diamond | 141 | mov eax, 10 |
552 | diamond | 142 | mcall |
135 | diamond | 143 | @@: |
144 | dec eax |
||
145 | jz red |
||
146 | dec eax |
||
147 | jz key |
||
148 | dec eax |
||
149 | jz button |
||
552 | diamond | 150 | mov eax,[gif_img_count] |
31 | halyavin | 151 | cmp eax,1 |
152 | je still |
||
153 | inc [img_index] |
||
154 | cmp eax,[img_index] |
||
155 | jne redsub |
||
156 | and [img_index],0 |
||
157 | redsub: |
||
158 | mov ecx,[img_index] |
||
159 | call draw_subimage |
||
160 | jmp still |
||
161 | |||
162 | key: |
||
163 | mov eax,2 |
||
485 | heavyiron | 164 | mcall |
31 | halyavin | 165 | cmp ah,13 |
166 | je is_input |
||
167 | jmp still |
||
168 | |||
169 | button: |
||
552 | diamond | 170 | mcall 17 |
171 | cmp ah,1 |
||
172 | jnz wait_input |
||
31 | halyavin | 173 | |
174 | _close: |
||
175 | or eax,-1 |
||
485 | heavyiron | 176 | mcall |
31 | halyavin | 177 | |
178 | is_input: ; simple input line with backspace feature |
||
179 | inc [entered] ; sorry - no cursor |
||
180 | wait_input: |
||
181 | call draw_input |
||
182 | mov eax,10 |
||
485 | heavyiron | 183 | mcall |
552 | diamond | 184 | cmp al,2 |
31 | halyavin | 185 | jne still |
186 | mov edi,[inp_pos] |
||
552 | diamond | 187 | ; mov eax,2 |
485 | heavyiron | 188 | mcall |
31 | halyavin | 189 | shr eax,8 |
552 | diamond | 190 | cmp al,27 |
31 | halyavin | 191 | je still |
552 | diamond | 192 | cmp al,13 |
31 | halyavin | 193 | je openfile |
552 | diamond | 194 | cmp al,8 |
31 | halyavin | 195 | je backsp |
196 | mov [fn_input+edi],al |
||
197 | inc [inp_pos] |
||
198 | jmp wait_input |
||
199 | backsp: |
||
200 | test edi,edi |
||
201 | jz wait_input |
||
202 | dec [inp_pos] |
||
203 | jmp wait_input |
||
135 | diamond | 204 | ; jmp still |
31 | halyavin | 205 | |
206 | ;**************************************** |
||
207 | ;******* DRAW CONTENTS OF INPUT LINE **** |
||
208 | ;**************************************** |
||
209 | draw_input: |
||
552 | diamond | 210 | mov esi,0xe0e0e0 |
31 | halyavin | 211 | cmp [entered],0 |
212 | jne highlight |
||
195 | heavyiron | 213 | mov esi,0x00aabbcc |
31 | halyavin | 214 | highlight: |
215 | mov ecx,INP_Y |
||
216 | mov edx,2 |
||
552 | diamond | 217 | mov ebx,INP_X |
218 | mov eax,8 |
||
485 | heavyiron | 219 | mcall |
195 | heavyiron | 220 | mov ecx,0x00107a30 |
31 | halyavin | 221 | mov edx,fn_input |
222 | mov esi,[inp_pos] |
||
552 | diamond | 223 | mov ebx,INP_XY |
224 | mov eax,4 |
||
485 | heavyiron | 225 | mcall |
31 | halyavin | 226 | ret |
227 | |||
228 | draw_subimage: |
||
552 | diamond | 229 | cmp [gif_img_count],0 |
31 | halyavin | 230 | jz .enddraw |
231 | mov esi,Image |
||
232 | mov edi,gif_inf |
||
233 | call GetGIFinfo |
||
234 | test eax,eax |
||
235 | jz .enddraw |
||
552 | diamond | 236 | mov ecx, dword [edi+GIF_info.Width-2] |
237 | mov cx, [edi+GIF_info.Height] |
||
31 | halyavin | 238 | mov ebx,eax |
552 | diamond | 239 | mov eax, [edi+GIF_info.Delay] |
240 | mov [cur_anim_delay],eax |
||
241 | mov edx, dword [edi+GIF_info.Left-2] |
||
242 | mov dx, [edi+GIF_info.Top] |
||
195 | heavyiron | 243 | add edx,5 shl 16 +25 |
552 | diamond | 244 | mov esi, 8 |
245 | mov edi, [edi+GIF_info.Palette] |
||
246 | xor ebp, ebp |
||
247 | mov eax, 65 |
||
485 | heavyiron | 248 | mcall |
31 | halyavin | 249 | .enddraw: |
250 | ret |
||
251 | |||
252 | ; ¤„įģ 室ļāįļ ¤ ė„ Æą®£ą ¬¬ė: |
||
253 | |||
485 | heavyiron | 254 | title db appname,0 ; įāą®Ŗ § £®«®¢Ŗ |
31 | halyavin | 255 | |
256 | inp_pos dd inp_end-fn_input |
||
257 | fn_input: |
||
258 | ; db '/hd/1/gif/smileys/sm100000.gif' |
||
529 | spraid | 259 | db '/sys/meos.gif' |
31 | halyavin | 260 | ; db '/hd/1/1/tex256.gif',0 |
261 | ; db '/rd/1/tex256.gif' |
||
262 | inp_end: |
||
263 | rb 256-(inp_end-fn_input) |
||
264 | |||
265 | file_info: |
||
266 | dd 0 |
||
267 | dd 0 |
||
135 | diamond | 268 | dd 0 |
269 | dd 0x100000;0x200000 |
||
270 | dd workarea;0x100000 |
||
31 | halyavin | 271 | I_END: ; Ŗ®„ę Æą®£ą ¬¬ė |
272 | filename: |
||
273 | ; db '/hd/1/gif/smileys/sm112000.gif',0 |
||
274 | ; db '/hd/1/gif/test.gif',0 |
||
275 | ; db '/hd/1/gif/explode1.gif',0 |
||
276 | ; db '/hd/1/gif/tapeta.gif',0 |
||
277 | ; db '/hd/1/gif/meos.gif',0 |
||
135 | diamond | 278 | rb 257 |
31 | halyavin | 279 | ;filename_len dd 0 |
552 | diamond | 280 | |
31 | halyavin | 281 | entered rd 1 |
195 | heavyiron | 282 | sc system_colors |
31 | halyavin | 283 | |
552 | diamond | 284 | gif_img_count rd 1 |
285 | cur_anim_delay rd 1 |
||
31 | halyavin | 286 | img_index rd 1 |
287 | gif_inf GIF_info |
||
288 | |||
552 | diamond | 289 | IncludeUGlobals |
290 | |||
31 | halyavin | 291 | workarea rb 0x100000 |
292 | |||
293 | Image: |