Subversion Repositories Kolibri OS

Rev

Rev 9692 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                              ;;
  3. ;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
  4. ;;  Distributed under terms of the GNU General Public License.  ;;
  5. ;;                                                              ;;
  6. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  7.  
  8. $Revision: 9828 $
  9.  
  10. ; CD external functions
  11. ;   in:
  12. ; esi -> path string in UTF-8
  13. ; ebx -> parameter structure +4
  14. ; ecx = bytes to read
  15. ; edx -> buffer
  16. ;   out:
  17. ; eax, ebx = return values for sysfunc 70
  18. iglobal
  19. align 4
  20. fs_CdServices:
  21.         dd      fs_CdRead
  22.         dd      fs_CdReadFolder
  23.         dd      fs_NotImplemented
  24.         dd      fs_NotImplemented
  25.         dd      fs_NotImplemented
  26.         dd      fs_CdGetFileInfo
  27.         dd      fs_NotImplemented
  28.         dd      0
  29.         dd      fs_NotImplemented
  30.         dd      fs_NotImplemented
  31. fs_NumCdServices = ($ - fs_CdServices)/4
  32. endg
  33.  
  34. uglobal
  35. align 4
  36. cd_current_pointer_of_input     dd  0
  37. cd_current_pointer_of_input_2   dd  0
  38. cd_mem_location                 dd  0
  39. cd_counter_block                dd  0
  40. cd_status                       dd  0
  41. endg
  42.  
  43. ;-----------------------------------------------------------------------------
  44. fs_NotImplemented:
  45.         movi    eax, ERROR_UNSUPPORTED_FS
  46.         ret
  47. ;-----------------------------------------------------------------------------
  48. reserve_cd:
  49.         cli
  50.         cmp     [cd_status], 0
  51.         je      reserve_ok2
  52.  
  53.         sti
  54.         call    change_task
  55.         jmp     reserve_cd
  56. ;-----------------------------------------------------------------------------
  57. reserve_ok2:
  58.         push    eax
  59.         mov     eax, [current_slot]
  60.         mov     eax, [eax + APPDATA.tid]
  61.         mov     [cd_status], eax
  62.         pop     eax
  63.         sti
  64.         ret
  65. ;-----------------------------------------------------------------------------
  66. reserve_cd_channel:
  67.         pushad
  68.         mov     eax, [cdpos]
  69.         dec     eax
  70.         shr     eax, 2
  71.  
  72.         test    eax, eax
  73.         jnz     .1
  74.  
  75.         cmp     [ChannelNumber], 1
  76.         jne     @f
  77.  
  78.         mov     ecx, ide_channel1_mutex
  79.         jmp     .mutex_lock
  80. ;--------------------------------------
  81. @@:
  82.         mov     ecx, ide_channel2_mutex
  83.         jmp     .mutex_lock
  84. ;--------------------------------------
  85. .1:
  86.         dec     eax
  87.         jnz     .2
  88.  
  89.         cmp     [ChannelNumber], 1
  90.         jne     @f
  91.  
  92.         mov     ecx, ide_channel3_mutex
  93.         jmp     .mutex_lock
  94. ;--------------------------------------
  95. @@:
  96.         mov     ecx, ide_channel4_mutex
  97.         jmp     .mutex_lock
  98. ;--------------------------------------
  99. .2:
  100.         cmp     [ChannelNumber], 1
  101.         jne     @f
  102.  
  103.         mov     ecx, ide_channel5_mutex
  104.         jmp     .mutex_lock
  105. ;--------------------------------------
  106. @@:
  107.         mov     ecx, ide_channel6_mutex
  108. .mutex_lock:
  109.         call    mutex_lock
  110.         popad
  111.         ret
  112. ;-----------------------------------------------------------------------------
  113. free_cd_channel:
  114.         pushad
  115.         mov     eax, [cdpos]
  116.         dec     eax
  117.         shr     eax, 2
  118.  
  119.         test    eax, eax
  120.         jnz     .1
  121.  
  122.         cmp     [ChannelNumber], 1
  123.         jne     @f
  124.  
  125.         mov     ecx, ide_channel1_mutex
  126.         jmp     .mutex_unlock
  127. ;--------------------------------------
  128. @@:
  129.         mov     ecx, ide_channel2_mutex
  130.         jmp     .mutex_unlock
  131. ;--------------------------------------
  132. .1:
  133.         dec     eax
  134.         jnz     .2
  135.  
  136.         cmp     [ChannelNumber], 1
  137.         jne     @f
  138.  
  139.         mov     ecx, ide_channel3_mutex
  140.         jmp     .mutex_unlock
  141. ;--------------------------------------
  142. @@:
  143.         mov     ecx, ide_channel4_mutex
  144.         jmp     .mutex_unlock
  145. ;--------------------------------------
  146. .2:
  147.         cmp     [ChannelNumber], 1
  148.         jne     @f
  149.  
  150.         mov     ecx, ide_channel5_mutex
  151.         jmp     .mutex_unlock
  152. ;--------------------------------------
  153. @@:
  154.         mov     ecx, ide_channel6_mutex
  155. .mutex_unlock:
  156.         call    mutex_unlock
  157.         popad
  158.         ret
  159.  
  160. ;-----------------------------------------------------------------------------
  161. fs_CdRead:
  162.         call    cd_find_lfn
  163.         jc      .notFound
  164.         mov     edi, [cd_current_pointer_of_input]
  165.         test    byte [edi+25], 10b  ; do not allow read directories
  166.         jnz     .noaccess
  167.         test    ebx, ebx
  168.         jz      .l1
  169.         cmp     dword [ebx+4], 0
  170.         jz      @f
  171.         xor     ebx, ebx
  172.         movi    eax, ERROR_END_OF_FILE
  173.         ret
  174.  
  175. .notFound:
  176.         cmp     [DevErrorCode], 0
  177.         jne     .noaccess
  178.         xor     ebx, ebx
  179.         movi    eax, ERROR_FILE_NOT_FOUND
  180.         ret
  181.  
  182. .noaccess_3:
  183.         pop     eax edx ecx
  184. .noaccess:
  185.         xor     ebx, ebx
  186.         movi    eax, ERROR_ACCESS_DENIED
  187.         ret
  188.  
  189. @@:
  190.         mov     ebx, [ebx]
  191. .l1:
  192.         push    ecx edx 0
  193.         mov     eax, [edi+10]   ; real size of the file section
  194.         sub     eax, ebx
  195.         jb      .eof
  196.         cmp     eax, ecx
  197.         jae     @f
  198.         mov     ecx, eax
  199.         pop     eax
  200.         push    ERROR_END_OF_FILE
  201. @@:
  202.         mov     eax, [edi+2]
  203.         mov     [CDSectorAddress], eax
  204. ; now eax=cluster, ebx=position, ecx=count, edx=buffer for data
  205. .new_sector:
  206.         test    ecx, ecx
  207.         jz      .done
  208.         sub     ebx, 2048
  209.         jae     .next
  210.         add     ebx, 2048
  211.         jnz     .incomplete_sector
  212.         cmp     ecx, 2048
  213.         jb      .incomplete_sector
  214. ; we may read and memmove complete sector
  215.         mov     [CDDataBuf_pointer], edx
  216.         call    ReadCDWRetr
  217.         cmp     [DevErrorCode], 0
  218.         jne     .noaccess_3
  219.         add     edx, 2048
  220.         sub     ecx, 2048
  221. .next:
  222.         inc     dword [CDSectorAddress]
  223.         jmp     .new_sector
  224.  
  225. .eof:
  226.         pop     eax
  227.         push    ERROR_END_OF_FILE
  228. .done:
  229.         mov     ebx, edx
  230.         pop     eax edx ecx
  231.         sub     ebx, edx
  232.         ret
  233.  
  234. .incomplete_sector: ; we must read and memmove incomplete sector
  235.         mov     [CDDataBuf_pointer], CDDataBuf
  236.         call    ReadCDWRetr
  237.         cmp     [DevErrorCode], 0
  238.         jne     .noaccess_3
  239.         push    ecx
  240.         add     ecx, ebx
  241.         cmp     ecx, 2048
  242.         jbe     @f
  243.         mov     ecx, 2048
  244. @@:
  245.         sub     ecx, ebx
  246.         push    edi esi ecx
  247.         mov     edi, edx
  248.         lea     esi, [CDDataBuf + ebx]
  249.         cld
  250.         rep movsb
  251.         pop     ecx esi edi
  252.         add     edx, ecx
  253.         sub     [esp], ecx
  254.         pop     ecx
  255.         xor     ebx, ebx
  256.         jmp     .next
  257.  
  258. ;-----------------------------------------------------------------------------
  259. fs_CdReadFolder:
  260.         push    edi
  261.         call    cd_find_lfn
  262.         jnc     .found
  263.         pop     edi
  264.         cmp     [DevErrorCode], 0
  265.         jne     .noaccess_1
  266.         xor     ebx, ebx
  267.         mov     eax, ERROR_FILE_NOT_FOUND
  268.         ret
  269.  
  270. .found:
  271.         mov     edi, [cd_current_pointer_of_input]
  272.         test    byte [edi+25], 10b    ; do not allow read directories
  273.         jnz     .found_dir
  274.         pop     edi
  275. .noaccess_1:
  276.         xor     ebx, ebx
  277.         mov     eax, ERROR_ACCESS_DENIED
  278.         ret
  279.  
  280. .end_buffer:
  281.         pop     edx eax
  282.         sub     eax, 2048   ; directory is over?
  283.         ja      .read_to_buffer
  284.         mov     eax, [cd_counter_block]
  285.         mov     [edx+8], eax
  286.         mov     eax, [ebx]
  287.         sub     [edx+4], eax
  288.         xor     eax, eax
  289.         dec     ecx
  290.         js      @f
  291.         mov     al, ERROR_END_OF_FILE
  292. @@:
  293.         pop     ecx edi
  294.         mov     ebx, [edx+4]
  295.         ret
  296.  
  297. .found_dir:
  298.         mov     eax, [edi+2]    ; eax=cluster
  299.         mov     [CDSectorAddress], eax
  300.         mov     eax, [edi+10]   ; directory size
  301.         push    eax ecx
  302.         mov     edi, edx
  303.         mov     ecx, 32/4
  304.         xor     eax, eax
  305.         rep stosd
  306.         pop     ecx eax
  307.         mov     byte [edx], 1   ; version
  308.         mov     [cd_mem_location], edx
  309.         add     [cd_mem_location], 32
  310.         mov     [cd_counter_block], dword 0
  311.         dec     dword [CDSectorAddress]
  312.         push    ecx
  313. .read_to_buffer:
  314.         inc     dword [CDSectorAddress]
  315.         mov     [CDDataBuf_pointer], CDDataBuf
  316.         call    ReadCDWRetr     ; read sector of directory
  317.         cmp     [DevErrorCode], 0
  318.         jne     .noaccess_1
  319.         mov     [cd_current_pointer_of_input_2], CDDataBuf
  320.         push    eax edx
  321. .get_names_from_buffer:
  322.         call    cd_get_name
  323.         jc      .end_buffer
  324.         inc     dword [cd_counter_block]
  325.         mov     eax, [cd_counter_block]
  326.         cmp     [ebx], eax
  327.         jae     .get_names_from_buffer
  328.         test    ecx, ecx
  329.         jz      .get_names_from_buffer
  330.         mov     edi, [cd_counter_block]
  331.         mov     [edx+4], edi
  332.         dec     ecx
  333.         mov     esi, ebp
  334.         call    cd_get_parameters_of_file
  335.         add     edi, 40
  336.         mov     ax, '.'
  337.         cmp     dword[ebx+4], 2
  338.         jz      .utf16
  339.         cmp     dword[ebx+4], 3
  340.         jz      .utf8
  341.         cmp     [cd_counter_block], 2
  342.         jbe     .parentDirectory
  343. @@:
  344.         lodsw
  345.         xchg    ah, al
  346.         call    uni2ansi_char
  347.         stosb
  348.         call    .checkForEnd
  349.         jc      @b
  350. @@:
  351.         mov     [edi], byte 0
  352.         add     [cd_mem_location], 304
  353.         jmp     .get_names_from_buffer
  354.  
  355. .parentDirectory:
  356.         stosb
  357.         cmp     [cd_counter_block], 2
  358.         jnz     @b
  359.         stosb
  360.         jmp     @b
  361.  
  362. .utf8:
  363.         add     [cd_mem_location], 256
  364.         cmp     [cd_counter_block], 2
  365.         jbe     .parentDirectory
  366.         push    ecx
  367.         mov     ecx, 519
  368. @@:
  369.         lodsw
  370.         xchg    ah, al
  371.         call    UTF16to8
  372.         js      @f
  373.         call    .checkForEnd
  374.         jc      @b
  375. @@:
  376.         pop     ecx
  377.         mov     [edi], byte 0
  378.         add     [cd_mem_location], 304
  379.         jmp     .get_names_from_buffer
  380.  
  381. .checkForEnd:
  382.         mov     ax, [esi]
  383.         cmp     ax, 3B00h   ; ';'
  384.         jz      @f
  385. ; check for files not ending with separator
  386.         movzx   eax, byte [ebp-33]
  387.         add     eax, ebp
  388.         sub     eax, 34
  389.         cmp     esi, eax
  390.         jz      @f
  391. ; check the end of the directory
  392.         movzx   eax, byte [ebp-1]
  393.         add     eax, ebp
  394.         cmp     esi, eax
  395. @@:
  396.         ret
  397.  
  398. .utf16:
  399.         cmp     [cd_counter_block], 2
  400.         jbe     .utf16ParentDirectory
  401. @@:
  402.         lodsw
  403.         xchg    ah, al
  404.         stosw
  405.         call    .checkForEnd
  406.         jc      @b
  407. @@:
  408.         mov     [edi], word 0
  409.         add     [cd_mem_location], 560
  410.         jmp     .get_names_from_buffer
  411.  
  412. .utf16ParentDirectory:
  413.         stosw
  414.         cmp     [cd_counter_block], 2
  415.         jnz     @b
  416.         stosw
  417.         jmp     @b
  418.  
  419. cd_get_parameters_of_file:
  420.         mov     edi, [cd_mem_location]
  421. cd_get_parameters_of_file_1:
  422. ; get file attributes
  423.         xor     eax, eax
  424. ; file is not archived
  425.         inc     eax
  426.         shl     eax, 1
  427. ; is a directory?
  428.         test    [ebp-8], byte 2
  429.         jz      .file
  430.         inc     eax
  431. .file:
  432. ; not as a volume label in the FAT, in this form not available
  433. ; file is not a system
  434.         shl     eax, 3
  435. ; file is hidden? (attribute of existence)
  436.         test    [ebp-8], byte 1
  437.         jz      .hidden
  438.         inc     eax
  439. .hidden:
  440.         shl     eax, 1
  441. ; file is always read-only, as this CD
  442.         inc     eax
  443.         mov     [edi], eax
  444.         mov     eax, [ebx+4]
  445.         mov     [edi+4], eax
  446. ; get the time to file
  447. ; hour
  448.         movzx   eax, byte [ebp-12]
  449.         shl     eax, 8
  450. ; minute
  451.         mov     al, [ebp-11]
  452.         shl     eax, 8
  453. ; second
  454.         mov     al, [ebp-10]
  455. ; file creation time
  456.         mov     [edi+8], eax
  457. ; last access time
  458.         mov     [edi+16], eax
  459. ; last write time
  460.         mov     [edi+24], eax
  461. ; get date for file
  462. ; year
  463.         movzx   eax, byte [ebp-15]
  464.         add     eax, 1900
  465.         shl     eax, 8
  466. ; month
  467.         mov     al, [ebp-14]
  468.         shl     eax, 8
  469. ; day
  470.         mov     al, [ebp-13]
  471. ; file creation date
  472.         mov     [edi+12], eax
  473. ; last access date
  474.         mov     [edi+20], eax
  475. ; last write date
  476.         mov     [edi+28], eax
  477. ; get the file size in bytes
  478.         xor     eax, eax
  479.         mov     [edi+32+4], eax
  480.         mov     eax, [ebp-23]
  481.         mov     [edi+32], eax
  482.         ret
  483.  
  484. ;-----------------------------------------------------------------------------
  485. fs_CdGetFileInfo:
  486.         call    cd_find_lfn
  487.         movi    eax, ERROR_FILE_NOT_FOUND
  488.         jc      @f
  489.         mov     edi, edx
  490.         mov     eax, [ebx+4]
  491.         mov     [edx+4], eax
  492.         cmp     byte [esi], 0
  493.         jz      .volume
  494.         mov     ebp, [cd_current_pointer_of_input]
  495.         add     ebp, 33
  496.         call    cd_get_parameters_of_file_1
  497.         xor     eax, eax
  498. @@:
  499.         ret
  500.  
  501. .volume:
  502.         test    eax, eax
  503.         jz      .size
  504.         mov     ecx, 16
  505.         mov     esi, CDDataBuf+40
  506.         add     edi, 40
  507.         cmp     eax, 2
  508.         jz      .utf16
  509.         cmp     eax, 3
  510.         jz      .utf8
  511. @@:
  512.         lodsw
  513.         xchg    al, ah
  514.         call    uni2ansi_char
  515.         stosb
  516.         loop    @b
  517.         jmp     .size
  518.  
  519. .utf16:
  520.         lodsw
  521.         xchg    al, ah
  522.         stosw
  523.         loop    .utf16
  524.         jmp     .size
  525.  
  526. .utf8:
  527.         mov     ebx, ecx
  528.         shl     ecx, 1
  529. @@:
  530.         lodsw
  531.         xchg    ah, al
  532.         call    UTF16to8
  533.         dec     ebx
  534.         jnz     @b
  535. .size:
  536.         mov     eax, [CDDataBuf+80]
  537.         shl     eax, 11
  538.         mov     [edx+32], eax
  539.         xor     eax, eax
  540.         mov     [edx+36], eax
  541.         stosw
  542.         mov     byte [edx], 8
  543.         ret
  544.  
  545. ;-----------------------------------------------------------------------------
  546. cd_find_lfn:
  547.         mov     [cd_appl_data], 0
  548. ; in: esi -> path string in UTF-8
  549. ; out: [cd_current_pointer_of_input] -> direntry, CF=1 -> file not found
  550.         push    eax esi
  551. ; Sector 16 - start set of volume descriptors
  552.         call    WaitUnitReady
  553.         cmp     [DevErrorCode], 0
  554.         jne     .access_denied
  555.  
  556.         call    prevent_medium_removal
  557. ; testing of reading
  558.         mov     [CDSectorAddress], dword 16
  559.         mov     [CDDataBuf_pointer], CDDataBuf
  560.         call    ReadCDWRetr;_1
  561.         cmp     [DevErrorCode], 0
  562.         jne     .access_denied
  563.  
  564. ; calculation of the last session
  565.         call    WaitUnitReady
  566.         cmp     [DevErrorCode], 0
  567.         jne     .access_denied
  568.  
  569.         call    Read_TOC
  570.         mov     ah, [CDDataBuf+4+4]
  571.         mov     al, [CDDataBuf+4+5]
  572.         shl     eax, 16
  573.         mov     ah, [CDDataBuf+4+6]
  574.         mov     al, [CDDataBuf+4+7]
  575.         add     eax, 15
  576.         mov     [CDSectorAddress], eax
  577. ;  mov  [CDSectorAddress],dword 15
  578.         mov     [CDDataBuf_pointer], CDDataBuf
  579. ;--------------------------------------
  580. .start:
  581.         inc     dword [CDSectorAddress]
  582.         call    ReadCDWRetr;_1
  583.         cmp     [DevErrorCode], 0
  584.         jne     .access_denied
  585.  
  586. .start_check:
  587. ; checking for "lice"
  588.         cmp     [CDDataBuf+1], dword 'CD00'
  589.         jne     .access_denied
  590.  
  591.         cmp     [CDDataBuf+5], byte '1'
  592.         jne     .access_denied
  593. ; sector is the terminator of set of descriptors volumes?
  594.         cmp     [CDDataBuf], byte 0xff
  595.         je      .access_denied
  596. ; sector is an additional and improved descriptor of volume?
  597.         cmp     [CDDataBuf], byte 0x2
  598.         jne     .start
  599. ; sector is an additional descriptor of volume?
  600.         cmp     [CDDataBuf+6], byte 0x1
  601.         jne     .start
  602.  
  603. ; parameters of root directory
  604.         mov     eax, [CDDataBuf+0x9c+2]; start of root directory
  605.         mov     [CDSectorAddress], eax
  606.         mov     eax, [CDDataBuf+0x9c+10]; size of root directory
  607.         cmp     byte [esi], 0
  608.         jnz     @f
  609.  
  610.         mov     [cd_current_pointer_of_input], CDDataBuf+0x9c
  611.         jmp     .done
  612. ;--------------------------------------
  613. @@:
  614. ; start the search
  615. .mainloop:
  616.         dec     dword [CDSectorAddress]
  617. ;--------------------------------------
  618. .read_to_buffer:
  619.         inc     dword [CDSectorAddress]
  620.         mov     [CDDataBuf_pointer], CDDataBuf
  621.         call    ReadCDWRetr      ; read sector of directory
  622.         cmp     [DevErrorCode], 0
  623.         jne     .access_denied
  624.         call    cd_find_name_in_buffer
  625.         jnc     .found
  626.         sub     eax, 2048
  627. ; directory is over?
  628.         cmp     eax, 0
  629.         ja      .read_to_buffer
  630. ; desired element of chain is not found
  631. .access_denied:
  632.         pop     esi eax
  633.         mov     [cd_appl_data], 1
  634.         stc
  635.         ret
  636. ;--------------------------------------
  637. ; desired element of chain found
  638. .found:
  639. ; the end of the file path
  640.         cmp     byte [esi-1], 0
  641.         jz      .done
  642.         mov     eax, [cd_current_pointer_of_input]
  643.         push    dword [eax+2]
  644.         pop     dword [CDSectorAddress] ; beginning of the directory
  645.         mov     eax, [eax+2+8] ; size of directory
  646.         jmp     .mainloop
  647. ;--------------------------------------
  648. ; file pointer found
  649. .done:
  650.         pop     esi eax
  651.         mov     [cd_appl_data], 1
  652.         clc
  653.         ret
  654. ;-----------------------------------------------------------------------------
  655. cd_find_name_in_buffer:
  656.         mov     [cd_current_pointer_of_input_2], CDDataBuf
  657. ;--------------------------------------
  658. .start:
  659.         call    cd_get_name
  660.         jc      .not_found
  661.  
  662.         call    cd_compare_name
  663.         jc      .start
  664. ;--------------------------------------
  665. .found:
  666.         clc
  667.         ret
  668. ;--------------------------------------
  669. .not_found:
  670.         stc
  671.         ret
  672. ;-----------------------------------------------------------------------------
  673. cd_get_name:
  674.         push    eax
  675.         mov     ebp, [cd_current_pointer_of_input_2]
  676.         mov     [cd_current_pointer_of_input], ebp
  677.         mov     eax, [ebp]
  678.         test    eax, eax ; entry's is over?
  679.         jz      .next_sector
  680.  
  681.         cmp     ebp, CDDataBuf+2048  ; buffer is over?
  682.         jae     .next_sector
  683.  
  684.         movzx   eax, byte [ebp]
  685.         add     [cd_current_pointer_of_input_2], eax ; next entry of directory
  686.         add     ebp, 33; pointer is set to the beginning of the name
  687.         pop     eax
  688.         clc
  689.         ret
  690. ;--------------------------------------
  691. .next_sector:
  692.         pop     eax
  693.         stc
  694.         ret
  695. ;-----------------------------------------------------------------------------
  696. cd_compare_name:
  697. ; in: esi -> UTF-8 name, ebp -> UTF-16BE name
  698. ; out: CF=0 -> names match, esi -> next component of name
  699. ;      CF=1 -> esi is not changed
  700.         push    edx edi eax esi
  701.         mov     edi, ebp
  702. .loop:
  703.         call    utf8to16
  704.         call    utf16toUpper
  705.         mov     edx, eax
  706.         mov     ax, [edi]
  707.         xchg    al, ah
  708.         call    utf16toUpper
  709.         cmp     ax, dx
  710.         jne     .name_not_coincide
  711.         add     edi, 2
  712.         cmp     [esi], byte '/' ; path separator is end of current element
  713.         je      .done
  714.         cmp     [esi], byte 0 ; path separator end of name
  715.         jne     .loop
  716. .done:
  717. ; check end of file
  718.         cmp     [edi], word 3B00h; separator end of file ';'
  719.         je      .done_1
  720. ; check for files not ending with separator
  721.         movzx   eax, byte [ebp-33]
  722.         add     eax, ebp
  723.         sub     eax, 34
  724.         cmp     edi, eax
  725.         je      .done_1
  726. ; check the end of directory
  727.         movzx   eax, byte [ebp-1]
  728.         add     eax, ebp
  729.         cmp     edi, eax
  730.         jne     .name_not_coincide
  731. .done_1:
  732.         pop     eax eax edi edx
  733.         inc     esi
  734.         ret
  735.  
  736. .name_not_coincide:
  737.         pop     esi eax edi edx
  738.         stc
  739.         ret
  740.