Subversion Repositories Kolibri OS

Rev

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

Rev 593 Rev 649
Line 42... Line 42...
42
;;  20.5.2002  Hd status check - VT                                ;;
42
;;  20.5.2002  Hd status check - VT                                ;;
43
;;  29.6.2002  Improved fat32 verification - VT                    ;;
43
;;  29.6.2002  Improved fat32 verification - VT                    ;;
44
;;                                                                 ;;
44
;;                                                                 ;;
45
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
45
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 46... Line 46...
46
 
46
 
Line 47... Line 47...
47
$Revision: 593 $
47
$Revision: 649 $
Line 48... Line 48...
48
 
48
 
Line 291... Line 291...
291
    ret
291
    ret
Line 292... Line 292...
292
 
292
 
293
 
293
 
294
get_free_FAT:
-
 
295
;-----------------------------------------------------------
294
get_free_FAT:
296
; input  : EAX = # cluster for start the searching
295
;-----------------------------------------------------------
297
; output : if CARRY=0 EAX = # first cluster found free
296
; output : if CARRY=0 EAX = # first cluster found free
298
;          if CARRY=1 disk full
297
;          if CARRY=1 disk full
299
; Note   : for more speed need to use fat_cache directly
298
; Note   : for more speed need to use fat_cache directly
300
;-----------------------------------------------------------
299
;-----------------------------------------------------------
301
    push  ecx
300
    push  ecx
-
 
301
    mov   ecx,[LAST_CLUSTER]    ; counter for full disk
-
 
302
    sub   ecx,2
-
 
303
    mov   eax,[fatStartScan]
Line 302... Line 304...
302
    mov   ecx,[LAST_CLUSTER]    ; counter for full disk
304
    cmp   eax,2
303
    sub   ecx,2
305
    jb    gff_reset
304
 
306
 
-
 
307
  gff_test:
305
  gff_test:
308
    cmp   eax,[LAST_CLUSTER]    ; if above last cluster start at cluster 2
Line 306... Line 309...
306
    cmp   eax,[LAST_CLUSTER]    ; if above last cluster start at cluster 2
309
    jbe   gff_in_range
307
    jbe   gff_in_range
310
  gff_reset:
308
    mov   eax,2
311
    mov   eax,2
Line 326... Line 329...
326
    pop   ecx                   ; yes. disk is full
329
    pop   ecx                   ; yes. disk is full
327
    stc
330
    stc
328
    ret
331
    ret
Line 329... Line 332...
329
 
332
 
-
 
333
  gff_found:
-
 
334
    lea   ecx,[eax+1]
330
  gff_found:
335
    mov   [fatStartScan],ecx
331
    pop   ecx
336
    pop   ecx
332
    clc
337
    clc
Line 669... Line 674...
669
 
674
 
670
    cmp   dword [ebx+0x1fc],0xaa550000 ; check sector id
675
    cmp   dword [ebx+0x1fc],0xaa550000 ; check sector id
Line 671... Line 676...
671
    jne   add_not_fs
676
    jne   add_not_fs
-
 
677
 
-
 
678
    add   [ebx+0x1e8],ecx
672
 
679
    mov   eax,[fatStartScan]
673
    add   [ebx+0x1e8],ecx
680
    mov   [ebx+0x1ec],eax
674
    call  hd_write
681
    call  hd_write
Line 675... Line 682...
675
;    cmp   [hd_error],0
682
;    cmp   [hd_error],0
Line 1476... Line 1483...
1476
        call    fat_notroot_end_write
1483
        call    fat_notroot_end_write
1477
        pop     eax
1484
        pop     eax
1478
        jmp     fat_notroot_next_sector
1485
        jmp     fat_notroot_next_sector
1479
fat_notroot_extend_dir:
1486
fat_notroot_extend_dir:
1480
        push    eax
1487
        push    eax
1481
        mov     eax, [eax]
-
 
1482
        call    get_free_FAT
1488
        call    get_free_FAT
1483
        jnc     .found
1489
        jnc     .found
1484
        pop     eax
1490
        pop     eax
1485
        ret     ; CF=1
1491
        ret     ; CF=1
1486
.found:
1492
.found:
Line 1939... Line 1945...
1939
        push    ecx
1945
        push    ecx
1940
        push    edi
1946
        push    edi
1941
        mov     esi, edx
1947
        mov     esi, edx
1942
        test    ecx, ecx
1948
        test    ecx, ecx
1943
        jz      .done
1949
        jz      .done
1944
        mov     eax, 2
-
 
1945
        call    get_free_FAT
1950
        call    get_free_FAT
1946
        jc      .diskfull
1951
        jc      .diskfull
1947
        push    eax
1952
        push    eax
1948
        mov     [edi+26], ax
1953
        mov     [edi+26], ax
1949
        shr     eax, 16
1954
        shr     eax, 16
Line 2390... Line 2395...
2390
.extend_loop:
2395
.extend_loop:
2391
        cmp     [edi+28], ecx
2396
        cmp     [edi+28], ecx
2392
        jae     .extend_done
2397
        jae     .extend_done
2393
; add new cluster
2398
; add new cluster
2394
        push    eax
2399
        push    eax
2395
        mov     eax, edx
-
 
2396
        call    get_free_FAT
2400
        call    get_free_FAT
2397
        jc      .disk_full
2401
        jc      .disk_full
2398
        mov     edx, [fatEND]
2402
        mov     edx, [fatEND]
2399
        call    set_FAT
2403
        call    set_FAT
2400
        mov     edx, eax
2404
        mov     edx, eax