Subversion Repositories Kolibri OS

Rev

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

Rev 6468 Rev 6471
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
4
;;  Distributed under terms of the GNU General Public License.  ;;
4
;;  Distributed under terms of the GNU General Public License.  ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 6468 $
8
$Revision: 6471 $
9
 
9
 
10
; FAT external functions
10
; FAT external functions
11
;   in:
11
;   in:
12
; ebx -> parameter structure of sysfunc 70
12
; ebx -> parameter structure of sysfunc 70
13
; ebp -> FAT structure
13
; ebp -> FAT structure
14
; esi -> path string
14
; esi -> path string in UTF-8
15
;   out:
15
;   out:
16
; eax, ebx = return values for sysfunc 70
16
; eax, ebx = return values for sysfunc 70
17
iglobal
17
iglobal
Line 443... Line 443...
443
;               p q r s t u v w x y z { | } ~
443
;               p q r s t u v w x y z { | } ~
444
        db      3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,0
444
        db      3,3,3,3,3,3,3,3,3,3,3,3,0,3,3,0
445
endg
445
endg
Line 446... Line 446...
446
 
446
 
447
fat_name_is_legal:
447
fat_name_is_legal:
448
; in: esi->(long) name
448
; in: esi -> UTF-8 name
449
; out: CF set <=> legal
-
 
450
; destroys eax
449
; out: CF=1 -> legal
451
        push    esi
450
        push    esi
452
        xor     eax, eax
451
        xor     eax, eax
453
@@:
452
@@:
454
        lodsb
453
        lodsb
455
        test    al, al
-
 
456
        jz      .done
-
 
457
        cmp     al, 80h
454
        test    al, al
458
        jae     .big
455
        js      @b
459
        test    [fat_legal_chars+eax], 1
456
        test    [fat_legal_chars+eax], 1
460
        jnz     @b
-
 
461
.err:
-
 
462
        pop     esi
-
 
463
        clc
-
 
464
        ret
-
 
465
.big:
-
 
466
; 0x80-0xAF, 0xE0-0xEF
457
        jnz     @b
467
        cmp     al, 0xB0
458
        test    al, al
468
        jb      @b
-
 
469
        cmp     al, 0xE0
-
 
470
        jb      .err
-
 
471
        cmp     al, 0xF0
459
        jnz     @f
472
        jb      @b
-
 
473
        jmp     .err
460
        stc
474
.done:
-
 
475
        sub     esi, [esp]
-
 
476
        cmp     esi, 257
461
@@:
477
        pop     esi
462
        pop     esi
Line 478... Line 463...
478
        ret
463
        ret
479
 
464
 
Line 565... Line 550...
565
        popad
550
        popad
566
        stc
551
        stc
567
        ret
552
        ret
Line 568... Line 553...
568
 
553
 
-
 
554
fat_gen_short_name:
569
fat_gen_short_name:
555
;   in:
570
; in: esi->long name
556
; esi -> UTF-8 name
571
;     edi->buffer (8+3=11 chars)
-
 
572
; out: buffer filled
557
; edi -> buffer (8+3=11 chars)
573
        pushad
558
        pushad
574
        mov     eax, '    '
559
        mov     eax, '    '
575
        push    edi
560
        push    edi
576
        stosd
561
        stosd
Line 581... Line 566...
581
        movi    ebx, 8
566
        movi    ebx, 8
582
        lea     ecx, [edi+8]
567
        lea     ecx, [edi+8]
583
.loop:
568
.loop:
584
        lodsb
569
        lodsb
585
        test    al, al
570
        test    al, al
-
 
571
        js      .space
586
        jz      .done
572
        jz      .done
587
        call    char_toupper
-
 
588
        cmp     al, ' '
-
 
589
        jz      .space
-
 
590
        cmp     al, 80h
-
 
591
        ja      .big
-
 
592
        test    [fat_legal_chars+eax], 2
573
        test    [fat_legal_chars+eax], 2
593
        jnz     .symbol
574
        jz      .space
594
.inv_symbol:
-
 
595
        mov     al, '_'
-
 
596
        or      bh, 1
-
 
597
.symbol:
-
 
598
        cmp     al, '.'
575
        cmp     al, '.'
599
        jz      .dot
576
        jz      .dot
600
.normal_symbol:
-
 
601
        dec     bl
577
        dec     bl
602
        jns     .store
578
        jns     .store
603
        mov     bl, 0
579
        inc     bl
604
.space:
580
.space:
605
        or      bh, 1
581
        or      bh, 1
606
        jmp     .loop
582
        jmp     .loop
-
 
583
 
607
.store:
584
.store:
-
 
585
        call    cp866toUpper
608
        stosb
586
        stosb
609
        jmp     .loop
587
        jmp     .loop
610
.big:
588
 
611
        cmp     al, 0xB0
-
 
612
        jb      .normal_symbol
-
 
613
        cmp     al, 0xE0
-
 
614
        jb      .inv_symbol
-
 
615
        cmp     al, 0xF0
-
 
616
        jb      .normal_symbol
-
 
617
        jmp     .inv_symbol
-
 
618
.dot:
589
.dot:
619
        test    bh, 2
590
        test    bh, 2
620
        jz      .firstdot
591
        jz      .firstdot
621
        pop     ebx
592
        pop     ebx
622
        add     ebx, edi
593
        add     ebx, edi
Line 1185... Line 1156...
1185
        jmp     mutex_lock
1156
        jmp     mutex_lock
1186
fat_unlock:
1157
fat_unlock:
1187
        lea     ecx, [ebp+FAT.Lock]
1158
        lea     ecx, [ebp+FAT.Lock]
1188
        jmp     mutex_unlock
1159
        jmp     mutex_unlock
Line 1189... Line -...
1189
 
-
 
1190
 
1160
 
1191
fat_get_name:
1161
fat_get_name:
1192
; in: edi->FAT entry
1162
; in: edi -> FAT entry
1193
; out: CF=1 - no valid entry
-
 
1194
; else CF=0 and ebp->ASCIIZ-name
-
 
1195
; (maximum length of filename is 255 (wide) symbols without trailing 0,
-
 
1196
;  but implementation requires buffer 261 words)
-
 
1197
; destroys eax
1163
; out: ebp -> UTF-16 name, CF=1 -> no valid entry
1198
        cmp     byte [edi], 0
1164
        cmp     byte [edi], 0
1199
        jz      .no
1165
        jz      .no
1200
        cmp     byte [edi], 0xE5
1166
        cmp     byte [edi], 0xE5
1201
        jnz     @f
-
 
1202
.no:
-
 
1203
        stc
-
 
1204
        ret
-
 
1205
@@:
1167
        jz      .no
1206
        cmp     byte [edi+11], 0xF
1168
        cmp     byte [edi+11], 0xF
1207
        jz      .longname
1169
        jz      .longname
1208
        test    byte [edi+11], 8
1170
        test    byte [edi+11], 8
1209
        jnz     .no
-
 
1210
        push    ecx
1171
        jnz     .no
1211
        push    edi ebp
-
 
1212
        test    byte [ebp-4], 1
-
 
1213
        jnz     .unicode_short
-
 
1214
 
1172
        push    ecx esi edi
1215
        mov     eax, [edi]
-
 
1216
        mov     ecx, [edi+4]
-
 
1217
        mov     [ebp], eax
-
 
1218
        mov     [ebp+4], ecx
-
 
1219
 
-
 
1220
        mov     ecx, 8
-
 
1221
@@:
-
 
1222
        cmp     byte [ebp+ecx-1], ' '
-
 
1223
        loope   @b
-
 
1224
 
-
 
1225
        mov     eax, [edi+8]
-
 
1226
        cmp     al, ' '
-
 
1227
        je      .done
-
 
1228
        shl     eax, 8
-
 
1229
        mov     al, '.'
-
 
1230
 
-
 
1231
        lea     ebp, [ebp+ecx+1]
-
 
1232
        mov     [ebp], eax
1173
        mov     esi, edi
1233
        mov     ecx, 3
-
 
1234
@@:
-
 
1235
        rol     eax, 8
-
 
1236
        cmp     al, ' '
-
 
1237
        jne     .done
-
 
1238
        loop    @b
-
 
1239
        dec     ebp
-
 
1240
.done:
-
 
1241
        and     byte [ebp+ecx+1], 0   ; CF=0
-
 
1242
        pop     ebp edi ecx
-
 
1243
        ret
-
 
1244
.unicode_short:
1174
        mov     edi, ebp
1245
        mov     ecx, 8
-
 
1246
        push    ecx
1175
        mov     ecx, 8
1247
@@:
-
 
1248
        mov     al, [edi]
1176
@@:
1249
        inc     edi
1177
        lodsb
1250
        call    ansi2uni_char
-
 
1251
        mov     [ebp], ax
-
 
1252
        inc     ebp
1178
        call    ansi2uni_char
1253
        inc     ebp
1179
        stosw
1254
        loop    @b
1180
        loop    @b
1255
        pop     ecx
1181
        mov     cl, 8
1256
@@:
1182
@@:
1257
        cmp     word [ebp-2], ' '
1183
        cmp     word [edi-2], ' '
1258
        jnz     @f
-
 
1259
        dec     ebp
1184
        jnz     @f
1260
        dec     ebp
1185
        sub     edi, 2
1261
        loop    @b
1186
        loop    @b
1262
@@:
1187
@@:
1263
        mov     word [ebp], '.'
-
 
1264
        inc     ebp
1188
        mov     word [edi], '.'
1265
        inc     ebp
1189
        add     edi, 2
1266
        mov     ecx, 3
-
 
1267
        push    ecx
1190
        mov     cl, 3
1268
@@:
-
 
1269
        mov     al, [edi]
1191
@@:
1270
        inc     edi
1192
        lodsb
1271
        call    ansi2uni_char
-
 
1272
        mov     [ebp], ax
-
 
1273
        inc     ebp
1193
        call    ansi2uni_char
1274
        inc     ebp
1194
        stosw
1275
        loop    @b
1195
        loop    @b
1276
        pop     ecx
1196
        mov     cl, 3
1277
@@:
1197
@@:
1278
        cmp     word [ebp-2], ' '
1198
        cmp     word [edi-2], ' '
1279
        jnz     @f
-
 
1280
        dec     ebp
1199
        jnz     @f
1281
        dec     ebp
1200
        sub     edi, 2
1282
        loop    @b
-
 
1283
        dec     ebp
1201
        loop    @b
1284
        dec     ebp
1202
        sub     edi, 2
1285
@@:
1203
@@:
1286
        and     word [ebp], 0   ; CF=0
1204
        and     word [edi], 0   ; CF=0
-
 
1205
        pop     edi esi ecx
-
 
1206
        ret
-
 
1207
 
-
 
1208
.no:
1287
        pop     ebp edi ecx
1209
        stc
-
 
1210
        ret
1288
        ret
1211
 
1289
.longname:
-
 
1290
; LFN
1212
.longname:
1291
        mov     al, byte [edi]
1213
        mov     al, byte [edi]
1292
        and     eax, 0x3F
1214
        and     eax, 0x3F
1293
        dec     eax
1215
        dec     eax
1294
        cmp     al, 20
1216
        cmp     al, 20
1295
        jae     .no     ; ignore invalid entries
1217
        jae     .no     ; ignore invalid entries
1296
        mov     word [ebp+260*2], 0     ; force null-terminating for orphans
1218
        mov     word [ebp+260*2], 0     ; force null-terminating for orphans
1297
        imul    eax, 13*2
-
 
1298
        add     ebp, eax
1219
        imul    eax, 13*2
1299
        test    byte [edi], 0x40
1220
        test    byte [edi], 0x40
1300
        jz      @f
1221
        jz      @f
1301
        mov     word [ebp+13*2], 0
-
 
1302
@@:
-
 
1303
        push    eax
1222
        mov     word [ebp+eax+13*2], 0
1304
; now copy name from edi to ebp ...
-
 
1305
        mov     eax, [edi+1]
-
 
1306
        mov     [ebp], eax      ; symbols 1,2
-
 
1307
        mov     eax, [edi+5]
-
 
1308
        mov     [ebp+4], eax    ; 3,4
-
 
1309
        mov     eax, [edi+9]
-
 
1310
        mov     [ebp+8], ax     ; 5
-
 
1311
        mov     eax, [edi+14]
-
 
1312
        mov     [ebp+10], eax   ; 6,7
-
 
1313
        mov     eax, [edi+18]
-
 
1314
        mov     [ebp+14], eax   ; 8,9
-
 
1315
        mov     eax, [edi+22]
-
 
1316
        mov     [ebp+18], eax   ; 10,11
-
 
1317
        mov     eax, [edi+28]
-
 
1318
        mov     [ebp+22], eax   ; 12,13
-
 
1319
; ... done
-
 
1320
        pop     eax
-
 
1321
        sub     ebp, eax
-
 
1322
        test    eax, eax
-
 
1323
        jz      @f
-
 
1324
; if this is not first entry, more processing required
-
 
1325
        stc
-
 
1326
        ret
-
 
1327
@@:
-
 
1328
; if this is first entry:
-
 
1329
        test    byte [ebp-4], 1
-
 
1330
        jnz     .ret
-
 
1331
; buffer at ebp contains UNICODE name, convert it to ANSI
1223
@@: ; copy name (13 chars in UTF-16)
1332
        push    esi edi
1224
        push    esi edi
-
 
1225
        lea     esi, [edi+1]
-
 
1226
        lea     edi, [ebp+eax]
-
 
1227
        movsd
-
 
1228
        movsd
-
 
1229
        movsd
1333
        mov     esi, ebp
1230
        inc     esi
-
 
1231
        sub     edi, 2
-
 
1232
        movsd
-
 
1233
        movsd
1334
        mov     edi, ebp
1234
        movsd
-
 
1235
        add     esi, 2
1335
        call    uni2ansi_str
1236
        movsd
1336
        pop     edi esi
-
 
1337
.ret:
1237
        pop     edi esi
-
 
1238
        test    eax, eax
1338
        clc
1239
        jnz     .no ; if this is not first entry, more processing required
Line 1339... Line 1240...
1339
        ret
1240
        ret
1340
 
1241
 
1341
fat_compare_name:
1242
fat_compare_name:
1342
; compares ASCIIZ-names, case-insensitive (cp866 encoding)
1243
; in: esi -> name in UTF-8, ebp -> name in UTF-16
1343
; in: esi->name, ebp->name
1244
;   out:
1344
; out: if names match: ZF=1 and esi->next component of name
-
 
1345
;      else: ZF=0, esi is not changed
1245
; ZF=1 -> names match, esi -> next component of name
1346
; destroys eax
1246
; ZF=0 -> esi is not changed
1347
        push    ebp esi
1247
        push    ebp esi
1348
.loop:
-
 
1349
        mov     al, [ebp]
1248
@@:
1350
        inc     ebp
1249
        call    utf8to16
1351
        call    char_toupper
1250
        call    utf16toUpper
1352
        push    eax
1251
        mov     edx, eax
1353
        lodsb
1252
        mov     ax, [ebp]
1354
        call    char_toupper
1253
        call    utf16toUpper
1355
        cmp     al, [esp]
1254
        cmp     ax, dx
1356
        jnz     .done
1255
        jnz     .done
1357
        pop     eax
1256
        add     ebp, 2
1358
        test    al, al
1257
        test    ax, ax
1359
        jnz     .loop
-
 
1360
        dec     esi
1258
        jnz     @b
1361
        pop     eax
1259
        dec     esi
1362
        pop     ebp
1260
        pop     eax ebp
-
 
1261
        xor     eax, eax    ; set ZF
1363
        xor     eax, eax        ; set ZF flag
1262
        ret
1364
        ret
1263
 
1365
.done:
1264
.done:
1366
        cmp     al, '/'
1265
        cmp     dx, '/'
1367
        jnz     @f
1266
        jnz     @f
1368
        cmp     byte [esp], 0
1267
        test    ax, ax
1369
        jnz     @f
1268
        jnz     @f
1370
        mov     [esp+4], esi
-
 
1371
@@:
1269
        mov     [esp], esi
1372
        pop     eax
1270
@@:
Line 1373... Line 1271...
1373
        pop     esi ebp
1271
        pop     esi ebp
1374
        ret
1272
        ret
1375
 
1273
 
1376
fat_find_lfn:
1274
fat_find_lfn:
1377
; in: esi->name
1275
; in: esi -> name in UTF-8
1378
;     [esp+4] = next
1276
;     [esp+4] = next
1379
;     [esp+8] = first
1277
;     [esp+8] = first
1380
;     [esp+C]... - possibly parameters for first and next
1278
;     [esp+C]... - possibly parameters for first and next
1381
; out: CF=1 - file not found, eax=error code
1279
; out: CF=1 - file not found, eax=error code
1382
;      else CF=0, esi->next name component, edi->direntry
1280
;      else CF=0, esi->next name component, edi->direntry
1383
        pusha
1281
        pusha
1384
        lea     eax, [esp+0Ch+20h]
1282
        lea     eax, [esp+0Ch+20h]
1385
        call    dword [eax-4]
-
 
1386
        jc      .reterr
1283
        call    dword [eax-4]
1387
        sub     esp, 262*2      ; reserve place for LFN
1284
        jc      .reterr
1388
        push    0               ; for fat_get_name: read ASCII name
1285
        sub     esp, 262*2      ; reserve place for LFN
1389
.l1:
1286
.l1:
1390
        lea     ebp, [esp+4]
1287
        lea     ebp, [esp]
1391
        call    fat_get_name
1288
        call    fat_get_name
1392
        jc      .l2
1289
        jc      .l2
1393
        call    fat_compare_name
1290
        call    fat_compare_name
1394
        jz      .found
1291
        jz      .found
1395
.l2:
1292
.l2:
1396
        mov     ebp, [esp+8+262*2+4]
1293
        mov     ebp, [esp+8+262*2]
1397
        lea     eax, [esp+0Ch+20h+262*2+4]
1294
        lea     eax, [esp+0Ch+20h+262*2]
1398
        call    dword [eax-8]
1295
        call    dword [eax-8]
1399
        jnc     .l1
1296
        jnc     .l1
1400
        add     esp, 262*2+4
1297
        add     esp, 262*2
1401
.reterr:
1298
.reterr:
1402
        mov     [esp+28], eax
1299
        mov     [esp+28], eax
-
 
1300
        stc
1403
        stc
1301
        popa
1404
        popa
1302
        ret
1405
        ret
1303
 
1406
.found:
1304
.found:
1407
        add     esp, 262*2+4
1305
        add     esp, 262*2
1408
        mov     ebp, [esp+8]
1306
        mov     ebp, [esp+8]
1409
; if this is LFN entry, advance to true entry
1307
; if this is LFN entry, advance to true entry
Line 1479... Line 1377...
1479
        pop     edx
1377
        pop     edx
1480
        ret
1378
        ret
Line 1481... Line 1379...
1481
 
1379
 
1482
fat_entry_to_bdfe:
1380
fat_entry_to_bdfe:
1483
; convert FAT entry at edi to BDFE (block of data of folder entry) at esi, advance esi
-
 
1484
; destroys eax
1381
; convert FAT entry at edi to BDFE (block of data of folder entry) at esi, advance esi
1485
        mov     eax, [ebp-4]
1382
        mov     eax, [ebp-4]
1486
        mov     [esi+4], eax    ; ASCII/UNICODE name
1383
        mov     [esi+4], eax    ; cp866/UNICODE name
1487
fat_entry_to_bdfe2:
1384
fat_entry_to_bdfe2:
1488
        movzx   eax, byte [edi+11]
1385
        movzx   eax, byte [edi+11]
1489
        mov     [esi], eax      ; attributes
1386
        mov     [esi], eax      ; attributes
1490
        movzx   eax, word [edi+14]
1387
        movzx   eax, word [edi+14]
Line 1510... Line 1407...
1510
        test    ebp, ebp
1407
        test    ebp, ebp
1511
        jz      .ret
1408
        jz      .ret
1512
        push    ecx edi
1409
        push    ecx edi
1513
        lea     edi, [esi+40]
1410
        lea     edi, [esi+40]
1514
        mov     esi, ebp
1411
        mov     esi, ebp
-
 
1412
        mov     ecx, 263
1515
        test    byte [esi-4], 1
1413
        test    byte [esi-4], 1
1516
        jz      .ansi
1414
        jz      .ansi
1517
        mov     ecx, 260/2
1415
        mov     ecx, 260/2
1518
        rep movsd
1416
        rep movsd
1519
        mov     [edi-2], ax
1417
        mov     [edi-2], ax
1520
@@:
1418
@@:
1521
        mov     esi, edi
1419
        mov     esi, edi
1522
        pop     edi ecx
1420
        pop     edi ecx
1523
.ret:
1421
.ret:
1524
        ret
1422
        ret
-
 
1423
 
1525
.ansi:
1424
.ansi:
-
 
1425
        lodsw
1526
        mov     ecx, 264/4
1426
        call    uni2ansi_char
1527
        rep movsd
1427
        stosb
-
 
1428
        loop    .ansi
1528
        mov     [edi-1], al
1429
        xor     eax, eax
-
 
1430
        stosb
1529
        jmp     @b
1431
        jmp     @b
Line 1530... Line 1432...
1530
 
1432
 
1531
bdfe_to_fat_entry:
1433
bdfe_to_fat_entry:
1532
; convert BDFE at edx to FAT entry at edi
1434
; convert BDFE at edx to FAT entry at edi
Line 1555... Line 1457...
1555
        call    bdfe_to_fat_date
1457
        call    bdfe_to_fat_date
1556
        mov     [edi+24], ax            ; last write date
1458
        mov     [edi+24], ax            ; last write date
1557
        ret
1459
        ret
Line 1558... Line 1460...
1558
 
1460
 
1559
hd_find_lfn:
1461
hd_find_lfn:
1560
; in: esi -> path string
1462
; in: esi -> path string in UTF-8
1561
; out: CF=1 - file not found, eax=error code
1463
; out: CF=1 - file not found, eax=error code
1562
;      else CF=0 and edi->direntry, eax=sector
1464
;      else CF=0 and edi->direntry, eax=sector
1563
        push    esi edi
1465
        push    esi edi
1564
        push    0
1466
        push    0
Line 1823... Line 1725...
1823
        mov     eax, [edi+20-2]
1725
        mov     eax, [edi+20-2]
1824
        mov     ax, [edi+26]    ; eax=cluster
1726
        mov     ax, [edi+26]    ; eax=cluster
1825
.doit:
1727
.doit:
1826
        push    esi
1728
        push    esi
1827
        sub     esp, 262*2      ; reserve space for LFN
1729
        sub     esp, 262*2      ; reserve space for LFN
1828
        push    dword [ebx+8]   ; for fat_get_name: read ANSI/UNICODE name
1730
        push    dword [ebx+8]   ; cp866/UNICODE name
1829
        mov     edx, [ebx+16]   ; pointer to buffer
1731
        mov     edx, [ebx+16]   ; pointer to buffer
1830
; init header
1732
; init header
1831
        push    eax
1733
        push    eax
1832
        mov     edi, edx
1734
        mov     edi, edx
1833
        mov     ecx, 32/4
1735
        mov     ecx, 32/4
Line 2384... Line 2286...
2384
        mov     ecx, 8
2286
        mov     ecx, 8
2385
        repnz scasb
2287
        repnz scasb
2386
        movi    eax, 1     ; 1 entry
2288
        movi    eax, 1     ; 1 entry
2387
        jnz     .notilde
2289
        jnz     .notilde
2388
; we need ceil(strlen(esi)/13) additional entries = floor((strlen(esi)+12+13)/13) total
2290
; we need ceil(strlen(esi)/13) additional entries = floor((strlen(esi)+12+13)/13) total
2389
        xor     eax, eax
2291
        xor     ecx, ecx
2390
@@:
-
 
2391
        cmp     byte [esi], 0
-
 
2392
        jz      @f
-
 
2393
        inc     esi
2292
        push    esi
2394
        inc     eax
-
 
2395
        jmp     @b
-
 
2396
 
-
 
2397
@@:
2293
@@:
-
 
2294
        call    utf8to16
-
 
2295
        inc     ecx
-
 
2296
        test    ax, ax
-
 
2297
        jnz     @b
-
 
2298
        pop     esi
2398
        sub     esi, eax
2299
        mov     eax, ecx
2399
        add     eax, 12+13
2300
        add     eax, 12+13-1
2400
        mov     ecx, 13
2301
        mov     ecx, 13
2401
        push    edx
-
 
2402
        cdq
2302
        cdq
2403
        div     ecx
2303
        div     ecx
2404
        pop     edx
-
 
2405
.notilde:
2304
.notilde:
2406
        push    -1
2305
        push    -1
2407
        push    -1
2306
        push    -1
2408
        push    -1
2307
        push    -1
2409
; find  successive entries in directory
2308
; find  successive entries in directory
Line 2488... Line 2387...
2488
@@:
2387
@@:
2489
        ror     al, 1
2388
        ror     al, 1
2490
        add     al, [esi]
2389
        add     al, [esi]
2491
        inc     esi
2390
        inc     esi
2492
        loop    @b
2391
        loop    @b
2493
        pop     ecx esi
2392
        pop     ecx esi edi
2494
        pop     edi
-
 
2495
        pop     dword [esp+8+12+12]
2393
        pop     dword [esp+8+12+12]
2496
        pop     dword [esp+8+12+12]
2394
        pop     dword [esp+8+12+12]
2497
; edi points to first entry in free chunk
2395
; edi points to first entry in free chunk
2498
        dec     ecx
2396
        dec     ecx
2499
        jz      .nolfn
2397
        jz      .nolfn
2500
        push    esi
-
 
2501
        push    eax
2398
        push    esi eax
2502
        lea     eax, [esp+8+8+12+8]
2399
        lea     eax, [esp+8+8+12+8]
2503
        call    dword [eax+8]         ; begin write
2400
        call    dword [eax+8]   ; begin write
2504
        mov     al, 40h
2401
        mov     al, 40h
2505
.writelfn:
2402
.writelfn:
2506
        or      al, cl
2403
        or      al, cl
-
 
2404
        stosb
2507
        mov     esi, [esp+4]
2405
        mov     esi, [esp+4]
2508
        push    ecx
2406
        push    ecx
2509
        dec     ecx
2407
        dec     ecx
-
 
2408
        jz      @f
2510
        imul    ecx, 13
2409
        imul    ecx, 13
-
 
2410
.scroll:
2511
        add     esi, ecx
2411
        call    utf8to16
2512
        stosb
2412
        loop    .scroll
-
 
2413
@@:
2513
        mov     cl, 5
2414
        mov     cl, 5
2514
        call    fat_read_symbols
2415
        call    fat_read_symbols
2515
        mov     ax, 0xF
2416
        mov     ax, 0xF
2516
        stosw
2417
        stosw
2517
        mov     al, [esp+4]
2418
        mov     al, [esp+4]
Line 2525... Line 2426...
2525
        pop     ecx
2426
        pop     ecx
2526
        lea     eax, [esp+8+8+12+8]
2427
        lea     eax, [esp+8+8+12+8]
2527
        call    dword [eax+12]         ; next write
2428
        call    dword [eax+12]  ; next write
2528
        xor     eax, eax
2429
        xor     eax, eax
2529
        loop    .writelfn
2430
        loop    .writelfn
2530
        pop     eax
-
 
2531
        pop     esi
2431
        pop     eax esi
2532
.nolfn:
2432
.nolfn:
2533
        xchg    esi, [esp]
2433
        xchg    esi, [esp]
2534
        mov     ecx, 11
2434
        mov     ecx, 11
2535
        rep movsb
2435
        rep movsb
2536
        mov     word [edi], 20h         ; attributes
2436
        mov     word [edi], 20h         ; attributes
Line 2728... Line 2628...
2728
        mov     word [edi-32+26], cx
2628
        mov     word [edi-32+26], cx
2729
        shr     ecx, 16
2629
        shr     ecx, 16
2730
        mov     [edi-32+20], cx
2630
        mov     [edi-32+20], cx
2731
        jmp     .writedircont
2631
        jmp     .writedircont
Line 2732... Line 2632...
2732
 
2632
 
2733
fat_read_symbol:
2633
@@:
2734
        or      ax, -1
-
 
2735
        test    esi, esi
-
 
2736
        jz      .retFFFF
2634
        or      eax, -1
2737
        lodsb
-
 
2738
        test    al, al
-
 
2739
        jnz     ansi2uni_char
-
 
2740
        xor     eax, eax
-
 
2741
        xor     esi, esi
-
 
2742
.retFFFF:
2635
        rep stosw
Line 2743... Line 2636...
2743
        ret
2636
        ret
-
 
2637
 
-
 
2638
fat_read_symbols:
2744
 
2639
        test    esi, esi
2745
fat_read_symbols:
2640
        jz      @b
-
 
2641
        call    utf8to16
-
 
2642
        stosw
-
 
2643
        test    ax, ax
-
 
2644
        jnz     @f
2746
        call    fat_read_symbol
2645
        xor     esi, esi
2747
        stosw
2646
@@:
Line 2748... Line 2647...
2748
        loop    fat_read_symbols
2647
        loop    fat_read_symbols
2749
        ret
2648
        ret