Subversion Repositories Kolibri OS

Rev

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

Rev 6262 Rev 6468
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2015. 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
 
-
 
8
$Revision: 6468 $
-
 
9
 
-
 
10
; CD external functions
-
 
11
;   in:
-
 
12
; esi -> path string
-
 
13
; ebx -> offset in file (qword)
-
 
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
Line 8... Line -...
8
$Revision: 6262 $
-
 
9
 
32
endg
-
 
33
 
10
;-----------------------------------------------------------------------------
34
uglobal
11
uglobal
35
align 4
12
cd_current_pointer_of_input    dd  0
36
cd_current_pointer_of_input     dd  0
13
cd_current_pointer_of_input_2  dd  0
37
cd_current_pointer_of_input_2   dd  0
-
 
38
cd_mem_location                 dd  0
14
cd_mem_location                dd  0
39
cd_counter_block                dd  0
-
 
40
cd_status                       dd  0
-
 
41
endg
-
 
42
 
-
 
43
;-----------------------------------------------------------------------------
-
 
44
fs_NotImplemented:
15
cd_counter_block               dd  0
45
        movi    eax, ERROR_UNSUPPORTED_FS
16
endg
46
        ret
17
;-----------------------------------------------------------------------------
47
;-----------------------------------------------------------------------------
18
reserve_cd:
48
reserve_cd:
19
        cli
49
        cli
Line 125... Line 155...
125
        mov     ecx, ide_channel6_mutex
155
        mov     ecx, ide_channel6_mutex
126
.mutex_unlock:
156
.mutex_unlock:
127
        call    mutex_unlock
157
        call    mutex_unlock
128
        popad
158
        popad
129
        ret
159
        ret
130
;-----------------------------------------------------------------------------
-
 
131
uglobal
-
 
132
cd_status dd 0
-
 
133
endg
-
 
134
;-----------------------------------------------------------------------------
-
 
135
;
160
 
136
;  fs_CdRead - LFN variant for reading CD disk
-
 
137
;
-
 
138
;  esi  points to filename /dir1/dir2/.../dirn/file,0
-
 
139
;  ebx  pointer to 64-bit number = first wanted byte, 0+
-
 
140
;       may be ebx=0 - start from first byte
-
 
141
;  ecx  number of bytes to read, 0+
-
 
142
;  edx  mem location to return data
-
 
143
;
-
 
144
;  ret ebx = bytes read or 0xffffffff file not found
-
 
145
;      eax = 0 ok read or other = errormsg
-
 
146
;
-
 
147
;-----------------------------------------------------------------------------
161
;-----------------------------------------------------------------------------
148
fs_CdRead:
162
fs_CdRead:
149
        push    edi
163
        push    edi
150
        cmp     byte [esi], 0
164
        cmp     byte [esi], 0
151
        jnz     @f
165
        jnz     @f
Line 275... Line 289...
275
.eof:
289
.eof:
276
        mov     ebx, edx
290
        mov     ebx, edx
277
        pop     eax edx ecx
291
        pop     eax edx ecx
278
        sub     ebx, edx
292
        sub     ebx, edx
279
        jmp     .reteof
293
        jmp     .reteof
280
;-----------------------------------------------------------------------------
-
 
281
;
-
 
282
;  fs_CdReadFolder - LFN variant for reading CD disk folder
-
 
283
;
294
 
284
;  esi  points to filename  /dir1/dir2/.../dirn/file,0
-
 
285
;  ebx  pointer to structure 32-bit number = first wanted block, 0+
-
 
286
;                          & flags (bitfields)
-
 
287
; flags: bit 0: 0=ANSI names, 1=UNICODE names
-
 
288
;  ecx  number of blocks to read, 0+
-
 
289
;  edx  mem location to return data
-
 
290
;
-
 
291
;  ret ebx = blocks read or 0xffffffff folder not found
-
 
292
;      eax = 0 ok read or other = errormsg
-
 
293
;
-
 
294
;-----------------------------------------------------------------------------
295
;-----------------------------------------------------------------------------
295
fs_CdReadFolder:
296
fs_CdReadFolder:
296
        push    edi
297
        push    edi
297
        call    cd_find_lfn
298
        call    cd_find_lfn
298
        jnc     .found
299
        jnc     .found
Line 557... Line 558...
557
        xor     eax, eax
558
        xor     eax, eax
558
        mov     [edi+32+4], eax
559
        mov     [edi+32+4], eax
559
        mov     eax, [ebp-23]
560
        mov     eax, [ebp-23]
560
        mov     [edi+32], eax
561
        mov     [edi+32], eax
561
        ret
562
        ret
562
;-----------------------------------------------------------------------------
-
 
563
;
-
 
564
;  fs_CdGetFileInfo - LFN variant for CD
-
 
565
;                     get file/directory attributes structure
-
 
566
;
563
 
567
;-----------------------------------------------------------------------------
564
;-----------------------------------------------------------------------------
568
fs_CdGetFileInfo:
565
fs_CdGetFileInfo:
569
        cmp     byte [esi], 0
566
        cmp     byte [esi], 0
570
        jnz     @f
567
        jnz     @f
Line 605... Line 602...
605
        xor     eax, eax
602
        xor     eax, eax
606
        ret
603
        ret
607
;-----------------------------------------------------------------------------
604
;-----------------------------------------------------------------------------
608
cd_find_lfn:
605
cd_find_lfn:
609
        mov     [cd_appl_data], 0
606
        mov     [cd_appl_data], 0
610
; in: esi+ebp -> name
607
; in: esi -> path string
611
; out: CF=1 - file not found
608
; out: CF=1 - file not found
612
; else CF=0 and [cd_current_pointer_of_input] direntry
609
; else CF=0 and [cd_current_pointer_of_input] direntry
613
        push    eax esi
610
        push    eax esi
614
; Sector 16 - start set of volume descriptors
611
; Sector 16 - start set of volume descriptors
615
        call    WaitUnitReady
612
        call    WaitUnitReady
Line 682... Line 679...
682
        inc     dword [CDSectorAddress]
679
        inc     dword [CDSectorAddress]
683
        mov     [CDDataBuf_pointer], CDDataBuf
680
        mov     [CDDataBuf_pointer], CDDataBuf
684
        call    ReadCDWRetr      ; read sector of directory
681
        call    ReadCDWRetr      ; read sector of directory
685
        cmp     [DevErrorCode], 0
682
        cmp     [DevErrorCode], 0
686
        jne     .access_denied
683
        jne     .access_denied
687
 
-
 
688
        push    ebp
-
 
689
        call    cd_find_name_in_buffer
684
        call    cd_find_name_in_buffer
690
        pop     ebp
-
 
691
        jnc     .found
685
        jnc     .found
692
 
-
 
693
        sub     eax, 2048
686
        sub     eax, 2048
694
; directory is over?
687
; directory is over?
695
        cmp     eax, 0
688
        cmp     eax, 0
696
        ja      .read_to_buffer
689
        ja      .read_to_buffer
697
; desired element of chain is not found
690
; desired element of chain is not found
Line 704... Line 697...
704
; desired element of chain found
697
; desired element of chain found
705
.found:
698
.found:
706
; the end of the file path
699
; the end of the file path
707
        cmp     byte [esi-1], 0
700
        cmp     byte [esi-1], 0
708
        jz      .done
701
        jz      .done
709
  .nested:
-
 
710
        mov     eax, [cd_current_pointer_of_input]
702
        mov     eax, [cd_current_pointer_of_input]
711
        push    dword [eax+2]
703
        push    dword [eax+2]
712
        pop     dword [CDSectorAddress] ; beginning of the directory
704
        pop     dword [CDSectorAddress] ; beginning of the directory
713
        mov     eax, [eax+2+8] ; size of directory
705
        mov     eax, [eax+2+8] ; size of directory
714
        jmp     .mainloop
706
        jmp     .mainloop
715
;--------------------------------------
707
;--------------------------------------
716
; file pointer found
708
; file pointer found
717
.done:
709
.done:
718
        test    ebp, ebp
-
 
719
        jz      @f
-
 
720
 
-
 
721
        mov     esi, ebp
-
 
722
        xor     ebp, ebp
-
 
723
        jmp     .nested
-
 
724
;--------------------------------------
-
 
725
@@:
-
 
726
        pop     esi eax
710
        pop     esi eax
727
        mov     [cd_appl_data], 1
711
        mov     [cd_appl_data], 1
728
        clc
712
        clc
729
        ret
713
        ret
730
;-----------------------------------------------------------------------------
714
;-----------------------------------------------------------------------------