Subversion Repositories Kolibri OS

Rev

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

Rev 77 Rev 78
Line 29... Line 29...
29
   shr  bx,4    ;3 ok
29
   shr  bx,4    ;3 ok
30
   shl  eax,4
30
   shl  eax,4
31
   and  eax,0x0fffffff  ;2 ok
31
   and  eax,0x0fffffff  ;2 ok
32
   shr  ax,4  ;1 ok
32
   shr  ax,4  ;1 ok
33
   mov dword [edi],eax
33
   mov  dword [edi],eax
34
   add  edi,4
-
 
35
   mov dword [edi],ebx
34
   mov  dword [edi+4],ebx
36
   add  edi,4
-
 
37
   mov dword [edi],ecx
35
   mov  dword [edi+8],ecx
38
   add  edi,4
-
 
39
   mov dword [edi],edx
36
   mov  dword [edi+12],edx
40
   add  edi,4   
37
   add  edi,16
41
   add  esi,12
38
   add  esi,12
Line 42... Line 39...
42
 
39
 
43
   cmp  edi,0x280000+2856*2   ;2849 clusters
40
   cmp  edi,0x280000+2856*2   ;2849 clusters
Line 62... Line 59...
62
   shl  bx,4
59
   shl  bx,4
63
   shr  ebx,4
60
   shr  ebx,4
64
   shrd eax,ebx,8
61
   shrd eax,ebx,8
65
   shr  ebx,8
62
   shr  ebx,8
66
   mov dword [edi],eax
63
   mov  dword [edi],eax
67
   add  edi,4
-
 
68
   mov word [edi],bx
64
   mov  word [edi+4],bx
69
   add  edi,2
65
   add  edi,6
70
   add  esi,8
66
   add  esi,8
Line 71... Line 67...
71
 
67
 
72
   cmp  edi,0x100000+512+4278     ;4274 bytes - all used FAT
68
   cmp  edi,0x100000+512+4278     ;4274 bytes - all used FAT
Line 98... Line 94...
98
        cld
94
        cld
99
    rdfs1:
95
    rdfs1:
100
        repne scasw
96
        repne scasw
101
        jnz  rdfs2    ;if last cluster not 0
97
        jnz  rdfs2    ;if last cluster not 0
102
        inc  ebx
98
        inc  ebx
103
        jcxz rdfs2    ;if last cluster=0
99
        test    ecx, ecx
104
        jmp  rdfs1    ;if not last
100
        jnz     rdfs1
105
    rdfs2:
101
    rdfs2:
106
        shl  ebx,9    ;free clusters*512
102
        shl  ebx,9    ;free clusters*512
107
        mov  edi,ebx
103
        mov  edi,ebx
Line 108... Line 104...
108
        
104
        
Line 436... Line 432...
436
        mov    eax,[esp+12]
432
        mov    eax,[esp+12]
437
        cmp    eax,512
433
        cmp    eax,512
438
        jbe    flnsa
434
        jbe    flnsa
439
        sub    eax,512
435
        sub    eax,512
440
        mov    [esp+12],eax
436
        mov    [esp+12],eax
441
        mov    eax,[esp+16]
-
 
442
        add    eax,512
-
 
443
        mov    [esp+16],eax
437
        add     dword [esp+16], 512
444
        jmp    frnewds
438
        jmp    frnewds
Line 445... Line 439...
445
 
439
 
446
     flnsa:
-
 
447
        dec    edi
-
 
448
        dec    edi
440
     flnsa:
Line 449... Line 441...
449
        mov    [edi],word 4095          ; mark end of file - last cluster
441
        mov    [edi-2],word 4095          ; mark end of file - last cluster
Line 450... Line 442...
450
 
442
 
451
      frnoreadds:
443
      frnoreadds:
Line 642... Line 634...
642
	cmp	byte [edi+11], 0xF
634
	cmp	byte [edi+11], 0xF
643
	jz	.longname
635
	jz	.longname
644
	push	ecx
636
	push	ecx
645
	mov	ecx, 8
637
	mov	ecx, 8
646
        push	edi ebp ecx
638
        push	edi ebp ecx
647
        cmp     byte [ebp-4], 0
639
        test    byte [ebp-4], 1
648
        jnz     .unicode_short
640
        jnz     .unicode_short
649
@@:
641
@@:
650
	mov	al, [edi]
642
	mov	al, [edi]
651
	inc	edi
643
	inc	edi
652
	mov	[ebp], al
644
	mov	[ebp], al
Line 761... Line 753...
761
; if this is not first entry, more processing required
753
; if this is not first entry, more processing required
762
	stc
754
	stc
763
	ret
755
	ret
764
@@:
756
@@:
765
; if this is first entry:
757
; if this is first entry:
766
        cmp     byte [ebp-4], 0
758
        test    byte [ebp-4], 1
767
        jnz     .ret
759
        jnz     .ret
768
; buffer at ebp contains UNICODE name, convert it to ANSI
760
; buffer at ebp contains UNICODE name, convert it to ANSI
769
	push	esi edi
761
	push	esi edi
770
	mov	esi, ebp
762
	mov	esi, ebp
771
	mov	edi, ebp
763
	mov	edi, ebp
Line 870... Line 862...
870
        xor     eax, eax
862
        xor     eax, eax
871
        mov     [esi+36], eax	; file size (high dword)
863
        mov     [esi+36], eax	; file size (high dword)
872
        push    ecx edi
864
        push    ecx edi
873
        lea     edi, [esi+40]
865
        lea     edi, [esi+40]
874
        mov     esi, ebp
866
        mov     esi, ebp
-
 
867
        test    byte [esi-4], 1
-
 
868
        jz      .ansi
875
        mov     ecx, 259/2
869
        mov     ecx, 260/2
876
        rep     movsd
870
        rep     movsd
877
        movsw
871
        mov     [edi-2], ax
878
        stosw
872
@@:
879
        mov     esi, edi
873
        mov     esi, edi
880
        pop     edi ecx
874
        pop     edi ecx
881
        ret
875
        ret
-
 
876
.ansi:
-
 
877
        mov     ecx, 264/4
-
 
878
        rep     movsd
-
 
879
        mov     [edi-1], al
-
 
880
        jmp     @b
Line 882... Line 881...
882
 
881
 
883
rd_find_lfn:
882
rd_find_lfn:
884
; in: esi->name
883
; in: esi->name
885
; out: CF=1 - file not found
884
; out: CF=1 - file not found
Line 1011... Line 1010...
1011
;----------------------------------------------------------------
1010
;----------------------------------------------------------------
1012
;
1011
;
1013
;  fs_RamdiskReadFolder - LFN variant for reading sys floppy folder
1012
;  fs_RamdiskReadFolder - LFN variant for reading sys floppy folder
1014
;
1013
;
1015
;  esi  points to filename; only root is folder on ramdisk
1014
;  esi  points to filename; only root is folder on ramdisk
1016
;  ebx  pointer to 32-bit number = first wanted block
1015
;  ebx  pointer to structure 32-bit number = first wanted block
-
 
1016
;                          & flags (bitfields)
-
 
1017
; flags: bit 0: 0=ANSI names, 1=UNICODE names
1017
;  ecx  number of blocks to read, 0+
1018
;  ecx  number of blocks to read, 0+
1018
;  edx  mem location to return data
1019
;  edx  mem location to return data
1019
;
1020
;
1020
;  ret ebx = size or 0xffffffff file not found
1021
;  ret ebx = size or 0xffffffff file not found
1021
;      eax = 0 ok read or other = errormsg
1022
;      eax = 0 ok read or other = errormsg
1022
;
1023
;
1023
;--------------------------------------------------------------
1024
;--------------------------------------------------------------
1024
fs_RamdiskReadFolder:
1025
fs_RamdiskReadFolder:
1025
        mov     ebx, [ebx]
-
 
1026
        cmp     byte [esi], 0
1026
        cmp     byte [esi], 0
1027
        jz      @f
1027
        jz      @f
1028
; ramdisk doesn't support folders
1028
; ramdisk doesn't support folders
1029
        mov     eax, ERROR_ACCESS_DENIED
1029
        mov     eax, ERROR_ACCESS_DENIED
1030
        or      ebx, -1
1030
        or      ebx, -1
Line 1040... Line 1040...
1040
        mov     byte [edx], 1   ; version
1040
        mov     byte [edx], 1   ; version
1041
        pop     ecx
1041
        pop     ecx
1042
        push    ebp
1042
        push    ebp
1043
        sub     esp, 262*2      ; allocate space for LFN
1043
        sub     esp, 262*2      ; allocate space for LFN
1044
        mov     ebp, esp
1044
        mov     ebp, esp
1045
        push    1               ; for fat_get_name: read UNICODE name
1045
        push    dword [ebx+4]   ; for fat_get_name: read ANSI/UNICODE name
-
 
1046
        mov     ebx, [ebx]
1046
; read root
1047
; read root
1047
        mov     esi, edi        ; esi points to block of data of folder entry (BDFE)
1048
        mov     esi, edi        ; esi points to block of data of folder entry (BDFE)
1048
        mov     edi, 0x100000+512*19
1049
        mov     edi, 0x100000+512*19
1049
.l1:
1050
.l1:
1050
        call    fat_get_name
1051
        call    fat_get_name