Subversion Repositories Kolibri OS

Rev

Rev 529 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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