Subversion Repositories Kolibri OS

Rev

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

Rev 593 Rev 766
Line 7... Line 7...
7
;; (C) 2004 Ville Turjanmaa, License: GPL                       ;;
7
;; (C) 2004 Ville Turjanmaa, License: GPL                       ;;
8
;; Addings by M.Lisovin                                         ;;
8
;; Addings by M.Lisovin                                         ;;
9
;; LFN support by diamond                                       ;;
9
;; LFN support by diamond                                       ;;
10
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 11... Line 11...
11
 
11
 
Line 12... Line 12...
12
$Revision: 593 $
12
$Revision: 766 $
Line 13... Line 13...
13
 
13
 
Line 296... Line 296...
296
        pop    ebx     ; ebx <- eax : size of file
296
	pop    ebx     ; ebx <- eax : size of file
297
        add    esp,36
297
	add    esp,36
298
        xor    eax,eax  ;read ok
298
	xor    eax,eax	;read ok
299
        ret
299
	ret
Line 300... Line -...
300
 
-
 
301
filedelete:
-
 
302
;--------------------------------------------
-
 
303
;
-
 
304
; filedelete - sys floppy
-
 
305
; in:
-
 
306
; eax -  pointer to filename 11 chars
-
 
307
;
-
 
308
; out:
-
 
309
; eax - 0 = successful, 5 = file not found
-
 
310
;
-
 
311
;--------------------------------------------
-
 
312
 
-
 
313
        sub    esp,32
-
 
314
        call   expand_filename
-
 
315
 
-
 
316
        push   eax ebx ecx edx esi edi
-
 
317
 
-
 
318
        call   rd_findfile
-
 
319
        je     fifoundd
-
 
320
        pop    edi esi edx ecx ebx eax ;file not found
-
 
321
        add    esp,32
-
 
322
        mov    eax,5
-
 
323
        ret
-
 
324
 
-
 
325
     fifoundd:
-
 
326
 
-
 
327
        mov    [edi-11],byte 0xE5       ;mark filename deleted
-
 
328
        add    edi,0xf
-
 
329
        movzx  eax,word [edi]
-
 
330
        mov    edi,eax                  ;edi = cluster
-
 
331
 
-
 
332
      frnewd:
-
 
333
 
-
 
334
        shl    edi,1                    ;find next cluster from FAT
-
 
335
        add    edi,RAMDISK_FAT
-
 
336
        movzx  eax,word [edi]
-
 
337
        mov    [edi],word 0x0           ;clear fat chain cluster
-
 
338
        mov    edi,eax
-
 
339
        cmp    edi,dword 0xff8          ;last cluster ?
-
 
340
        jb     frnewd
-
 
341
 
-
 
342
        pop    edi esi edx ecx ebx eax
-
 
343
        add    esp,32
-
 
344
        xor    eax,eax       ; file found
-
 
345
        ret
-
 
346
 
-
 
347
 
-
 
348
 
-
 
349
filesave:
-
 
350
;----------------------------------------------------------
-
 
351
;
-
 
352
; filesave - sys floppy
-
 
353
;
-
 
354
; eax points to filename 11 chars
-
 
355
;
-
 
356
;        eax      ; pointer to file name
-
 
357
;        ebx      ; buffer
-
 
358
;        ecx      ; count to write in bytes
-
 
359
;        edx      ; 0 create new , 1 append
-
 
360
;
-
 
Line 361... Line -...
361
;-----------------------------------------------------------
-
 
362
 
-
 
363
        sub  esp,32
-
 
364
        call expand_filename
-
 
365
        test edx,edx
-
 
366
        jnz  fsdel
-
 
367
        pusha
-
 
368
        call filedelete
-
 
369
        popa
-
 
370
 
-
 
371
      fsdel:
-
 
372
 
-
 
373
        call   ramdisk_free_space
-
 
374
        cmp    ecx,edi
-
 
375
        jbe    rd_do_save
-
 
376
        add    esp,32
-
 
377
        mov    eax,8    ;disk full
-
 
378
        ret
-
 
379
 
-
 
380
      rd_do_save:
-
 
381
 
-
 
382
        push   eax ebx ecx edx esi edi
-
 
383
 
-
 
384
        mov    edi,RAMDISK+512*18+512  ;Point at directory
-
 
385
        mov    edx,224 +1
-
 
386
        ; find an empty spot for filename in the root dir
-
 
387
     l20ds:
-
 
388
        dec    edx
-
 
389
        jz     frnoreadds
-
 
390
     l21ds:
-
 
391
        cmp    [edi],byte 0xE5
-
 
392
        jz     fifoundds
-
 
393
        cmp    [edi],byte 0x0
-
 
394
        jz     fifoundds
-
 
395
        add    edi,32                   ; Advance to next entry
-
 
396
        jmp    l20ds
-
 
397
     fifoundds:
-
 
398
 
-
 
399
        push   edi                      ; move the filename to root dir
-
 
400
        mov    esi,[esp+4+20]
-
 
401
        mov    ecx,11
-
 
402
        cld
-
 
403
        rep    movsb
-
 
404
        pop    edi
-
 
405
        mov    edx,edi
-
 
406
        add    edx,11+0xf               ; edx <- cluster save position
-
 
407
        mov    ebx,[esp+12]             ; save file size
-
 
408
        mov    [edi+28],ebx
-
 
409
        mov    [edi+11],byte 0x20       ; attribute
-
 
410
; Ivan Poddubny 11/12/2003:
-
 
411
call get_date_for_file   ; from FAT32.INC
-
 
412
mov [edi+24],ax          ; date
-
 
413
call get_time_for_file   ; from FAT32.INC
-
 
414
mov [edi+22],ax          ; time
-
 
415
; End
-
 
416
        mov    edi,RAMDISK_FAT            ;pointer to first cluster
-
 
417
        mov    ecx,2849
-
 
418
        cld
-
 
419
      frnewds:
-
 
420
        xor    ax,ax
-
 
421
        repne  scasw
-
 
422
        mov    ebx,2848
-
 
423
        sub    ebx,ecx
-
 
424
        mov    [edx],bx                 ; save next cluster pos. to prev cl.
-
 
425
        mov    edx,edi                  ; next save pos abs mem add
-
 
426
        dec    edx
-
 
427
        dec    edx
-
 
428
        call   fdc_filesave
-
 
429
        pusha                           ; move save to floppy cluster
-
 
430
        add    ebx,31
-
 
431
        shl    ebx,9
-
 
432
        add    ebx,RAMDISK
-
 
433
        mov    eax,[esp+32+16]
-
 
434
        mov    ecx,512
-
 
435
        call   memmove
-
 
436
        popa
-
 
437
 
-
 
438
        mov    eax,[esp+12]
-
 
439
        cmp    eax,512
-
 
440
        jbe    flnsa
-
 
441
        sub    eax,512
-
 
442
        mov    [esp+12],eax
-
 
443
        add     dword [esp+16], 512
-
 
444
        jmp    frnewds
-
 
445
 
-
 
446
     flnsa:
-
 
447
        mov    [edi-2],word 4095          ; mark end of file - last cluster
-
 
448
 
-
 
449
      frnoreadds:
-
 
450
 
-
 
451
        pop    edi esi edx ecx ebx eax
-
 
452
        add    esp,32
-
 
453
 
-
 
454
;        pusha
-
 
455
;        cli
-
 
456
;        call   fdc_commitfile
-
 
457
;        sti
-
 
458
;        popa
-
 
459
 
-
 
Line 460... Line 300...
460
        xor    eax,eax ;ok write
300
 
461
        ret
301
 
462
 
302