2011-10-14 23:38:50 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
2012-03-13 17:51:57 +01:00
|
|
|
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
|
2011-10-14 23:38:50 +02:00
|
|
|
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
$Revision$
|
|
|
|
|
|
|
|
|
|
|
|
uglobal
|
|
|
|
dmasize db 0x0
|
|
|
|
dmamode db 0x0
|
|
|
|
endg
|
|
|
|
|
|
|
|
fdc_init: ;start with clean tracks.
|
|
|
|
mov edi, OS_BASE+0xD201
|
|
|
|
mov al, 0
|
|
|
|
mov ecx, 160
|
|
|
|
rep stosb
|
|
|
|
ret
|
|
|
|
|
|
|
|
save_image:
|
2013-11-21 17:07:16 +01:00
|
|
|
cmp [ramdisk_actual_size], FLOPPY_CAPACITY
|
|
|
|
jnz .fail
|
2011-10-14 23:38:50 +02:00
|
|
|
pusha
|
2013-11-21 17:07:16 +01:00
|
|
|
mov ecx, floppy_mutex
|
|
|
|
call mutex_lock
|
|
|
|
mov [flp_number], bl
|
|
|
|
call floppy_read_bootsector
|
2011-10-14 23:38:50 +02:00
|
|
|
cmp [FDC_Status], 0
|
2013-11-21 17:07:16 +01:00
|
|
|
jne .unnecessary_save_image
|
2013-05-28 00:16:00 +02:00
|
|
|
mov [FDD_Track], 0; Цилиндр
|
|
|
|
mov [FDD_Head], 0; Сторона
|
|
|
|
mov [FDD_Sector], 1; Сектор
|
2011-10-14 23:38:50 +02:00
|
|
|
mov esi, RAMDISK
|
|
|
|
call SeekTrack
|
2013-11-21 17:07:16 +01:00
|
|
|
.save_image_1:
|
2011-10-14 23:38:50 +02:00
|
|
|
call take_data_from_application_1
|
|
|
|
call WriteSectWithRetr
|
|
|
|
; call WriteSector
|
|
|
|
cmp [FDC_Status], 0
|
2013-11-21 17:07:16 +01:00
|
|
|
jne .unnecessary_save_image
|
2011-10-14 23:38:50 +02:00
|
|
|
inc [FDD_Sector]
|
|
|
|
cmp [FDD_Sector], 19
|
2013-11-21 17:07:16 +01:00
|
|
|
jne .save_image_1
|
2011-10-14 23:38:50 +02:00
|
|
|
mov [FDD_Sector], 1
|
|
|
|
inc [FDD_Head]
|
|
|
|
cmp [FDD_Head], 2
|
2013-11-21 17:07:16 +01:00
|
|
|
jne .save_image_1
|
2011-10-14 23:38:50 +02:00
|
|
|
mov [FDD_Head], 0
|
|
|
|
inc [FDD_Track]
|
|
|
|
call SeekTrack
|
|
|
|
cmp [FDD_Track], 80
|
2013-11-21 17:07:16 +01:00
|
|
|
jne .save_image_1
|
|
|
|
.unnecessary_save_image:
|
|
|
|
cmp [FDC_Status], 0
|
|
|
|
pushf
|
|
|
|
mov ecx, floppy_mutex
|
|
|
|
call mutex_unlock
|
|
|
|
popf
|
2011-10-14 23:38:50 +02:00
|
|
|
popa
|
2013-11-21 17:07:16 +01:00
|
|
|
jnz .fail
|
|
|
|
xor eax, eax
|
|
|
|
ret
|
|
|
|
.fail:
|
|
|
|
movi eax, 1
|
2011-10-14 23:38:50 +02:00
|
|
|
ret
|