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 825
Line 1... Line 1...
1
;   Picture browser by lisovin@26.ru
1
;   Picture browser by lisovin@26.ru
2
;   Modified by Ivan Poddubny - v.0.3
2
;   Modified by Ivan Poddubny - v.0.3
3
;   Modified by Diamond - v.0.4
3
;   Modified by Diamond - v.0.4
-
 
4
;   Modified by Mario79 - v.0.5  18.07.08 Dinamic Allocation Memory
4
;   Compile with FASM for Menuet
5
;   Compile with FASM for Menuet
Line 5... Line 6...
5
 
6
 
6
;******************************************************************************
7
;******************************************************************************
7
    use32
8
    use32
8
    org    0x0
9
    org    0x0
9
    db     'MENUET01'              ; 8 byte id
10
    db	   'MENUET01'		   ; 8 byte id
10
    dd     0x01                    ; header version
11
    dd	   0x01 		   ; header version
11
    dd     START                   ; start of code
12
    dd	   START		   ; start of code
12
    dd     IM_END                  ; size of image
13
    dd	   IM_END		   ; size of image
13
    dd     0x300000                ; memory for app
14
    dd	   I_END ;0x300000                 ; memory for app
14
    dd     0x300000                ; esp
15
    dd	   I_END ;0x300000                 ; esp
Line 15... Line 16...
15
    dd     temp_area , 0x0         ; I_Param , I_Icon
16
    dd	   temp_area , 0x0	   ; I_Param , I_Icon
16
 
17
 
-
 
18
include    'lang.inc'
17
include    'lang.inc'
19
include    '..\..\..\macros.inc'
Line 18... Line 20...
18
include    '..\..\..\macros.inc'
20
;include    'macros.inc'
19
;******************************************************************************
21
;******************************************************************************
20
 
22
 
21
START:                          ; start of execution
23
START:				; start of execution
22
 
24
	mcall	68, 11
23
; check for parameters
25
; check for parameters
24
   cmp   dword [temp_area],'BOOT'
26
   cmp	 dword [temp_area],'BOOT'
Line 123... Line 125...
123
        jnz     still
125
	jnz	still
124
        or      byte [status], 1
126
	or	byte [status], 1
125
    mov  eax,51
127
    mov  eax,51
126
    mov  ebx,1
128
    mov  ebx,1
127
    mov  ecx,thread1
129
    mov  ecx,thread1
128
    mov  edx,0x29fff0
130
    mov  edx,thread   ;0x29fff0
129
    mcall
131
    mcall
130
    jmp  still
132
    jmp  still
131
  nofile:
133
  nofile:
132
    cmp  ah,3
134
    cmp  ah,3
133
    jne  noopen
135
    jne  noopen
Line 134... Line 136...
134
 
136
 
135
 kopen:
137
 kopen:
136
    mov ecx,-1
138
    mov ecx,-1
-
 
139
    call getappinfo
137
    call getappinfo
140
    mov eax,[image_file]
138
    mov ebx,dword [I_END+42]
141
    mov ebx,dword [eax+42]
139
    mov ecx,dword [I_END+46]
142
    mov ecx,dword [eax+46]
140
    add ebx,10*65536-15
143
    add ebx,10*65536-15
141
    add ecx,50*65536-55
144
    add ecx,50*65536-55
142
    mov edx,0xffffff
145
    mov edx,0xffffff
143
    mov eax,13
146
    mov eax,13
Line 144... Line 147...
144
    mcall
147
    mcall
Line 145... Line 148...
145
 
148
 
-
 
149
    call load_image
146
    call load_image
150
 
147
 
151
  open1:
148
  open1:
152
    mov eax,[image_file]
149
    cmp word [I_END],word 'BM'
153
    cmp [eax],word 'BM'
150
    jne  still
154
    jne  still
151
    call convert
155
    call convert
Line 160... Line 164...
160
        jnz     still
164
	jnz	still
161
        or      byte [status], 2
165
	or	byte [status], 2
162
    mov  eax,51
166
    mov  eax,51
163
    mov  ebx,1
167
    mov  ebx,1
164
    mov  ecx,thread2
168
    mov  ecx,thread2
165
    mov  edx,0x2afff0
169
    mov  edx,thread-512  ;0x2afff0
166
    mcall
170
    mcall
167
    jmp  still
171
    jmp  still
168
  noinfo:
172
  noinfo:
Line 169... Line 173...
169
 
173
 
Line 175... Line 179...
175
        jnz     still
179
	jnz	still
176
        or      byte [status], 8
180
	or	byte [status], 8
177
    mov  eax,51
181
    mov  eax,51
178
    mov  ebx,1
182
    mov  ebx,1
179
    mov  ecx,thread3
183
    mov  ecx,thread3
180
    mov  edx,0x2bfff0
184
    mov  edx,thread-512*2  ;0x2bfff0
181
    mcall
185
    mcall
182
    jmp  still
186
    jmp  still
183
    ;call background
187
    ;call background
Line 184... Line 188...
184
 
188
 
Line 188... Line 192...
188
    mcall
192
    mcall
189
    ret
193
    ret
Line 190... Line 194...
190
 
194
 
-
 
195
 
-
 
196
load_image:
-
 
197
	  mov	[fileinfo+0],dword 5
-
 
198
	  mov	[fileinfo+12],dword 0
191
 
199
	  mov	[fileinfo+16],dword process_info
-
 
200
 
-
 
201
    cmp  [image_file],0
-
 
202
    je	  @f
-
 
203
    mov   ecx,[image_file]
-
 
204
     mcall 68, 13,
-
 
205
 
-
 
206
@@:
-
 
207
	  mcall 70, fileinfo
-
 
208
 
-
 
209
	  mov	[fileinfo+0],dword 0
-
 
210
	  mov	[fileinfo+12],dword 512
192
load_image:
211
	  mov	[fileinfo+16],dword process_info+40
-
 
212
 
-
 
213
	  mcall 70, fileinfo
-
 
214
 
-
 
215
	  mov	ecx,[process_info+32]
-
 
216
	  mov	[fileinfo+12],ecx
-
 
217
 
-
 
218
    mov  eax,[process_info+40+28]
-
 
219
 
-
 
220
	cmp	eax, 24
-
 
221
	jz	.convert24
-
 
222
	cmp	eax, 8
-
 
223
	jz	.convert8
-
 
224
	cmp	eax, 4
-
 
225
	jz	.convert4
-
 
226
     shl  ecx,2
-
 
227
.convert4:
-
 
228
     shl  ecx,1
-
 
229
.convert8:
193
        mov     eax, 70
230
     lea  ecx,[ecx*3]
-
 
231
.convert24:
-
 
232
     shl  ecx,1
-
 
233
@@:
-
 
234
 
-
 
235
	  mcall 68, 12
-
 
236
 
-
 
237
 
-
 
238
	  mov	[fileinfo+16],eax
-
 
239
	  mov	[image_file],eax
-
 
240
 
194
        mov     ebx, fileinfo
241
	  mcall 70, fileinfo
195
        mcall
242
 
-
 
243
    mov  eax,[image_file]
196
    mov  eax,[I_END+18]
244
    mov  ebx,[eax+22]
197
    mov  ebx,[I_END+22]
245
    mov  eax,[eax+18]
198
        test    ebx, ebx
246
	test	ebx, ebx
199
        jns     @f
247
	jns	@f
200
        neg     ebx
248
	neg	ebx
Line 213... Line 261...
213
    mov  [wnd_height],ebx
261
    mov  [wnd_height],ebx
214
    test [bWasDraw],1
262
    test [bWasDraw],1
215
    jz   @f
263
    jz	 @f
216
    mov  esi,ebx
264
    mov  esi,ebx
217
    mov  edx,eax
265
    mov  edx,eax
218
    mov  ecx,-1
-
 
219
    mov  ebx,-1
266
    mcall 67,-1,-1
220
    mov  eax,67
-
 
221
    mcall
-
 
222
@@:
267
@@:
223
    ret
268
    ret
Line 224... Line 269...
224
 
269
 
-
 
270
 
225
 
271
  drawimage:
226
  drawimage:
272
    mov  eax,[image_file]
227
    cmp  word [I_END],word 'BM'
-
 
228
    jne  nodrawimage
-
 
229
    mov  eax,7
273
    cmp  [eax],word 'BM'
230
    mov  ebx,[soi]
274
    jne  nodrawimage
231
        mov     ecx, dword [I_END+18-2]
275
	mov	ecx, dword [eax+18-2]
232
        mov     cx, [I_END+22]
276
	mov	cx, [eax+22]
233
        test    cx, cx
277
	test	cx, cx
234
        jns     @f
278
	jns	@f
235
        neg     cx
279
	neg	cx
236
@@:
280
@@:
237
    mov  edx,10*65536+50
281
    mov  edx,10*65536+50
238
    mcall
282
    mcall 7,[soi]
Line 239... Line 283...
239
  nodrawimage:
283
  nodrawimage:
240
    ret
284
    ret
-
 
285
 
241
 
286
; “‘’€Ž‚ˆ’œ ”Ž
242
; “‘’€Ž‚ˆ’œ ”Ž
287
  background:
243
  background:
-
 
244
    cmp  word [I_END],word 'BM'
-
 
245
    jne  @f
288
    mov  eax,[image_file]
246
    mov  eax,15
289
    cmp  [eax],word 'BM'
247
    mov  ebx,1
290
    jne  @f
Line 248... Line 291...
248
    mov  ecx,[I_END+18] ; è¨à¨­ 
291
    mov  ecx,[eax+18] ; è¨à¨­ 
249
    mov  edx,[I_END+22] ; ¢ëá®â 
292
    mov  edx,[eax+22] ; ¢ëá®â 
250
    mcall
293
    mcall 15,1
251
 
294
 
Line 266... Line 309...
266
    mcall
309
    mcall
267
   @@:
310
   @@:
268
    ret
311
    ret
Line 269... Line 312...
269
 
312
 
270
convert:
313
convert:
271
        mov     ecx, I_END
314
	mov	ecx, [image_file]  ;I_END
272
        add     ecx, [ecx+2]
315
	add	ecx, [ecx+2]
-
 
316
	mov	[soi], ecx
273
        mov     [soi], ecx
317
	mov	eax,[image_file]
274
        mov     ebp, [I_END+18]
318
	mov	ebp, [eax+18]
275
        lea     ebp, [ebp*3]    ; ebp = size of output scanline
319
	lea	ebp, [ebp*3]	; ebp = size of output scanline
276
        mov     eax, [I_END+22]
320
	mov	eax, [eax+22]
277
        dec     eax
321
	dec	eax
278
        mul     ebp
322
	mul	ebp
279
        add     eax, ecx
323
	add	eax, ecx
280
        mov     edi, eax        ; edi points to last scanline
324
	mov	edi, eax	; edi points to last scanline
281
        mov     esi, I_END
325
	mov	esi, [image_file]  ;I_END
282
        add     esi, [esi+10]
326
	add	esi, [esi+10]
-
 
327
;        mov     ebx, I_END+54
283
        mov     ebx, I_END+54
328
	mov	ebx,[image_file]
-
 
329
	mov	edx, [ebx+22]
284
        mov     edx, [I_END+22]
330
	add	ebx,54
285
        lea     eax, [ebp*2]
331
	lea	eax, [ebp*2]
286
        mov     [delta], eax
332
	mov	[delta], eax
287
        test    edx, edx
333
	test	edx, edx
288
        jz      .ret
334
	jz	.ret
289
        jns     @f
335
	jns	@f
290
        neg     edx
336
	neg	edx
291
        and     [delta], 0
337
	and	[delta], 0
292
        mov     edi, ecx
338
	mov	edi, ecx
293
@@:
339
@@:
-
 
340
;        movzx   eax, word [I_END+28]
-
 
341
	mov	eax,[image_file]
294
        movzx   eax, word [I_END+28]
342
	movzx	eax,word [eax+28]
295
        cmp     eax, 24
343
	cmp	eax, 24
296
        jz      convert24
344
	jz	convert24
297
        cmp     eax, 8
345
	cmp	eax, 8
298
        jz      convert8
346
	jz	convert8
Line 317... Line 365...
317
        push    edi
365
	push	edi
318
        add     [esp], ebp
366
	add	[esp], ebp
319
.loopi:
367
.loopi:
320
        xor     eax, eax
368
	xor	eax, eax
321
        lodsb
369
	lodsb
322
        cmp     dword [I_END+30], 1
370
;        cmp     dword [I_END+30], 1
-
 
371
	push	eax
-
 
372
	mov	eax,[image_file]
-
 
373
	cmp	dword [eax+30],1
-
 
374
	pop	eax
323
        jnz     .nocompressed
375
	jnz	.nocompressed
324
.compressed:
376
.compressed:
325
        mov     ecx, eax
377
	mov	ecx, eax
326
        jecxz   .special
378
	jecxz	.special
327
        lodsb
379
	lodsb
Line 415... Line 467...
415
        jnz     convert1
467
	jnz	convert1
416
        ret
468
	ret
Line 417... Line 469...
417
 
469
 
418
align_input:
470
align_input:
-
 
471
	push	esi
-
 
472
	push	eax
419
        push    esi
473
	mov	eax,[image_file]
420
        sub     esi, I_END
474
	sub	esi,eax    ;I_END
-
 
475
	sub	esi,[eax+10]
421
        sub     esi, [I_END+10]
476
	pop	eax
422
        neg     esi
477
	neg	esi
423
        and     esi, 3
478
	and	esi, 3
424
        add     [esp], esi
479
	add	[esp], esi
425
        pop     esi
480
	pop	esi
Line 447... Line 502...
447
 
502
 
448
                                   ; DRAW WINDOW
503
				   ; DRAW WINDOW
449
    xor  eax,eax                   ; function 0 : define and draw window
504
    xor  eax,eax		   ; function 0 : define and draw window
450
;    mov  ebx,350                   ; [x start] *65536 + [x size]
505
;    mov  ebx,350                   ; [x start] *65536 + [x size]
451
;    mov  ecx,400                   ; [y start] *65536 + [y size]
506
;    mov  ecx,400                   ; [y start] *65536 + [y size]
452
    mov  ebx,100*65536
507
    mov  ebx,0*65536
453
    mov  ecx,100*65536
508
    mov  ecx,0*65536
454
    add  ebx,[wnd_width]
509
    add  ebx,[wnd_width]
455
    add  ecx,[wnd_height]
510
    add  ecx,[wnd_height]
456
    mov  edx,0x03ffffff            ; color of work area RRGGBB,8->color gl
511
    mov  edx,0x03ffffff 	   ; color of work area RRGGBB,8->color gl
Line 784... Line 839...
784
    cmp  ebx,80*65536+70
839
    cmp  ebx,80*65536+70
785
    jbe  followstring
840
    jbe  followstring
786
    mov  eax,47
841
    mov  eax,47
787
    mov  edx,200*65536+40
842
    mov  edx,200*65536+40
788
    mov  esi,ecx
843
    mov  esi,ecx
-
 
844
    mov  ecx,[image_file]
-
 
845
    push ecx
789
    mov  ecx, [I_END+2]
846
    mov  ecx, [ecx+2]
790
    call digitcorrect
847
    call digitcorrect
791
    mcall
848
    mcall
792
    add  edx,10
849
    add  edx,10
-
 
850
    pop  ecx
-
 
851
    push ecx
793
    mov  ecx, [I_END+18]
852
    mov  ecx, [ecx+18]
794
    call digitcorrect
853
    call digitcorrect
795
    mcall
854
    mcall
796
    add  edx,10
855
    add  edx,10
-
 
856
    pop  ecx
-
 
857
    push ecx
797
    mov  ecx, [I_END+22]
858
    mov  ecx, [ecx+22]
798
    call digitcorrect
859
    call digitcorrect
799
    mcall
860
    mcall
800
    add  edx,10
861
    add  edx,10
-
 
862
    pop  ecx
801
    movzx ecx,word [I_END+28]
863
    movzx ecx,word [ecx+28]
802
    call digitcorrect
864
    call digitcorrect
803
    mcall
865
    mcall
Line 804... Line 866...
804
 
866
 
805
    mov  eax,12                    ; function 12:tell os about windowdraw
867
    mov  eax,12 		   ; function 12:tell os about windowdraw
Line 1044... Line 1106...
1044
lsz ok_btn,\
1106
lsz ok_btn,\
1045
    en, 'Ok',\
1107
    en, 'Ok',\
1046
    ru, 'Ok',\
1108
    ru, 'Ok',\
1047
    de, 'Ok'
1109
    de, 'Ok'
Line -... Line 1110...
-
 
1110
 
-
 
1111
image_file dd 0
-
 
1112
;image_file_size dd 0
1048
 
1113
 
-
 
1114
pos: dd 6
-
 
1115
 
-
 
1116
;fileinfo:
-
 
1117
;     dd 0
-
 
1118
;     dd 0
-
 
1119
;     dd 0
-
 
1120
;     dd 0x290000-I_END
-
 
1121
;     dd I_END
1049
pos: dd 6
1122
 
-
 
1123
fileinfo:
1050
fileinfo:
1124
     dd 5
1051
     dd 0
1125
     dd 0
1052
     dd 0
-
 
1053
     dd 0
1126
     dd 0
1054
     dd 0x290000-I_END
1127
     dd 0		;x290000-I_END
1055
     dd I_END
1128
     dd process_info	;I_END
1056
string:
1129
string:
Line 1057... Line 1130...
1057
        db      '/sys/bgr.bmp',0
1130
	db	'/sys/bgr.bmp',0
1058
 
1131
 
Line 1059... Line 1132...
1059
IM_END:
1132
IM_END:
1060
        rb      string+257-$
1133
	rb	string+257-$
-
 
1134
 
-
 
1135
process_info:
1061
 
1136
temp_area:
-
 
1137
rb 1024*4
-
 
1138
rb 1024*2
1062
process_info:
1139
;rb 0x10000