Subversion Repositories Kolibri OS

Rev

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

Rev 111 Rev 131
Line 20... Line 20...
20
    mov  edi,os_work
20
    mov  edi,os_work
21
    mov  edx,edi
21
    mov  edx,edi
22
    rep  movsb
22
    rep  movsb
23
    mov  dword[edi],0x00a0d
23
    mov  dword[edi],0x00a0d
24
    call DebugPrint
24
    call DebugPrint
25
;    mcall 10
-
 
26
;    mcall 2
-
 
27
    popa
25
    popa
-
 
26
    call Add2Fat
28
    ret
27
    ret
Line -... Line 28...
-
 
28
 
-
 
29
Add2Fat:
-
 
30
; edx - ptr, ecx - len
-
 
31
 
-
 
32
    pusha
-
 
33
    test [Flags],LIST_MODE
-
 
34
    jz   .ex
-
 
35
    mov  ebp,8
-
 
36
    mov  edi,edx
-
 
37
    lea  ebx,[edx+ecx]
-
 
38
    mov  ecx,[lpath_len]
-
 
39
    cmp  ecx,1
-
 
40
    je   .lbl
-
 
41
    mov  esi,[lpath]
-
 
42
    repe cmpsb
-
 
43
    jne  .full
-
 
44
    mov  eax,[lpath_len]
-
 
45
    sub  dword[esp+24],eax;path_len-path
-
 
46
    cmp  edi,ebx
-
 
47
    je   .full
-
 
48
    mov  edx,edi
-
 
49
  .lbl:
-
 
50
    mov  ecx,[esp+24]
-
 
51
    mov  al,'/'
-
 
52
    repne scasb
-
 
53
    mov  eax,[fat_]
-
 
54
    mov  ecx,[esp+24]
-
 
55
    jne  .nofol
-
 
56
    cmp  edi,ebx
-
 
57
    jne  .full
-
 
58
    lea  ecx,[edi-1]
-
 
59
    sub  ecx,edx
-
 
60
    or   byte[eax+11],0x10
-
 
61
;    sub  edx,ecx
-
 
62
  .nofol:
-
 
63
 
-
 
64
    push [fat_fnum]
-
 
65
    pop  dword[eax+12]
-
 
66
    mov  edi,eax
-
 
67
    mov  esi,edx
-
 
68
  .lp1:
-
 
69
 
-
 
70
    mov  bl,[esi]
-
 
71
    lea  edx,[eax+ebp]
-
 
72
    inc  esi
-
 
73
    cmp  bl,'.'
-
 
74
    jne  .nodot
-
 
75
    lea  edi,[eax+ebp]
-
 
76
    mov  ebp,11
-
 
77
    jmp  .ll
-
 
78
  .nodot:
-
 
79
    cmp  edi,edx
-
 
80
    jae  .ll
-
 
81
    mov  [edi],bl
-
 
82
    inc  edi
-
 
83
  .ll:
-
 
84
    loop .lp1
-
 
85
    mov  ecx,11
-
 
86
    dec  eax
-
 
87
  .lp2:
-
 
88
    cmp  byte[eax+ecx],0
-
 
89
    jne  .no0
-
 
90
    mov  byte[eax+ecx],' '
-
 
91
  .no0:
-
 
92
    loop .lp2
-
 
93
    cmp  eax,child_stack-1
-
 
94
    jae  .full
-
 
95
    add  [fat_],32
-
 
96
  .full:
-
 
97
    inc  [fat_fnum]
-
 
98
  .ex:
-
 
99
    popa
-
 
100
    ret
-
 
101
 
-
 
102
;path db '/';'fasm/examples/elfexe/'
Line 29... Line 103...
29
 
103
;path_len:
30
 
104
 
31
; Parse routines:
105
; Parse routines:
32
;   out: edx= 0 if all ok, 1 - central dir, 2-EOD
106
;   out: edx= 0 if all ok, 1 - central dir, 2-EOD
Line 76... Line 150...
76
    mov   edx,os_work
150
    mov   edx,os_work
77
   	call  DebugPrint
151
   	call  DebugPrint
78
   	popa
152
   	popa
79
 end if
153
 end if
80
    Newline
154
    Newline
-
 
155
;    Dump fat,160,os_work
81
    ret
156
    ret
Line 82... Line 157...
82
 
157
 
83
ZipFindN:
158
ZipFindN:
84
; ecx - file #
159
; ecx - file #
-
 
160
    Msg 33
85
    Msg 33
161
    or   [Flags],FIND_MODE
86
    cmp  ecx,[file_count]
162
    cmp  ecx,[file_count]
87
    jae  .err
163
    jae  .err
88
    push ecx
164
    push ecx
89
    call ResetFile
165
    call ResetFile
-
 
166
  .nxt:
90
  .nxt:
167
 
91
    call ZipCrawl
168
    call ZipCrawl
92
    cmp  edx,51
169
    cmp  edx,51
93
    je   .ok2
170
    je   .ok2
94
  .noenc:
171
  .noenc:
Line 109... Line 186...
109
    pop  ecx
186
    pop  ecx
110
    sub  eax,[esi+18]
187
    sub  eax,[esi+18]
111
    add  esi,eax
188
    add  esi,eax
112
    mov  edx,5
189
    mov  edx,5
113
  .ex:
190
  .ex:
-
 
191
    and   [Flags],-1-FIND_MODE
114
    push edx
192
    push edx
115
    Msg  edx
193
    Msg  edx
116
    pop  edx
194
    pop  edx
117
    ret
195
    ret
Line 157... Line 235...
157
    add  eax,ecx
235
    add  eax,ecx
158
if  IGNORE_DIRS eq 1
236
if  IGNORE_DIRS eq 1
159
    cmp  byte[edx+ecx-1],'/'
237
    cmp  byte[edx+ecx-1],'/'
160
    je   .skipdp
238
    je   .skipdp
161
end if
239
end if
-
 
240
    test [Flags],FIND_MODE
-
 
241
    jnz  .skipdp
162
    call PrintFilename
242
    call PrintFilename
163
  .skipdp:
243
  .skipdp:
164
    movzx ecx,word[esi+28]
244
    movzx ecx,word[esi+28]
165
    add  eax,[esi+18]
245
    add  eax,[esi+18]
166
    test [gpbf],1
246
    test [gpbf],1
Line 250... Line 330...
250
    mov  eax,[PNG_info.Width]
330
    mov  eax,[PNG_info.Width]
251
    bswap eax
331
    bswap eax
252
    mov  [PNG_info.Width],eax
332
    mov  [PNG_info.Width],eax
253
    mov  eax,[PNG_info.Height]
333
    mov  eax,[PNG_info.Height]
254
    bswap eax
334
    bswap eax
-
 
335
    mov  ebx,eax
255
    mov  [PNG_info.Height],eax
336
    mov  [PNG_info.Height],eax
-
 
337
    call scanline_calc
-
 
338
;    dps  'All='
-
 
339
    cmp  [PNG_info.Color_type],3
-
 
340
    jne  .nopal
-
 
341
    shl  eax,3
-
 
342
    inc  eax
-
 
343
  .nopal:
-
 
344
    inc  eax
-
 
345
    imul eax,ebx
-
 
346
    mov  [unp_size],eax
-
 
347
;    dpd  eax
256
    add  esi,25
348
    add  esi,25
257
    cmp  byte[esi-5],0
349
    cmp  byte[esi-5],0
258
    rep_err e,52,29
350
    rep_err e,52,29
259
  .nxt_sec:
351
  .nxt_sec:
260
    lodsd
352
    lodsd
Line 421... Line 513...
421
  .noenc:
513
  .noenc:
422
    mov  [cur_byte],eax
514
    mov  [cur_byte],eax
423
    ret
515
    ret
Line 424... Line 516...
424
 
516
 
-
 
517
TarParse:
425
TarParse:
518
    mov  esi,output
426
    call ResetFile
519
;    call ResetFile
427
  .nxt:
520
  .nxt:
428
    call TarCrawl
521
    call TarCrawl
429
;    wait
522
;    wait
430
    cmp  edx,3
523
    cmp  edx,3
Line 434... Line 527...
434
    jne  .skipinc
527
    jne  .skipinc
435
end if
528
end if
436
    inc  [file_count]
529
    inc  [file_count]
437
  .skipinc:
530
  .skipinc:
438
    add  eax,ecx
531
    add  eax,ecx
439
    mov  ebx,1
532
;    mov  ebx,1
-
 
533
    add  esi,eax
440
    call FileSeek
534
;    call FileSeek
441
    jmp  .nxt
535
    jmp  .nxt
Line 442... Line 536...
442
 
536
 
443
TarFindN:
537
TarFindN:
444
; in:  ecx - file number
538
; in:  ecx - file number
445
; ecx - file #
539
; ecx - file #
446
    Msg 33
540
    Msg 33
447
    cmp  ecx,[file_count]
541
    cmp  ecx,[file_count]
448
    jae  .err
542
    jae  .err
-
 
543
    push ecx
449
    push ecx
544
    mov  esi,output
450
    call ResetFile
545
;    call ResetFile
451
  .nxt:
546
  .nxt:
452
    call TarCrawl
547
    call TarCrawl
453
if  IGNORE_DIRS eq 1
548
if  IGNORE_DIRS eq 1
454
    cmp  edx,53
549
    cmp  edx,53
Line 459... Line 554...
459
    cmp  dword[esp],0
554
    cmp  dword[esp],0
460
    jz   .ok
555
    jz   .ok
461
    dec  dword[esp]
556
    dec  dword[esp]
462
  .seek:
557
  .seek:
463
    add  eax,ecx
558
    add  eax,ecx
464
    mov  ebx,1
559
;    mov  ebx,1
-
 
560
    add  esi,eax
465
    call FileSeek
561
;    call FileSeek
466
    jmp  .nxt
562
    jmp  .nxt
467
  .err:
563
  .err:
468
    mov  edx,4
564
    mov  edx,4
469
    jmp  .ex
565
    jmp  .ex
470
  .ok:
566
  .ok:
Line 557... Line 653...
557
    push  dword[esi+42]
653
    push  dword[esi+42]
558
    pop   [arc_base]
654
    pop   [arc_base]
559
  .err:
655
  .err:
560
    ret
656
    ret
Line 561... Line -...
561
 
-
 
562
; Created:  May 31, 2005
657
 
563
FiltCall:
-
 
564
dd PngFilter.nofilt,Filt_sub,Filt_up,Filt_av,Filt_paeth,PngFilter.nofilt
-
 
565
PngFilter:
-
 
566
; esi - filtered uncompressed image data
-
 
567
; edi - destination
658
scanline_calc:
568
    mov  cl,[PNG_info.Color_type]
659
    movzx ecx,byte[PNG_info.Color_type]
569
    mov  eax,1
660
    mov  eax,1
570
    cmp  cl,3
661
    cmp  cl,3
571
    je   .palette
662
    je   .palette
572
    test cl,2
663
    test cl,2
Line 592... Line 683...
592
    shr  eax,3
683
    shr  eax,3
593
    test eax,eax
684
    test eax,eax
594
    jnz  .noz2
685
    jnz  .noz2
595
    inc  eax
686
    inc  eax
596
  .noz2:
687
  .noz2:
-
 
688
    ret
-
 
689
 
-
 
690
; Created:  May 31, 2005
-
 
691
FiltCall:
-
 
692
dd PngFilter.nofilt,Filt_sub,Filt_up,Filt_av,Filt_paeth,PngFilter.nofilt
-
 
693
PngFilter:
-
 
694
; esi - filtered uncompressed image data
-
 
695
; edi - destination
-
 
696
    call scanline_calc
597
    mov  [sline_len],eax   ; scanline length
697
    mov  [sline_len],eax   ; scanline length
598
    push edi
698
    push edi
599
    and  [Flags],not 1
699
    and  [Flags],not 1
600
    mov  ecx,[PNG_info.Height]
700
    mov  ecx,[PNG_info.Height]
601
  .scanline:
701
  .scanline: