Subversion Repositories Kolibri OS

Rev

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

Rev 220 Rev 332
Line 85... Line 85...
85
	rep	movsb
85
	rep	movsb
86
  .finish:
86
  .finish:
87
;       stc
87
;       stc
88
	ret
88
	ret
Line -... Line 89...
-
 
89
 
-
 
90
alloc_handle:
-
 
91
        call    make_fullpaths
-
 
92
        mov     ebx, fileinfos+4
-
 
93
@@:
-
 
94
        cmp     dword [ebx], -1
-
 
95
        jz      .found
-
 
96
        add     ebx, 4+20+MAX_PATH
-
 
97
        cmp     ebx, fileinfos_end
-
 
98
        jb      @b
-
 
99
        stc
-
 
100
        ret
-
 
101
.found:
-
 
102
        and     dword [ebx+4], 0
-
 
103
        and     dword [ebx+8], 0
-
 
104
        push    esi edi ecx
-
 
105
        mov     esi, fullpath_open
-
 
106
        lea     edi, [ebx+20]
-
 
107
        mov     ecx, MAX_PATH
-
 
108
        rep     movsb
-
 
109
        pop     ecx edi esi
Line 89... Line 110...
89
 
110
        ret	; CF=0
90
 
111
 
-
 
112
create:
-
 
113
        call    alloc_handle
-
 
114
        jc      .ret
-
 
115
        and     dword [ebx-4], 0
91
create:
116
        mov     dword [ebx], 2
Line 92... Line 117...
92
	call  make_fullpaths
117
.ret:
93
	ret
118
        ret
Line 110... Line 135...
110
;        ret
135
;        ret
111
;file_error:
136
;file_error:
112
;        stc
137
;        stc
113
;        ret
138
;        ret
Line 114... Line 139...
114
 
139
 
115
           call    make_fullpaths
-
 
116
 
140
        call    alloc_handle
117
           xor eax, eax
141
        jc      .ret
118
           mov [fileio.cmd], 5
-
 
119
           mov [fileio.offset], eax
-
 
120
           mov [fileio.offset+4], eax
142
        mov     dword [ebx], 5
121
           mov [fileio.count], eax
143
        and     dword [ebx+12], 0
122
           mov [fileio.buff], fileinfo
-
 
123
           mov byte [fileio.buff+4], al
-
 
124
           mov [fileio.name], fullpath_open
-
 
125
 
144
        mov     dword [ebx+16], fileinfo
126
           mov eax, 70
145
        mov     eax, 70
127
           mov ebx, fileio
146
        push    ebx
-
 
147
        int     0x40
128
           int 0x40
148
        pop     ebx
129
           test eax, eax
149
        test    eax, eax
130
           jnz .fail
150
        jnz     .fail
131
           mov ebx, [fileinfo.size]
151
        mov     eax, [fileinfo.size]
132
           mov [filesize],ebx
152
        mov     [ebx-4], eax
-
 
153
        and     dword [ebx], 0
133
           clc
154
.ret:
134
           ret
155
        ret
-
 
156
.fail:
135
.fail:
157
	or	dword [ebx], -1	; close handle
136
           stc
158
        stc
Line 137... Line 159...
137
           ret
159
        ret
138
 
160
 
Line 144... Line 166...
144
;          cld
166
;          cld
145
;          rep     movsb
167
;          rep     movsb
146
;          popa
168
;          popa
147
;;         ret
169
;;         ret
Line 148... Line 170...
148
 
170
 
149
           xor eax, eax
171
        mov     [ebx+12], ecx
150
           mov [fileio.cmd], eax
-
 
151
           mov [fileio.offset], eax
-
 
152
           mov [fileio.offset+4], eax
-
 
153
           mov [fileio.count], ecx
172
        mov     [ebx+16], edx
154
           mov [fileio.buff], edx
-
 
155
           mov byte [fileio.buff+4], al
-
 
156
           mov [fileio.name], fullpath_open
173
        push    ebx
157
           mov eax, 70
-
 
158
           mov ebx, fileio
174
        mov     eax, 70
-
 
175
        int     0x40
-
 
176
        xchg    eax, [esp]
-
 
177
        add     [eax+4], ebx
-
 
178
        adc     [eax+8], dword 0
-
 
179
        mov     ebx, eax
-
 
180
        pop     eax
-
 
181
        test    eax, eax
-
 
182
        jz      .ok
-
 
183
        cmp     eax, 6
-
 
184
        jz      .ok
-
 
185
        stc
-
 
186
.ok:
-
 
187
        ret
159
           int 0x40
188
 
-
 
189
close:
160
close:
190
        or      dword [ebx], -1
Line 161... Line 191...
161
           ret
191
        ret
162
 
192
 
Line 173... Line 203...
173
;        mov     ebx,file_info_write
203
;        mov     ebx,file_info_write
174
;        int     0x40
204
;        int     0x40
175
;        popa
205
;        popa
176
;        ret
206
;        ret
Line 177... Line 207...
177
 
207
 
178
           xor eax, eax
-
 
179
           mov [fileio.cmd], 2
-
 
180
           mov [fileio.offset], eax
-
 
181
           mov [fileio.offset+4], eax
208
        mov     [ebx+12], ecx
182
           mov [fileio.count], ecx
209
        mov     [ebx+16], edx
183
           mov [fileio.buff], edx
-
 
184
           mov byte [fileio.buff+4], al
-
 
185
           mov [fileio.name], fullpath_write
210
        push    ebx
186
           mov eax, 70
-
 
187
           mov ebx, fileio
211
        mov     eax, 70
188
           int 0x40
212
        int     0x40
189
           test eax, eax
213
        xchg    eax, [esp]
-
 
214
        add     [eax+4], ebx
190
           jnz .fail
215
        adc     [eax+8], dword 0
191
           clc
216
        mov     ebx, eax
-
 
217
        pop     eax
192
           ret
218
        mov     byte [ebx], 3
193
.fail:
219
        cmp     eax, 1
194
           stc
220
        cmc
Line 195... Line 221...
195
           ret
221
        ret
196
 
222
 
197
make_fullpaths:
223
make_fullpaths:
Line 276... Line 302...
276
 
302
 
277
 
303
 
278
lseek:
304
lseek:
279
	cmp	al,0
305
	cmp	al,0
280
	jnz	@f
306
	jnz	@f
281
	mov	[filepos],0
-
 
282
    @@: cmp	al,1
307
	and	dword [ebx+4], 0
283
	jnz	@f
308
	and     dword [ebx+8], 0
284
    @@: cmp	al,2
309
    @@: cmp	al,2
285
	jnz	@f
310
	jnz	@f
286
	mov	eax,[filesize]
311
	mov	eax, [ebx-4]
287
	mov	[filepos],eax
312
	mov	[ebx+4], eax
288
    @@: mov	eax,[filepos]
313
	and     dword [ebx+8], 0
289
	add	eax,edx
314
    @@: add	dword [ebx+4], edx
Line 290... Line 315...
290
	mov	[filepos],eax
315
        adc     dword [ebx+8], 0
291
	ret
316
	ret
292
 
317
 
Line 507... Line 532...
507
	mov	esi,error_suffix
532
	mov	esi,error_suffix
508
	call	display_string
533
	call	display_string
509
	jmp	exit_program
534
	jmp	exit_program
Line 510... Line 535...
510
 
535
 
511
align 4
-
 
512
fileio FILEIO
-
 
513
align 4
536
align 4
Line 514... Line 537...
514
fileinfo FILEINFO
537
fileinfo FILEINFO
515
 
538