support for PnP disks, part 5: FAT12, ramdisk, floppies
git-svn-id: svn://kolibrios.org@4273 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
42203528ce
commit
1842871f8f
@ -290,7 +290,6 @@ CMM_PROGRAMS:=\
|
||||
OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \
|
||||
default.skn:DEFAULT.SKN \
|
||||
graph:GRAPH \
|
||||
../common/hdread:HDREAD \
|
||||
settings/icon.ini:SETTINGS/ICON.INI \
|
||||
../common/iconstrp.png:ICONSTRP.PNG index_htm:INDEX.HTM \
|
||||
kernel.mnt:KERNEL.MNT \
|
||||
|
@ -112,7 +112,6 @@ CPUID /sys/cpuid
|
||||
Ghost Monitor /sys/gmon
|
||||
K. Bus disconnected /sys/kbd
|
||||
HDD informer /sys/hdd_info
|
||||
Read HDD /sys/hdread
|
||||
#13 **** WORK WITH FILES ****
|
||||
KFAR /sys/File Managers/kfar
|
||||
KFM /sys/File Managers/kfm
|
||||
|
@ -290,7 +290,6 @@ CMM_PROGRAMS:=\
|
||||
OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \
|
||||
default.skn:DEFAULT.SKN \
|
||||
graph:GRAPH \
|
||||
../common/hdread:HDREAD \
|
||||
settings/icon.ini:SETTINGS/ICON.INI \
|
||||
../common/iconstrp.png:ICONSTRP.PNG index_htm:INDEX.HTM \
|
||||
kernel.mnt:KERNEL.MNT \
|
||||
|
@ -112,7 +112,6 @@ CPUID /sys/cpuid
|
||||
Ghost Monitor /sys/gmon
|
||||
K. Bus disconnected /sys/kbd
|
||||
HDD info /sys/hdd_info
|
||||
Read HDD /sys/hdread
|
||||
#13 **** WORK WITH FILES ****
|
||||
KFAR /sys/File Managers/kfar
|
||||
KFM /sys/File Managers/kfm
|
||||
|
@ -289,7 +289,6 @@ CMM_PROGRAMS:=\
|
||||
OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \
|
||||
default.skn:DEFAULT.SKN \
|
||||
graph:GRAPH \
|
||||
../common/hdread:HDREAD \
|
||||
settings/icon.ini:SETTINGS/ICON.INI \
|
||||
../common/iconstrp.png:ICONSTRP.PNG index_htm:INDEX.HTM \
|
||||
kernel.mnt:KERNEL.MNT \
|
||||
|
@ -111,7 +111,6 @@ CPUID /sys/cpuid
|
||||
Ghost Monitor /sys/gmon
|
||||
K. Bus disconnected /sys/kbd
|
||||
HDD informer /sys/hdd_info
|
||||
Read HDD /sys/hdread
|
||||
#13 **** WORK WITH FILES ****
|
||||
KFAR /sys/File Managers/kfar
|
||||
KFM /sys/File Managers/kfm
|
||||
|
@ -283,7 +283,6 @@ CMM_PROGRAMS:=\
|
||||
OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \
|
||||
default.skn:DEFAULT.SKN \
|
||||
graph:GRAPH \
|
||||
../common/hdread:HDREAD \
|
||||
settings/icon.ini:SETTINGS/ICON.INI \
|
||||
../common/iconstrp.png:ICONSTRP.PNG index_htm:INDEX.HTM \
|
||||
kernel.mnt:KERNEL.MNT \
|
||||
|
@ -116,7 +116,6 @@ CPUID /sys/cpuid
|
||||
GHOST Monitor /sys/gmon
|
||||
K. Bus disconnected /sys/kbd
|
||||
HDD ¨ä®à¬¥à /sys/hdd_info
|
||||
<EFBFBD>皀⑧<EFBFBD> HDD /sys/hdread
|
||||
#13 **** ‘¨á⥬ -> <20> ¡®â á ä ©« ¬¨ ****
|
||||
KFM /sys/File Managers/kfm
|
||||
KFAR /sys/File Managers/kfar
|
||||
|
@ -289,7 +289,6 @@ CMM_PROGRAMS:=\
|
||||
OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \
|
||||
default.skn:DEFAULT.SKN \
|
||||
graph:GRAPH \
|
||||
../common/hdread:HDREAD \
|
||||
settings/icon.ini:SETTINGS/ICON.INI \
|
||||
../common/iconstrp.png:ICONSTRP.PNG index_htm:INDEX.HTM \
|
||||
kernel.mnt:KERNEL.MNT \
|
||||
|
@ -112,7 +112,6 @@ CPUID /sys/cpuid
|
||||
Ghost Monitor /sys/gmon
|
||||
K. Bus desconectado /sys/kbd
|
||||
Informaci¢n de HDD /sys/hdd_info
|
||||
Leer HDD /sys/hdread
|
||||
#13 **** ARCHIVOS ****
|
||||
KFAR /sys/File Managers/kfar
|
||||
KFM /sys/File Managers/kfm
|
||||
|
@ -1213,7 +1213,39 @@ fs_dyndisk_next_nomedia:
|
||||
; ecx = partition number, esi+ebp = ASCIIZ name
|
||||
fs_dyndisk:
|
||||
dec ecx ; convert to zero-based partition index
|
||||
pop edx edx edx eax ; edx = pointer to DISK, eax = NULL or edx
|
||||
pop edx edx edx ; edx = pointer to DISK, dword [esp] = NULL or edx
|
||||
; If the driver does not support insert notifications and we are the only fs
|
||||
; operation with this disk, ask the driver whether the media
|
||||
; was inserted/removed/changed. Otherwise, assume that media status is valid.
|
||||
test byte [edx+DISK.DriverFlags], DISK_NO_INSERT_NOTIFICATION
|
||||
jz .media_accurate
|
||||
push ecx esi
|
||||
mov esi, edx
|
||||
cmp dword [esp+8], 0
|
||||
jz .test_no_media
|
||||
cmp [esi+DISK.MediaRefCount], 2
|
||||
jnz .media_accurate_pop
|
||||
lea edx, [esi+DISK.MediaInfo]
|
||||
and [edx+DISKMEDIAINFO.Flags], 0
|
||||
mov al, DISKFUNC.querymedia
|
||||
stdcall disk_call_driver, edx
|
||||
test eax, eax
|
||||
jz .media_accurate_pop
|
||||
stdcall disk_media_dereference ; drop our reference so that disk_media_changed could close the media
|
||||
stdcall disk_media_changed, esi, 0
|
||||
and dword [esp+8], 0 ; no media
|
||||
.test_no_media:
|
||||
stdcall disk_media_changed, esi, 1 ; issue fake notification
|
||||
; if querymedia() inside disk_media_changed returns error, the notification is ignored
|
||||
cmp [esi+DISK.MediaInserted], 0
|
||||
jz .media_accurate_pop
|
||||
lock inc [esi+DISK.MediaRefCount]
|
||||
mov dword [esp+8], esi
|
||||
.media_accurate_pop:
|
||||
mov edx, esi
|
||||
pop esi ecx
|
||||
.media_accurate:
|
||||
pop eax
|
||||
test eax, eax
|
||||
jz .nomedia
|
||||
.main:
|
||||
@ -1252,30 +1284,6 @@ fs_dyndisk:
|
||||
.nomedia:
|
||||
test ecx, ecx
|
||||
jnz .notfound
|
||||
test byte [edx+DISK.DriverFlags], DISK_NO_INSERT_NOTIFICATION
|
||||
jz .deverror
|
||||
; if the driver does not support insert notifications and we are the only fs
|
||||
; operation with this disk, issue the fake insert notification; if media is
|
||||
; still not inserted, 'disk_media_changed' will detect this and do nothing
|
||||
lea ecx, [edx+DISK.MediaLock]
|
||||
call mutex_lock
|
||||
cmp [edx+DISK.MediaRefCount], 1
|
||||
jnz .noluck
|
||||
call mutex_unlock
|
||||
push edx
|
||||
stdcall disk_media_changed, edx, 1
|
||||
pop edx
|
||||
lea ecx, [edx+DISK.MediaLock]
|
||||
call mutex_lock
|
||||
cmp [edx+DISK.MediaInserted], 0
|
||||
jz .noluck
|
||||
lock inc [edx+DISK.MediaRefCount]
|
||||
call mutex_unlock
|
||||
xor ecx, ecx
|
||||
jmp .main
|
||||
.noluck:
|
||||
call mutex_unlock
|
||||
.deverror:
|
||||
mov dword [esp+32], ERROR_DEVICE
|
||||
mov esi, edx
|
||||
call disk_dereference
|
||||
|
@ -21,40 +21,48 @@ fdc_init: ;start with clean tracks.
|
||||
ret
|
||||
|
||||
save_image:
|
||||
call reserve_flp
|
||||
call restorefatchain
|
||||
cmp [ramdisk_actual_size], FLOPPY_CAPACITY
|
||||
jnz .fail
|
||||
pusha
|
||||
call check_label
|
||||
mov ecx, floppy_mutex
|
||||
call mutex_lock
|
||||
mov [flp_number], bl
|
||||
call floppy_read_bootsector
|
||||
cmp [FDC_Status], 0
|
||||
jne unnecessary_save_image
|
||||
jne .unnecessary_save_image
|
||||
mov [FDD_Track], 0; Цилиндр
|
||||
mov [FDD_Head], 0; Сторона
|
||||
mov [FDD_Sector], 1; Сектор
|
||||
mov esi, RAMDISK
|
||||
call SeekTrack
|
||||
save_image_1:
|
||||
push esi
|
||||
.save_image_1:
|
||||
call take_data_from_application_1
|
||||
pop esi
|
||||
add esi, 512
|
||||
call WriteSectWithRetr
|
||||
; call WriteSector
|
||||
cmp [FDC_Status], 0
|
||||
jne unnecessary_save_image
|
||||
jne .unnecessary_save_image
|
||||
inc [FDD_Sector]
|
||||
cmp [FDD_Sector], 19
|
||||
jne save_image_1
|
||||
jne .save_image_1
|
||||
mov [FDD_Sector], 1
|
||||
inc [FDD_Head]
|
||||
cmp [FDD_Head], 2
|
||||
jne save_image_1
|
||||
jne .save_image_1
|
||||
mov [FDD_Head], 0
|
||||
inc [FDD_Track]
|
||||
call SeekTrack
|
||||
cmp [FDD_Track], 80
|
||||
jne save_image_1
|
||||
unnecessary_save_image:
|
||||
jne .save_image_1
|
||||
.unnecessary_save_image:
|
||||
cmp [FDC_Status], 0
|
||||
pushf
|
||||
mov ecx, floppy_mutex
|
||||
call mutex_unlock
|
||||
popf
|
||||
popa
|
||||
mov [flp_status], 0
|
||||
jnz .fail
|
||||
xor eax, eax
|
||||
ret
|
||||
.fail:
|
||||
movi eax, 1
|
||||
ret
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
@ -20,8 +20,7 @@ $Revision$
|
||||
; add edi,ecx
|
||||
give_back_application_data_1:
|
||||
mov esi, FDD_BUFF;FDD_DataBuffer ;0x40000
|
||||
xor ecx, ecx
|
||||
mov cx, 128
|
||||
mov ecx, 128
|
||||
cld
|
||||
rep movsd
|
||||
ret
|
||||
@ -32,8 +31,7 @@ give_back_application_data_1:
|
||||
; add esi,ecx
|
||||
take_data_from_application_1:
|
||||
mov edi, FDD_BUFF;FDD_DataBuffer ;0x40000
|
||||
xor ecx, ecx
|
||||
mov cx, 128
|
||||
mov ecx, 128
|
||||
cld
|
||||
rep movsd
|
||||
ret
|
||||
@ -122,6 +120,7 @@ Init_FDC_DMA:
|
||||
;* AL - выводимый байт. *
|
||||
;***********************************
|
||||
FDCDataOutput:
|
||||
; DEBUGF 1,'K : FDCDataOutput(%x)',al
|
||||
; pusha
|
||||
push eax ecx edx
|
||||
mov AH, AL ;запомнить байт в AH
|
||||
@ -137,6 +136,7 @@ FDCDataOutput:
|
||||
je @@OutByteToFDC
|
||||
loop @@TestRS
|
||||
; Ошибка тайм-аута
|
||||
; DEBUGF 1,' timeout\n'
|
||||
mov [FDC_Status], FDC_TimeOut
|
||||
jmp @@End_5
|
||||
; Вывести байт в порт данных
|
||||
@ -144,6 +144,7 @@ FDCDataOutput:
|
||||
inc DX
|
||||
mov AL, AH
|
||||
out DX, AL
|
||||
; DEBUGF 1,' ok\n'
|
||||
@@End_5:
|
||||
; popa
|
||||
pop edx ecx eax
|
||||
@ -170,12 +171,14 @@ FDCDataInput:
|
||||
je @@GetByteFromFDC
|
||||
loop @@TestRS_1
|
||||
; Ошибка тайм-аута
|
||||
; DEBUGF 1,'K : FDCDataInput: timeout\n'
|
||||
mov [FDC_Status], FDC_TimeOut
|
||||
jmp @@End_6
|
||||
; Ввести байт из порта данных
|
||||
@@GetByteFromFDC:
|
||||
inc DX
|
||||
in AL, DX
|
||||
; DEBUGF 1,'K : FDCDataInput: %x\n',al
|
||||
@@End_6:
|
||||
pop DX
|
||||
pop ECX
|
||||
@ -185,6 +188,7 @@ FDCDataInput:
|
||||
;* ОБРАБОТЧИК ПРЕРЫВАНИЯ ОТ КОНТРОЛЛЕРА НГМД *
|
||||
;*********************************************
|
||||
FDCInterrupt:
|
||||
; dbgstr 'FDCInterrupt'
|
||||
; Установить флаг прерывания
|
||||
mov [FDD_IntFlag], 1
|
||||
mov al, 1
|
||||
@ -207,12 +211,12 @@ WaitFDCInterrupt:
|
||||
jnz @@End_7 ;прерывание произошло
|
||||
mov eax, [timer_ticks]
|
||||
sub eax, [TickCounter]
|
||||
cmp eax, 50 ;25 ;5 ;ожидать 5 тиков
|
||||
cmp eax, 200;50 ;25 ;5 ;ожидать 5 тиков
|
||||
jb @@TestRS_2
|
||||
; jl @@TestRS_2
|
||||
; Ошибка тайм-аута
|
||||
; dbgstr 'WaitFDCInterrupt: timeout'
|
||||
mov [FDC_Status], FDC_TimeOut
|
||||
; mov [flp_status],0
|
||||
@@End_7:
|
||||
popa
|
||||
ret
|
||||
@ -221,6 +225,7 @@ WaitFDCInterrupt:
|
||||
;* ВКЛЮЧИТЬ МОТОР ДИСКОВОДА "A:" *
|
||||
;*********************************
|
||||
FDDMotorON:
|
||||
; dbgstr 'FDDMotorON'
|
||||
pusha
|
||||
; cmp [fdd_motor_status],1
|
||||
; je fdd_motor_on
|
||||
@ -252,6 +257,20 @@ FDDMotorON_1:
|
||||
sub eax, [TickCounter]
|
||||
cmp eax, 50 ;10
|
||||
jb @@dT
|
||||
; Read results of RESET command
|
||||
push 4
|
||||
; DEBUGF 1,'K : floppy reset results:'
|
||||
@@:
|
||||
mov al, 8
|
||||
call FDCDataOutput
|
||||
call FDCDataInput
|
||||
; DEBUGF 1,' %x',al
|
||||
call FDCDataInput
|
||||
; DEBUGF 1,' %x',al
|
||||
dec dword [esp]
|
||||
jnz @b
|
||||
; DEBUGF 1,'\n'
|
||||
pop eax
|
||||
cmp [flp_number], 1
|
||||
jne fdd_motor_on_B
|
||||
mov [fdd_motor_status], 1
|
||||
@ -275,8 +294,6 @@ save_timer_fdd_motor:
|
||||
;* ПРОВЕРКА ЗАДЕРЖКИ ВЫКЛЮЧЕНИЯ МОТОРА *
|
||||
;*****************************************
|
||||
proc check_fdd_motor_status_has_work?
|
||||
cmp [flp_status], 0
|
||||
jnz .yes
|
||||
cmp [fdd_motor_status], 0
|
||||
jz .no
|
||||
mov eax, [timer_ticks]
|
||||
@ -303,7 +320,6 @@ check_fdd_motor_status:
|
||||
call FDDMotorOFF
|
||||
mov [fdd_motor_status], 0
|
||||
end_check_fdd_motor_status_1:
|
||||
mov [flp_status], 0
|
||||
end_check_fdd_motor_status:
|
||||
ret
|
||||
|
||||
@ -311,6 +327,7 @@ end_check_fdd_motor_status:
|
||||
;* ВЫКЛЮЧИТЬ МОТОР ДИСКОВОДА *
|
||||
;**********************************
|
||||
FDDMotorOFF:
|
||||
; dbgstr 'FDDMotorOFF'
|
||||
push AX
|
||||
push DX
|
||||
cmp [flp_number], 1
|
||||
@ -323,8 +340,8 @@ FDDMotorOFF_2:
|
||||
pop DX
|
||||
pop AX
|
||||
; сброс флагов кеширования в связи с устареванием информации
|
||||
mov [root_read], 0
|
||||
mov [flp_fat], 0
|
||||
or [floppy_media_flags+0], FLOPPY_MEDIA_NEED_RESCAN
|
||||
or [floppy_media_flags+1], FLOPPY_MEDIA_NEED_RESCAN
|
||||
ret
|
||||
|
||||
FDDMotorOFF_A:
|
||||
@ -343,8 +360,11 @@ FDDMotorOFF_B:
|
||||
;* РЕКАЛИБРОВКА ДИСКОВОДА "A:" *
|
||||
;*******************************
|
||||
RecalibrateFDD:
|
||||
; dbgstr 'RecalibrateFDD'
|
||||
pusha
|
||||
call save_timer_fdd_motor
|
||||
; Сбросить флаг прерывания
|
||||
mov [FDD_IntFlag], 0
|
||||
; Подать команду "Рекалибровка"
|
||||
mov AL, 07h
|
||||
call FDCDataOutput
|
||||
@ -352,10 +372,18 @@ RecalibrateFDD:
|
||||
call FDCDataOutput
|
||||
; Ожидать завершения операции
|
||||
call WaitFDCInterrupt
|
||||
; cmp [FDC_Status],0
|
||||
; je no_fdc_status_error
|
||||
; mov [flp_status],0
|
||||
;no_fdc_status_error:
|
||||
cmp [FDC_Status], 0
|
||||
jne .fail
|
||||
; Read results of RECALIBRATE command
|
||||
; DEBUGF 1,'K : floppy recalibrate results:'
|
||||
mov al, 8
|
||||
call FDCDataOutput
|
||||
call FDCDataInput
|
||||
; DEBUGF 1,' %x',al
|
||||
call FDCDataInput
|
||||
; DEBUGF 1,' %x',al
|
||||
; DEBUGF 1,'\n'
|
||||
.fail:
|
||||
call save_timer_fdd_motor
|
||||
popa
|
||||
ret
|
||||
@ -368,6 +396,7 @@ RecalibrateFDD:
|
||||
;* Результат операции заносится в FDC_Status. *
|
||||
;*****************************************************
|
||||
SeekTrack:
|
||||
; dbgstr 'SeekTrack'
|
||||
pusha
|
||||
call save_timer_fdd_motor
|
||||
; Сбросить флаг прерывания
|
||||
@ -402,17 +431,20 @@ SeekTrack:
|
||||
cmp AL, [FDD_Track]
|
||||
jne @@Err
|
||||
; Номер головки совпадает с заданным?
|
||||
mov AL, [FDC_ST0]
|
||||
and AL, 100b
|
||||
shr AL, 2
|
||||
cmp AL, [FDD_Head]
|
||||
jne @@Err
|
||||
; The H bit (Head Address) in ST0 will always return a "0" (c) 82077AA datasheet,
|
||||
; description of SEEK command. So we can not verify the proper head.
|
||||
; mov AL, [FDC_ST0]
|
||||
; and AL, 100b
|
||||
; shr AL, 2
|
||||
; cmp AL, [FDD_Head]
|
||||
; jne @@Err
|
||||
; Операция завершена успешно
|
||||
; dbgstr 'SeekTrack: FDC_Normal'
|
||||
mov [FDC_Status], FDC_Normal
|
||||
jmp @@Exit
|
||||
@@Err: ; Трек не найден
|
||||
; dbgstr 'SeekTrack: FDC_TrackNotFound'
|
||||
mov [FDC_Status], FDC_TrackNotFound
|
||||
; mov [flp_status],0
|
||||
@@Exit:
|
||||
call save_timer_fdd_motor
|
||||
popa
|
||||
@ -429,6 +461,7 @@ SeekTrack:
|
||||
;* содержимое сектора будет занесено в FDD_DataBuffer. *
|
||||
;*******************************************************
|
||||
ReadSector:
|
||||
; dbgstr 'ReadSector'
|
||||
pushad
|
||||
call save_timer_fdd_motor
|
||||
; Сбросить флаг прерывания
|
||||
@ -468,11 +501,12 @@ ReadSector:
|
||||
call GetStatusInfo
|
||||
test [FDC_ST0], 11011000b
|
||||
jnz @@Err_1
|
||||
; dbgstr 'ReadSector: FDC_Normal'
|
||||
mov [FDC_Status], FDC_Normal
|
||||
jmp @@Exit_1
|
||||
@@Err_1:
|
||||
; dbgstr 'ReadSector: FDC_SectorNotFound'
|
||||
mov [FDC_Status], FDC_SectorNotFound
|
||||
; mov [flp_status],0
|
||||
@@Exit_1:
|
||||
call save_timer_fdd_motor
|
||||
popad
|
||||
@ -511,12 +545,10 @@ ReadSectWithRetr:
|
||||
inc [RecalRepCounter]
|
||||
cmp [RecalRepCounter], 3
|
||||
jb @@TryAgain
|
||||
; mov [flp_status],0
|
||||
@@Exit_2:
|
||||
popa
|
||||
ret
|
||||
@@Err_3:
|
||||
mov [flp_status], 0
|
||||
popa
|
||||
ret
|
||||
|
||||
@ -531,6 +563,7 @@ ReadSectWithRetr:
|
||||
;* содержимое FDD_DataBuffer будет занесено в сектор. *
|
||||
;*******************************************************
|
||||
WriteSector:
|
||||
; dbgstr 'WriteSector'
|
||||
pushad
|
||||
call save_timer_fdd_motor
|
||||
; Сбросить флаг прерывания
|
||||
@ -616,7 +649,6 @@ WriteSectWithRetr:
|
||||
popa
|
||||
ret
|
||||
@@Err_4:
|
||||
mov [flp_status], 0
|
||||
popa
|
||||
ret
|
||||
|
||||
@ -642,3 +674,276 @@ GetStatusInfo:
|
||||
pop AX
|
||||
ret
|
||||
|
||||
; Interface for disk subsystem.
|
||||
; Assume fixed capacity for 1.44M.
|
||||
FLOPPY_CAPACITY = 2880 ; in sectors
|
||||
|
||||
iglobal
|
||||
align 4
|
||||
floppy_functions:
|
||||
dd .size
|
||||
dd 0 ; no close() function
|
||||
dd 0 ; no closemedia() function
|
||||
dd floppy_querymedia
|
||||
dd floppy_read
|
||||
dd floppy_write
|
||||
dd 0 ; no flush() function
|
||||
dd 0 ; no adjust_cache_size() function
|
||||
.size = $ - floppy_functions
|
||||
endg
|
||||
|
||||
uglobal
|
||||
floppy_media_flags rb 2
|
||||
n_sector dd 0 ; temporary save for sector value
|
||||
flp_number db 0 ; 1- Floppy A, 2-Floppy B
|
||||
old_track db 0 ; old value track
|
||||
flp_label rb 15*2 ; Label and ID of inserted floppy disk
|
||||
align 4
|
||||
; Hardware does not allow to work with two floppies in parallel,
|
||||
; so there is one mutex guarding access to any floppy.
|
||||
floppy_mutex MUTEX
|
||||
endg
|
||||
; Meaning of bits in floppy_media_flags
|
||||
FLOPPY_MEDIA_PRESENT = 1 ; media was present when last asked
|
||||
FLOPPY_MEDIA_NEED_RESCAN = 2 ; media was possibly changed, need to rescan
|
||||
FLOPPY_MEDIA_LABEL_CHANGED = 4 ; temporary state
|
||||
|
||||
iglobal
|
||||
floppy1_name db 'fd',0
|
||||
floppy2_name db 'fd2',0
|
||||
endg
|
||||
|
||||
; This function is called in boot process.
|
||||
; It creates filesystems /fd and/or /fd2, if the system has one/two floppy drives.
|
||||
proc floppy_init
|
||||
mov ecx, floppy_mutex
|
||||
call mutex_init
|
||||
; First floppy is present if [DRIVE_DATA] and 0xF0 is nonzero.
|
||||
test byte [DRIVE_DATA], 0xF0
|
||||
jz .no1
|
||||
stdcall disk_add, floppy_functions, floppy1_name, 1, DISK_NO_INSERT_NOTIFICATION
|
||||
.no1:
|
||||
; Second floppy is present if [DRIVE_DATA] and 0x0F is nonzero.
|
||||
test byte [DRIVE_DATA], 0x0F
|
||||
jz .no2
|
||||
stdcall disk_add, floppy_functions, floppy2_name, 2, DISK_NO_INSERT_NOTIFICATION
|
||||
.no2:
|
||||
ret
|
||||
endp
|
||||
|
||||
; Returns information about disk media.
|
||||
; Floppy drives do not support insert notifications,
|
||||
; DISK_NO_INSERT_NOTIFICATION is set,
|
||||
; the disk subsystem calls this function before each filesystem operation.
|
||||
; If the media has changed, return error for the first call as signal
|
||||
; to finalize work with old media and the true geometry for the second call.
|
||||
; Assume that media is (possibly) changed anytime when motor is off.
|
||||
proc floppy_querymedia
|
||||
virtual at esp+4
|
||||
.userdata dd ?
|
||||
.info dd ?
|
||||
end virtual
|
||||
; 1. Acquire the global lock.
|
||||
mov ecx, floppy_mutex
|
||||
call mutex_lock
|
||||
mov edx, [.userdata] ; 1 for /fd, 2 for /fd2
|
||||
; 2. If the media was reported and has been changed, forget it and report an error.
|
||||
mov al, [floppy_media_flags+edx-1]
|
||||
and al, FLOPPY_MEDIA_PRESENT + FLOPPY_MEDIA_NEED_RESCAN
|
||||
cmp al, FLOPPY_MEDIA_PRESENT + FLOPPY_MEDIA_NEED_RESCAN
|
||||
jnz .not_reported
|
||||
.no_media:
|
||||
mov [floppy_media_flags+edx-1], 0
|
||||
.return_no_media:
|
||||
mov ecx, floppy_mutex
|
||||
call mutex_unlock
|
||||
mov eax, DISK_STATUS_NO_MEDIA
|
||||
retn 8
|
||||
.not_reported:
|
||||
; 3. If we are in the temporary state LABEL_CHANGED, this is the second call
|
||||
; after intermediate DISK_STATUS_NO_MEDIA due to media change;
|
||||
; clear the flag and return the current geometry without rereading the bootsector.
|
||||
cmp [floppy_media_flags+edx-1], FLOPPY_MEDIA_LABEL_CHANGED
|
||||
jz .report_geometry
|
||||
; 4. Try to read the bootsector.
|
||||
mov [flp_number], dl
|
||||
mov [FDC_Status], 0
|
||||
call floppy_read_bootsector
|
||||
; 5. If reading bootsector failed, assume that media is not present.
|
||||
mov edx, [.userdata]
|
||||
cmp [FDC_Status], 0
|
||||
jnz .no_media
|
||||
; 6. Check whether the previous status is "present". If not, go to 10.
|
||||
push esi edi
|
||||
imul edi, edx, 15
|
||||
add edi, flp_label-15
|
||||
mov esi, FDD_BUFF+39
|
||||
mov ecx, 15
|
||||
test [floppy_media_flags+edx-1], FLOPPY_MEDIA_PRESENT
|
||||
jz .set_label
|
||||
; 7. Compare the old label with the current one.
|
||||
rep cmpsb
|
||||
; 8. If the label has not changed, go to 11.
|
||||
jz .ok
|
||||
; 9. If the label has changed, store it, enter temporary state LABEL_CHANGED
|
||||
; and report DISK_STATUS_NO_MEDIA.
|
||||
; dbgstr 'floppy label changed'
|
||||
add esi, ecx
|
||||
add edi, ecx
|
||||
mov ecx, 15
|
||||
sub esi, ecx
|
||||
sub edi, ecx
|
||||
rep movsb
|
||||
mov [floppy_media_flags+edx-1], FLOPPY_MEDIA_LABEL_CHANGED
|
||||
pop edi esi
|
||||
jmp .return_no_media
|
||||
.set_label:
|
||||
; 10. The previous state was "not present". Copy the label.
|
||||
rep movsb
|
||||
.ok:
|
||||
pop edi esi
|
||||
.report_geometry:
|
||||
; 11. Fill DISKMEDIAINFO structure.
|
||||
mov ecx, [.info]
|
||||
and [ecx+DISKMEDIAINFO.Flags], 0
|
||||
mov [ecx+DISKMEDIAINFO.SectorSize], 512
|
||||
mov dword [ecx+DISKMEDIAINFO.Capacity], FLOPPY_CAPACITY
|
||||
and dword [ecx+DISKMEDIAINFO.Capacity+4], 0
|
||||
; 12. Update state: media is present, data are actual.
|
||||
mov [floppy_media_flags+edx-1], FLOPPY_MEDIA_PRESENT
|
||||
; 13. Release the global lock and return successful status.
|
||||
mov ecx, floppy_mutex
|
||||
call mutex_unlock
|
||||
xor eax, eax
|
||||
retn 8
|
||||
endp
|
||||
|
||||
proc floppy_read_bootsector
|
||||
pushad
|
||||
mov [FDD_Track], 0; Цилиндр
|
||||
mov [FDD_Head], 0; Сторона
|
||||
mov [FDD_Sector], 1; Сектор
|
||||
call FDDMotorON
|
||||
call RecalibrateFDD
|
||||
cmp [FDC_Status], 0
|
||||
jne .nothing
|
||||
call SeekTrack
|
||||
cmp [FDC_Status], 0
|
||||
jne .nothing
|
||||
call ReadSectWithRetr
|
||||
.nothing:
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
read_chs_sector:
|
||||
call calculate_chs
|
||||
call ReadSectWithRetr
|
||||
ret
|
||||
|
||||
save_chs_sector:
|
||||
call calculate_chs
|
||||
call WriteSectWithRetr
|
||||
ret
|
||||
|
||||
calculate_chs:
|
||||
mov bl, [FDD_Track]
|
||||
mov [old_track], bl
|
||||
mov ebx, 18
|
||||
xor edx, edx
|
||||
div ebx
|
||||
inc edx
|
||||
mov [FDD_Sector], dl
|
||||
mov edx, eax
|
||||
shr eax, 1
|
||||
and edx, 1
|
||||
mov [FDD_Track], al
|
||||
mov [FDD_Head], dl
|
||||
mov dl, [old_track]
|
||||
cmp dl, [FDD_Track]
|
||||
je no_seek_track_1
|
||||
call SeekTrack
|
||||
no_seek_track_1:
|
||||
ret
|
||||
|
||||
; Writes one or more sectors to the device.
|
||||
proc floppy_write
|
||||
mov dl, 1
|
||||
jmp floppy_read_write
|
||||
endp
|
||||
|
||||
; Reads one or more sectors from the device.
|
||||
proc floppy_read
|
||||
mov dl, 0
|
||||
endp
|
||||
|
||||
; Common part of floppy_read and floppy_write.
|
||||
proc floppy_read_write userdata:dword, buffer:dword, start_sector:qword, numsectors_ptr:dword
|
||||
virtual at ebp-8
|
||||
.sectors_todo dd ?
|
||||
.operation db ?
|
||||
end virtual
|
||||
push edx ; save operation code to [.operation]
|
||||
; 1. Get number of sectors to read/write
|
||||
; and zero number of sectors that were actually read/written.
|
||||
mov eax, [numsectors_ptr]
|
||||
push dword [eax] ; initialize [.sectors_todo]
|
||||
and dword [eax], 0
|
||||
push ebx esi edi ; save used registers to be stdcall
|
||||
; 2. Acquire the global lock.
|
||||
mov ecx, floppy_mutex
|
||||
call mutex_lock
|
||||
; 3. Set floppy number for this operation.
|
||||
mov edx, [userdata]
|
||||
mov [flp_number], dl
|
||||
; 4. Read/write sector-by-sector.
|
||||
.operation_loop:
|
||||
; 4a. Check that the sector is inside the media.
|
||||
cmp dword [start_sector+4], 0
|
||||
jnz .end_of_media
|
||||
mov eax, dword [start_sector]
|
||||
cmp eax, FLOPPY_CAPACITY
|
||||
jae .end_of_media
|
||||
; 4b. For read operation, call read_chs_sector and then move data from FDD_BUFF to [buffer].
|
||||
; For write operation, move data from [buffer] to FDD_BUFF and then call save_chs_sector.
|
||||
cmp [.operation], 0
|
||||
jz .read
|
||||
mov esi, [buffer]
|
||||
mov edi, FDD_BUFF
|
||||
mov ecx, 512/4
|
||||
rep movsd
|
||||
mov [buffer], esi
|
||||
call save_chs_sector
|
||||
jmp @f
|
||||
.read:
|
||||
call read_chs_sector
|
||||
mov esi, FDD_BUFF
|
||||
mov edi, [buffer]
|
||||
mov ecx, 512/4
|
||||
rep movsd
|
||||
mov [buffer], edi
|
||||
@@:
|
||||
; 4c. If there was an error, propagate it to the caller.
|
||||
cmp [FDC_Status], 0
|
||||
jnz .fail
|
||||
; 4d. Otherwise, increment number of sectors processed and continue the loop.
|
||||
mov eax, [numsectors_ptr]
|
||||
inc dword [eax]
|
||||
inc dword [start_sector]
|
||||
dec [.sectors_todo]
|
||||
jnz .operation_loop
|
||||
; 5. Release the global lock and return with the correct status.
|
||||
push 0
|
||||
.return:
|
||||
mov ecx, floppy_mutex
|
||||
call mutex_unlock
|
||||
pop eax
|
||||
pop edi esi ebx ; restore used registers to be stdcall
|
||||
ret ; this translates to leave/retn N and purges local variables
|
||||
.fail:
|
||||
push -1
|
||||
jmp .return
|
||||
.end_of_media:
|
||||
push DISK_STATUS_END_OF_MEDIA
|
||||
jmp .return
|
||||
endp
|
||||
|
@ -47,6 +47,10 @@ hd0_data HD_DATA ?, 0, 1
|
||||
hd1_data HD_DATA ?, 0x10, 2
|
||||
hd2_data HD_DATA ?, 0, 3
|
||||
hd3_data HD_DATA ?, 0x10, 4
|
||||
|
||||
hd_address_table:
|
||||
dd 0x1f0, 0x00, 0x1f0, 0x10
|
||||
dd 0x170, 0x00, 0x170, 0x10
|
||||
endg
|
||||
|
||||
uglobal
|
||||
@ -645,14 +649,6 @@ hd_write_error:
|
||||
end if
|
||||
ret
|
||||
;-----------------------------------------------------------------------------
|
||||
hd_lba_error:
|
||||
if lang eq sp
|
||||
DEBUGF 1,"K : FS - HD error en LBA\n"
|
||||
else
|
||||
DEBUGF 1,"K : FS - HD LBA error\n"
|
||||
end if
|
||||
jmp LBA_read_ret
|
||||
;-----------------------------------------------------------------------------
|
||||
align 4
|
||||
wait_for_hd_idle:
|
||||
push eax edx
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -13,16 +13,19 @@ saverd_fileinfo:
|
||||
dd 2 ; subfunction: write
|
||||
dd 0 ; (reserved)
|
||||
dd 0 ; (reserved)
|
||||
dd 1440*1024 ; size 1440 Kb
|
||||
.size:
|
||||
dd 0
|
||||
dd RAMDISK
|
||||
db 0
|
||||
.name:
|
||||
dd ?
|
||||
endg
|
||||
sysfn_saveramdisk: ; 18.6 = SAVE FLOPPY IMAGE (HD version only)
|
||||
call restorefatchain
|
||||
mov ebx, saverd_fileinfo
|
||||
mov [saverd_fileinfo.name], ecx
|
||||
mov [ebx+21], ecx
|
||||
mov eax, [ramdisk_actual_size]
|
||||
shl eax, 9
|
||||
mov [ebx+12], eax
|
||||
pushad
|
||||
call file_system_lfn_protected ;in ebx
|
||||
popad
|
||||
|
@ -659,10 +659,6 @@ terminate: ; terminate application
|
||||
jnz @f
|
||||
call free_cd_channel
|
||||
and [cd_status], 0
|
||||
@@:
|
||||
cmp [flp_status], esi
|
||||
jnz @f
|
||||
and [flp_status], 0
|
||||
@@:
|
||||
pop esi
|
||||
cmp [bgrlockpid], esi
|
||||
|
@ -7,20 +7,6 @@
|
||||
|
||||
$Revision$
|
||||
|
||||
; Old style system call converter
|
||||
align 16
|
||||
cross_order:
|
||||
; load all registers in crossed order
|
||||
mov eax, ebx
|
||||
mov ebx, ecx
|
||||
mov ecx, edx
|
||||
mov edx, esi
|
||||
mov esi, edi
|
||||
movzx edi, byte[esp+28 + 4]
|
||||
sub edi, 53
|
||||
call dword [servetable+edi*4]
|
||||
ret
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; SYSENTER ENTRY ;;
|
||||
@ -109,24 +95,6 @@ iglobal
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; SYSTEM FUNCTIONS TABLE ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
align 4
|
||||
servetable:
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd file_system ; 58-Common file system interface
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; NEW SYSTEM FUNCTIONS TABLE ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
align 4
|
||||
servetable2:
|
||||
|
||||
@ -136,7 +104,7 @@ iglobal
|
||||
dd sys_clock ; 3-GetTime
|
||||
dd syscall_writetext ; 4-WriteText
|
||||
dd delay_hs_unprotected ; 5-DelayHs
|
||||
dd syscall_openramdiskfile ; 6-OpenRamdiskFile
|
||||
dd undefined_syscall ; 6-deprecated OpenRamdiskFile
|
||||
dd syscall_putimage ; 7-PutImage
|
||||
dd syscall_button ; 8-DefineButton
|
||||
dd sys_cpuusage ; 9-GetProcessInfo
|
||||
@ -188,7 +156,7 @@ iglobal
|
||||
dd sound_interface ; 55-Sound interface
|
||||
dd undefined_syscall ; 56-reserved
|
||||
dd sys_pcibios ; 57-PCI BIOS32
|
||||
dd cross_order ; 58-Common file system interface
|
||||
dd undefined_syscall ; 58-deprecated Common file system interface
|
||||
dd undefined_syscall ; 59-reserved
|
||||
dd sys_IPC ; 60-Inter Process Communication
|
||||
dd sys_gs ; 61-Direct graphics access
|
||||
|
@ -51,7 +51,7 @@ keymap_alt:
|
||||
if lang eq ru
|
||||
boot_initirq cp866 'Инициализация IRQ',0
|
||||
boot_picinit cp866 'Инициализация PIC',0
|
||||
boot_v86machine cp866 'Инициализация системы V86 машины',0
|
||||
boot_v86machine cp866 'Инициализация системной V86 машины',0
|
||||
boot_inittimer cp866 'Инициализация системного таймера (IRQ0)',0
|
||||
boot_initapic cp866 'Попытка инициализации APIC',0
|
||||
boot_enableirq cp866 'Включить прерывания 2, 13',0
|
||||
@ -69,6 +69,7 @@ if lang eq ru
|
||||
boot_cpuid cp866 'Чтение CPUIDs',0
|
||||
; boot_devices cp866 'Поиск устройств',0
|
||||
boot_timer cp866 'Установка таймера',0
|
||||
boot_initramdisk cp866 'Инициализация рамдиска',0
|
||||
boot_irqs cp866 'Переопределение IRQ',0
|
||||
boot_setmouse cp866 'Установка мыши',0
|
||||
boot_windefs cp866 'Установка настроек окон по умолчанию',0
|
||||
@ -98,6 +99,7 @@ else
|
||||
boot_picinit db 'Initialize PIC',0
|
||||
boot_v86machine db 'Initialize system V86 machine',0
|
||||
boot_inittimer db 'Initialize system timer (IRQ0)',0
|
||||
boot_initramdisk db 'Initialize ramdisk',0
|
||||
boot_initapic db 'Try to initialize APIC',0
|
||||
boot_enableirq db 'Enable interrupts 2, 13',0
|
||||
boot_disabling_ide db 'Disable interrupts in IDE controller',0
|
||||
@ -172,7 +174,13 @@ end if
|
||||
|
||||
vmode db '/sys/drivers/VMODE.MDR',0
|
||||
;vrr_m db 'VRR_M',0
|
||||
kernel_file db 'KERNEL MNT'
|
||||
kernel_file_load:
|
||||
; load kernel.mnt to 0x7000:0
|
||||
dd 0 ; subfunction
|
||||
dq 0 ; offset in file
|
||||
dd 0x30000 ; number of bytes to read
|
||||
dd 0x70000 ; buffer for data
|
||||
db '/RD/1/KERNEL.MNT',0
|
||||
|
||||
dev_data_path db '/RD/1/DRIVERS/DEVICES.DAT',0
|
||||
|
||||
@ -570,8 +578,7 @@ end if
|
||||
org (OS_BASE+0x0100000)
|
||||
|
||||
RAMDISK: rb 2880*512
|
||||
RAMDISK_FAT: rb 2856*2
|
||||
FLOPPY_FAT: rb 2856*2
|
||||
rb 2856*4 ; not used
|
||||
|
||||
_CLEAN_ZONE:
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
boot_picinit latin1 'Algväärtustan PIC',0
|
||||
boot_v86machine latin1 'Algväärtustan süsteemi V86 masinat',0
|
||||
boot_inittimer latin1 'Algväärtustan süsteemi taimerit (IRQ0)',0
|
||||
boot_initramdisk latin1 'Initialize ramdisk',0
|
||||
boot_initapic latin1 'Proovin Algväärtustada APIC',0
|
||||
boot_enableirq latin1 'Luban katkestused 2, 13',0
|
||||
boot_disabling_ide latin1 'Keelan IDE kontrolleri katkestused',0
|
||||
|
@ -2,6 +2,7 @@
|
||||
boot_picinit: cp850 'Inicializar PIC',0
|
||||
boot_v86machine: cp850 'Inicializar sistema V86',0
|
||||
boot_inittimer: cp850 'Inicializar reloj del sistema (IRQ0)',0
|
||||
boot_initramdisk cp850 'Initialize ramdisk',0
|
||||
boot_initapic: cp850 'Prueba inicializar APIC',0
|
||||
boot_enableirq: cp850 'Habilitar interrupciones 2, 13',0
|
||||
boot_disabling_ide:cp850 'Habiliar interrupciones en controladores IDE',0
|
||||
|
@ -33,5 +33,6 @@ wait_cmos:
|
||||
|
||||
stdcall attach_int_handler, 6, FDCInterrupt, 0
|
||||
DEBUGF 1, "K : Set IDE IRQ6 return code %x\n", eax
|
||||
call floppy_init
|
||||
@@:
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,12 +0,0 @@
|
||||
dir0:
|
||||
db 'KÕVAKETAS '
|
||||
db 'MÄLUKETAS '
|
||||
db 'FLOPPIKETAS'
|
||||
db 0
|
||||
|
||||
dir1:
|
||||
db 'ESIMENE '
|
||||
db 'TEINE '
|
||||
db 'KOLAMS '
|
||||
db 'NELJAS '
|
||||
db 0
|
@ -1,13 +0,0 @@
|
||||
dir0:
|
||||
db 'DISCO DURO '
|
||||
db 'UNIDAD RAM '
|
||||
db 'DISQUETE '
|
||||
db 0
|
||||
|
||||
dir1:
|
||||
db 'PRIMERO '
|
||||
db 'SEGUNDO '
|
||||
db 'TERCERO '
|
||||
db 'CUARTO '
|
||||
db 0
|
||||
|
@ -1,682 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;; ;;
|
||||
;; System service for filesystem call ;;
|
||||
;; (C) 2004 Ville Turjanmaa, License: GPL ;;
|
||||
;; 29.04.2006 Elimination of hangup after the ;;
|
||||
;; expiration hd_wait_timeout (for LBA) - Mario79 ;;
|
||||
;; 15.01.2005 get file size/attr/date, ;;
|
||||
;; file_append (only for hd) - ATV ;;
|
||||
;; 23.11.2004 test if hd/partition is set - ATV ;;
|
||||
;; 18.11.2004 get_disk_info and more error codes - ATV ;;
|
||||
;; 08.11.2004 expand_pathz and rename (only for hd) - ATV ;;
|
||||
;; 20.10.2004 Makedir/Removedir (only for hd) - ATV ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
$Revision$
|
||||
|
||||
|
||||
iglobal
|
||||
|
||||
if lang eq sp
|
||||
include 'fs/fs-sp.inc'
|
||||
else if lang eq et
|
||||
include 'fs/fs-et.inc'
|
||||
else
|
||||
dir0:
|
||||
db 'HARDDISK '
|
||||
db 'RAMDISK '
|
||||
db 'FLOPPYDISK '
|
||||
db 0
|
||||
|
||||
dir1:
|
||||
db 'FIRST '
|
||||
db 'SECOND '
|
||||
db 'THIRD '
|
||||
db 'FOURTH '
|
||||
db 0
|
||||
end if
|
||||
|
||||
not_select_IDE db 0
|
||||
|
||||
hd_address_table:
|
||||
dd 0x1f0,0x00,0x1f0,0x10
|
||||
dd 0x170,0x00,0x170,0x10
|
||||
endg
|
||||
|
||||
file_system:
|
||||
|
||||
; IN:
|
||||
;
|
||||
; eax = 0 ; read file /RamDisk/First 6
|
||||
; eax = 8 ; lba read
|
||||
; eax = 15 ; get_disk_info
|
||||
;
|
||||
; OUT:
|
||||
;
|
||||
; eax = 0 : read ok
|
||||
; eax = 1 : no hd base and/or partition defined
|
||||
; eax = 2 : function is unsupported for this FS
|
||||
; eax = 3 : unknown FS
|
||||
; eax = 4 : partition not defined at hd
|
||||
; eax = 5 : file not found
|
||||
; eax = 6 : end of file
|
||||
; eax = 7 : memory pointer not in application area
|
||||
; eax = 8 : disk full
|
||||
; eax = 9 : fat table corrupted
|
||||
; eax = 10 : access denied
|
||||
; eax = 11 : disk error
|
||||
;
|
||||
; ebx = size
|
||||
|
||||
; \begin{diamond}[18.03.2006]
|
||||
; for subfunction 16 (start application) error codes must be negative
|
||||
; because positive values are valid PIDs
|
||||
; so possible return values are:
|
||||
; eax > 0 : process created, eax=PID
|
||||
|
||||
; -0x10 <= eax < 0 : -eax is filesystem error code:
|
||||
; eax = -1 = 0xFFFFFFFF : no hd base and/or partition defined
|
||||
; eax = -3 = 0xFFFFFFFD : unknown FS
|
||||
; eax = -5 = 0xFFFFFFFB : file not found
|
||||
; eax = -6 = 0xFFFFFFFA : unexpected end of file (probably not executable file)
|
||||
; eax = -9 = 0xFFFFFFF7 : fat table corrupted
|
||||
; eax = -10 = 0xFFFFFFF6 : access denied
|
||||
|
||||
; -0x20 <= eax < -0x10: eax is process creation error code:
|
||||
; eax = -0x20 = 0xFFFFFFE0 : too many processes
|
||||
; eax = -0x1F = 0xFFFFFFE1 : not Menuet/Kolibri executable
|
||||
; eax = -0x1E = 0xFFFFFFE2 : no memory
|
||||
|
||||
; ebx is not changed
|
||||
|
||||
; \end{diamond}[18.03.2006]
|
||||
|
||||
; Extract parameters
|
||||
; add eax, std_application_base_address ; abs start of info block
|
||||
|
||||
cmp dword [eax+0], 15; GET_DISK_INFO
|
||||
je fs_info
|
||||
|
||||
cmp dword [CURRENT_TASK], 1; no memory checks for kernel requests
|
||||
jz no_checks_for_kernel
|
||||
mov edx, eax
|
||||
cmp dword [eax+0], 1
|
||||
jnz .usual_check
|
||||
mov ebx, [eax+12]
|
||||
; add ebx,std_application_base_address
|
||||
mov ecx, [eax+8]
|
||||
call check_region
|
||||
test eax, eax
|
||||
jnz area_in_app_mem
|
||||
|
||||
.error_output:
|
||||
mov esi, buffer_failed
|
||||
call sys_msg_board_str
|
||||
; mov eax,7
|
||||
mov dword [esp+36], 7
|
||||
ret
|
||||
iglobal
|
||||
buffer_failed db 'K : Buffer check failed',13,10,0
|
||||
endg
|
||||
.usual_check:
|
||||
cmp dword [eax+0], 0
|
||||
mov ecx, 512
|
||||
jnz .small_size
|
||||
mov ecx, [eax+8]
|
||||
shl ecx, 9
|
||||
.small_size:
|
||||
mov ebx, [eax+12]
|
||||
; add ebx,std_application_base_address
|
||||
call check_region
|
||||
test eax, eax
|
||||
jz .error_output
|
||||
area_in_app_mem:
|
||||
mov eax, edx
|
||||
no_checks_for_kernel:
|
||||
|
||||
fs_read:
|
||||
|
||||
mov ebx, [eax+20] ; program wants root directory ?
|
||||
test bl, bl
|
||||
je fs_getroot
|
||||
test bh, bh
|
||||
jne fs_noroot
|
||||
fs_getroot:
|
||||
; \begin{diamond}[18.03.2006]
|
||||
; root - only read is allowed
|
||||
; other operations return "access denied", eax=10
|
||||
; (execute operation returns eax=-10)
|
||||
cmp dword [eax], 0
|
||||
jz .read_root
|
||||
mov dword [esp+36], 10
|
||||
ret
|
||||
.read_root:
|
||||
; \end{diamond}[18.03.2006]
|
||||
mov esi, dir0
|
||||
mov edi, [eax+12]
|
||||
; add edi,std_application_base_address
|
||||
mov ecx, 11
|
||||
push ecx
|
||||
; cld ; already is
|
||||
rep movsb
|
||||
mov al, 0x10
|
||||
stosb
|
||||
add edi, 32-11-1
|
||||
pop ecx
|
||||
rep movsb
|
||||
stosb
|
||||
and dword [esp+36], 0; ok read
|
||||
mov dword [esp+24], 32*2; size of root
|
||||
ret
|
||||
|
||||
fs_info: ;start of code - Mihasik
|
||||
push eax
|
||||
cmp [eax+21], byte 'r'
|
||||
je fs_info_r
|
||||
cmp [eax+21], byte 'R'
|
||||
je fs_info_r
|
||||
mov eax, 3 ;if unknown disk
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
xor edx, edx
|
||||
jmp fs_info1
|
||||
fs_info_r:
|
||||
call ramdisk_free_space;if ramdisk
|
||||
mov ecx, edi ;free space in ecx
|
||||
shr ecx, 9 ;free clusters
|
||||
mov ebx, 2847 ;total clusters
|
||||
mov edx, 512 ;cluster size
|
||||
xor eax, eax ;always 0
|
||||
fs_info1:
|
||||
pop edi
|
||||
mov [esp+36], eax
|
||||
mov [esp+24], ebx ; total clusters on disk
|
||||
mov [esp+32], ecx ; free clusters on disk
|
||||
mov [edi], edx ; cluster size in bytes
|
||||
ret ;end of code - Mihasik
|
||||
|
||||
fs_noroot:
|
||||
|
||||
push dword [eax+0] ; read/write/delete/.../makedir/rename/lba/run
|
||||
push dword [eax+4] ; 512 block number to read
|
||||
push dword [eax+8] ; bytes to write/append or 512 blocks to read
|
||||
mov ebx, [eax+12]
|
||||
; add ebx,std_application_base_address
|
||||
push ebx ; abs start of return/save area
|
||||
|
||||
lea esi, [eax+20] ; abs start of dir + filename
|
||||
mov edi, [eax+16]
|
||||
; add edi,std_application_base_address ; abs start of work area
|
||||
|
||||
call expand_pathz
|
||||
|
||||
push edi ; dir start
|
||||
push ebx ; name of file start
|
||||
|
||||
mov eax, [edi+1]
|
||||
cmp eax, 'RD '
|
||||
je fs_yesramdisk
|
||||
cmp eax, 'RAMD'
|
||||
jne fs_noramdisk
|
||||
|
||||
fs_yesramdisk:
|
||||
|
||||
cmp byte [edi+1+11], 0
|
||||
je fs_give_dir1
|
||||
|
||||
mov eax, [edi+1+12]
|
||||
cmp eax, '1 '
|
||||
je fs_yesramdisk_first
|
||||
cmp eax, 'FIRS'
|
||||
jne fs_noramdisk
|
||||
|
||||
fs_yesramdisk_first:
|
||||
|
||||
cmp dword [esp+20], 8; LBA read ramdisk
|
||||
jne fs_no_LBA_read_ramdisk
|
||||
|
||||
mov eax, [esp+16] ; LBA block to read
|
||||
mov ecx, [esp+8] ; abs pointer to return area
|
||||
|
||||
call LBA_read_ramdisk
|
||||
jmp file_system_return
|
||||
|
||||
|
||||
fs_no_LBA_read_ramdisk:
|
||||
|
||||
cmp dword [esp+20], 0; READ
|
||||
jne fs_noramdisk_read
|
||||
|
||||
mov eax, [esp+4] ; fname
|
||||
add eax, 2*12+1
|
||||
mov ebx, [esp+16] ; block start
|
||||
inc ebx
|
||||
mov ecx, [esp+12] ; block count
|
||||
mov edx, [esp+8] ; return
|
||||
mov esi, [esp+0]
|
||||
sub esi, eax
|
||||
add esi, 12+1 ; file name length
|
||||
call fileread
|
||||
|
||||
jmp file_system_return
|
||||
|
||||
|
||||
fs_noramdisk_read:
|
||||
fs_noramdisk:
|
||||
|
||||
;********************************************************************
|
||||
mov eax, [edi+1]
|
||||
cmp eax, 'FD '
|
||||
je fs_yesflpdisk
|
||||
cmp eax, 'FLOP'
|
||||
jne fs_noflpdisk
|
||||
|
||||
fs_yesflpdisk:
|
||||
call reserve_flp
|
||||
|
||||
cmp byte [edi+1+11], 0
|
||||
je fs_give_dir1
|
||||
|
||||
mov eax, [edi+1+12]
|
||||
cmp eax, '1 '
|
||||
je fs_yesflpdisk_first
|
||||
cmp eax, 'FIRS'
|
||||
je fs_yesflpdisk_first
|
||||
cmp eax, '2 '
|
||||
je fs_yesflpdisk_second
|
||||
cmp eax, 'SECO'
|
||||
jne fs_noflpdisk
|
||||
jmp fs_yesflpdisk_second
|
||||
|
||||
fs_yesflpdisk_first:
|
||||
mov [flp_number], 1
|
||||
jmp fs_yesflpdisk_start
|
||||
fs_yesflpdisk_second:
|
||||
mov [flp_number], 2
|
||||
fs_yesflpdisk_start:
|
||||
cmp dword [esp+20], 0; READ
|
||||
jne fs_noflpdisk_read
|
||||
|
||||
mov eax, [esp+4] ; fname
|
||||
add eax, 2*12+1
|
||||
mov ebx, [esp+16] ; block start
|
||||
inc ebx
|
||||
mov ecx, [esp+12] ; block count
|
||||
mov edx, [esp+8] ; return
|
||||
mov esi, [esp+0]
|
||||
sub esi, eax
|
||||
add esi, 12+1 ; file name length
|
||||
call floppy_fileread
|
||||
|
||||
jmp file_system_return
|
||||
|
||||
|
||||
fs_noflpdisk_read:
|
||||
fs_noflpdisk:
|
||||
;*****************************************************************
|
||||
|
||||
old_path_harddisk:
|
||||
mov eax, [edi+1]
|
||||
cmp eax, 'HD '
|
||||
je fs_yesharddisk
|
||||
cmp eax, 'HARD'
|
||||
jne fs_noharddisk
|
||||
|
||||
fs_yesharddisk:
|
||||
cmp dword [esp+20], 8; LBA read
|
||||
jne fs_no_LBA_read
|
||||
mov eax, [esp+16] ; LBA block to read
|
||||
lea ebx, [edi+1+12] ; pointer to FIRST/SECOND/THIRD/FOURTH
|
||||
mov ecx, [esp+8] ; abs pointer to return area
|
||||
call LBA_read
|
||||
jmp file_system_return
|
||||
|
||||
fs_no_LBA_read:
|
||||
|
||||
hd_err_return:
|
||||
|
||||
fs_noharddisk:
|
||||
; \begin{diamond}[18.03.2006]
|
||||
mov eax, 5 ; file not found
|
||||
; а может быть, возвращать другой код ошибки?
|
||||
mov ebx, [esp+24+24]; do not change ebx in application
|
||||
; \end{diamond}[18.03.2006]
|
||||
|
||||
file_system_return:
|
||||
|
||||
add esp, 24
|
||||
|
||||
mov [esp+36], eax
|
||||
mov [esp+24], ebx
|
||||
ret
|
||||
|
||||
|
||||
fs_give_dir1:
|
||||
|
||||
; \begin{diamond}[18.03.2006]
|
||||
; /RD,/FD,/HD - only read is allowed
|
||||
; other operations return "access denied", eax=10
|
||||
; (execute operation returns eax=-10)
|
||||
cmp dword [esp+20], 0
|
||||
jz .read
|
||||
add esp, 20
|
||||
pop ecx
|
||||
mov dword [esp+36], 10
|
||||
ret
|
||||
.read:
|
||||
; \end{diamond}[18.03.2006]
|
||||
mov al, 0x10
|
||||
mov ebx, 1
|
||||
mov edi, [esp+8]
|
||||
mov esi, dir1
|
||||
fs_d1_new:
|
||||
mov ecx, 11
|
||||
; cld
|
||||
rep movsb
|
||||
stosb
|
||||
add edi, 32-11-1
|
||||
dec ebx
|
||||
jne fs_d1_new
|
||||
|
||||
add esp, 24
|
||||
|
||||
and dword [esp+36], 0; ok read
|
||||
mov dword [esp+24], 32*1; dir/data size
|
||||
ret
|
||||
|
||||
|
||||
|
||||
LBA_read_ramdisk:
|
||||
|
||||
cmp [lba_read_enabled], 1
|
||||
je lbarrl1
|
||||
|
||||
xor ebx, ebx
|
||||
mov eax, 2
|
||||
ret
|
||||
|
||||
lbarrl1:
|
||||
|
||||
cmp eax, 18*2*80
|
||||
jb lbarrl2
|
||||
xor ebx, ebx
|
||||
mov eax, 3
|
||||
ret
|
||||
|
||||
lbarrl2:
|
||||
|
||||
pushad
|
||||
|
||||
call restorefatchain
|
||||
|
||||
mov edi, ecx
|
||||
mov esi, eax
|
||||
|
||||
shl esi, 9
|
||||
add esi, RAMDISK
|
||||
mov ecx, 512/4
|
||||
; cld
|
||||
rep movsd
|
||||
|
||||
popad
|
||||
|
||||
xor ebx, ebx
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
LBA_read:
|
||||
|
||||
; IN:
|
||||
;
|
||||
; eax = LBA block to read
|
||||
; ebx = pointer to FIRST/SECOND/THIRD/FOURTH
|
||||
; ecx = abs pointer to return area
|
||||
|
||||
cmp [lba_read_enabled], 1
|
||||
je lbarl1
|
||||
mov eax, 2
|
||||
ret
|
||||
|
||||
lbarl1:
|
||||
|
||||
pushad
|
||||
mov ecx, ide_mutex
|
||||
call mutex_lock
|
||||
popad
|
||||
|
||||
push eax
|
||||
push ecx
|
||||
|
||||
mov edi, hd_address_table
|
||||
mov esi, dir1
|
||||
mov eax, [ebx]
|
||||
mov edx, '1 '
|
||||
mov ecx, 4
|
||||
blar0:
|
||||
cmp eax, [esi]
|
||||
je blar2
|
||||
cmp eax, edx
|
||||
je blar2
|
||||
inc edx
|
||||
add edi, 8
|
||||
add esi, 11
|
||||
dec ecx
|
||||
jnz blar0
|
||||
|
||||
mov eax, 1
|
||||
mov ebx, 1
|
||||
jmp LBA_read_ret
|
||||
|
||||
blar2:
|
||||
mov eax, [edi+0]
|
||||
mov ebx, [edi+4]
|
||||
|
||||
mov [hdbase], eax
|
||||
mov [hdid], ebx
|
||||
|
||||
call wait_for_hd_idle
|
||||
cmp [hd_error], 0
|
||||
jne hd_lba_error
|
||||
|
||||
; eax = hd port
|
||||
; ebx = set for primary (0x00) or slave (0x10)
|
||||
|
||||
cli
|
||||
|
||||
mov edx, eax
|
||||
inc edx
|
||||
xor eax, eax
|
||||
out dx, al
|
||||
inc edx
|
||||
inc eax
|
||||
out dx, al
|
||||
inc edx
|
||||
mov eax, [esp+4]
|
||||
out dx, al
|
||||
shr eax, 8
|
||||
inc edx
|
||||
out dx, al
|
||||
shr eax, 8
|
||||
inc edx
|
||||
out dx, al
|
||||
shr eax, 8
|
||||
inc edx
|
||||
and al, 1+2+4+8
|
||||
add al, bl
|
||||
add al, 128+64+32
|
||||
out dx, al
|
||||
|
||||
inc edx
|
||||
mov al, 20h
|
||||
out dx, al
|
||||
|
||||
sti
|
||||
|
||||
call wait_for_sector_buffer
|
||||
cmp [hd_error], 0
|
||||
jne hd_lba_error
|
||||
|
||||
cli
|
||||
|
||||
mov edi, [esp+0]
|
||||
mov ecx, 256
|
||||
sub edx, 7
|
||||
cld
|
||||
rep insw
|
||||
|
||||
sti
|
||||
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
|
||||
LBA_read_ret:
|
||||
mov [hd_error], 0
|
||||
mov [hd1_status], 0
|
||||
add esp, 2*4
|
||||
pushad
|
||||
mov ecx, ide_mutex
|
||||
call mutex_unlock
|
||||
popad
|
||||
|
||||
ret
|
||||
|
||||
|
||||
expand_pathz:
|
||||
; IN:
|
||||
; esi = asciiz path & file
|
||||
; edi = buffer for path & file name
|
||||
; OUT:
|
||||
; edi = directory & file : / 11 + / 11 + / 11 - zero terminated
|
||||
; ebx = /file name - zero terminated
|
||||
; esi = pointer after source
|
||||
|
||||
push eax
|
||||
push ecx
|
||||
push edi;[esp+0]
|
||||
|
||||
pathz_start:
|
||||
mov byte [edi], '/'
|
||||
inc edi
|
||||
mov al, 32
|
||||
mov ecx, 11
|
||||
cld
|
||||
rep stosb ; clear filename area
|
||||
sub edi, 11
|
||||
mov ebx, edi ; start of dir/file name
|
||||
|
||||
pathz_new_char:
|
||||
mov al, [esi]
|
||||
inc esi
|
||||
cmp al, 0
|
||||
je pathz_end
|
||||
|
||||
cmp al, '/'
|
||||
jne pathz_not_path
|
||||
cmp edi, ebx ; skip first '/'
|
||||
jz pathz_new_char
|
||||
lea edi, [ebx+11] ; start of next directory
|
||||
jmp pathz_start
|
||||
|
||||
pathz_not_path:
|
||||
cmp al, '.'
|
||||
jne pathz_not_ext
|
||||
lea edi, [ebx+8] ; start of extension
|
||||
jmp pathz_new_char
|
||||
|
||||
pathz_not_ext:
|
||||
cmp al, 'a'
|
||||
jb pathz_not_low
|
||||
cmp al, 'z'
|
||||
ja pathz_not_low
|
||||
sub al, 0x20 ; char to uppercase
|
||||
|
||||
pathz_not_low:
|
||||
mov [edi], al
|
||||
inc edi
|
||||
mov eax, [esp+0] ; start_of_dest_path
|
||||
add eax, 512 ; keep maximum path under 512 bytes
|
||||
cmp edi, eax
|
||||
jb pathz_new_char
|
||||
|
||||
pathz_end:
|
||||
cmp ebx, edi ; if path end with '/'
|
||||
jnz pathz_put_zero ; go back 1 level
|
||||
sub ebx, 12
|
||||
|
||||
pathz_put_zero:
|
||||
mov byte [ebx+11], 0
|
||||
dec ebx ; include '/' char into file name
|
||||
pop edi
|
||||
pop ecx
|
||||
pop eax
|
||||
ret
|
||||
|
||||
;*******************************************
|
||||
;* string to number
|
||||
;* input eax - 4 byte string
|
||||
;* output eax - number
|
||||
;*******************************************
|
||||
StringToNumber:
|
||||
; ПЕРЕВОД СТРОКОВОГО ЧИСЛА В ЧИСЛОВОЙ ВИД
|
||||
; Вход:
|
||||
; EDI - адрес строки с числом. Конец числа отмечен кодом 0Dh
|
||||
; Выход:
|
||||
; CF - индикатор ошибок:
|
||||
; 0 - ошибок нет;
|
||||
; 1 - ошибка
|
||||
; Если CF=0, то AX - число.
|
||||
|
||||
push bx
|
||||
push cx
|
||||
push dx
|
||||
push edi
|
||||
mov [partition_string], eax
|
||||
mov edi, partition_string
|
||||
xor cx, cx
|
||||
i1:
|
||||
mov al, [edi]
|
||||
cmp al, 32;13
|
||||
je i_exit
|
||||
; cmp al,'0'
|
||||
; jb err
|
||||
; cmp al,'9'
|
||||
; ja err
|
||||
sub al, 48
|
||||
shl cx, 1
|
||||
jc error
|
||||
mov bx, cx
|
||||
shl cx, 1
|
||||
jc error
|
||||
shl cx, 1
|
||||
jc error
|
||||
add cx, bx
|
||||
jc error
|
||||
cbw
|
||||
add cx, ax
|
||||
jc error
|
||||
i3:
|
||||
inc edi
|
||||
jmp i1
|
||||
i_exit:
|
||||
mov ax, cx
|
||||
clc
|
||||
i4:
|
||||
movzx eax, ax
|
||||
pop edi
|
||||
pop dx
|
||||
pop cx
|
||||
pop bx
|
||||
ret
|
||||
|
||||
error:
|
||||
stc
|
||||
jmp i4
|
||||
|
||||
partition_string:
|
||||
dd 0
|
||||
db 32
|
@ -30,18 +30,6 @@ image_of_ebx EQU esp+20
|
||||
iglobal
|
||||
; in this table names must be in lowercase
|
||||
rootdirs:
|
||||
db 2,'rd'
|
||||
dd fs_OnRamdisk
|
||||
dd fs_NextRamdisk
|
||||
db 7,'ramdisk'
|
||||
dd fs_OnRamdisk
|
||||
dd fs_NextRamdisk
|
||||
db 2,'fd'
|
||||
dd fs_OnFloppy
|
||||
dd fs_NextFloppy
|
||||
db 10,'floppydisk'
|
||||
dd fs_OnFloppy
|
||||
dd fs_NextFloppy
|
||||
;**********************************************
|
||||
db 3,'cd0'
|
||||
dd fs_OnCd0
|
||||
@ -60,10 +48,6 @@ rootdirs:
|
||||
|
||||
|
||||
virtual_root_query:
|
||||
dd fs_HasRamdisk
|
||||
db 'rd',0
|
||||
dd fs_HasFloppy
|
||||
db 'fd',0
|
||||
;**********************************************
|
||||
dd fs_HasCd0
|
||||
db 'cd0',0
|
||||
@ -436,72 +420,10 @@ file_system_lfn:
|
||||
; ebp = 0 or pointer to rest of name from folder addressed by esi
|
||||
; out: [image_of_eax]=image of eax, [image_of_ebx]=image of ebx
|
||||
|
||||
fs_OnRamdisk:
|
||||
cmp ecx, 1
|
||||
jnz file_system_lfn.notfound
|
||||
mov eax, [ebx]
|
||||
cmp eax, fs_NumRamdiskServices
|
||||
jae .not_impl
|
||||
mov ecx, [ebx+12]
|
||||
mov edx, [ebx+16]
|
||||
; add edx, std_application_base_address
|
||||
add ebx, 4
|
||||
call dword [fs_RamdiskServices + eax*4]
|
||||
mov [image_of_eax], eax
|
||||
mov [image_of_ebx], ebx
|
||||
ret
|
||||
.not_impl:
|
||||
mov dword [image_of_eax], 2 ; not implemented
|
||||
ret
|
||||
|
||||
fs_NotImplemented:
|
||||
mov eax, 2
|
||||
ret
|
||||
|
||||
fs_RamdiskServices:
|
||||
dd fs_RamdiskRead
|
||||
dd fs_RamdiskReadFolder
|
||||
dd fs_RamdiskRewrite
|
||||
dd fs_RamdiskWrite
|
||||
dd fs_RamdiskSetFileEnd
|
||||
dd fs_RamdiskGetFileInfo
|
||||
dd fs_RamdiskSetFileInfo
|
||||
dd 0
|
||||
dd fs_RamdiskDelete
|
||||
dd fs_RamdiskCreateFolder
|
||||
fs_NumRamdiskServices = ($ - fs_RamdiskServices)/4
|
||||
|
||||
fs_OnFloppy:
|
||||
cmp ecx, 2
|
||||
ja file_system_lfn.notfound
|
||||
mov eax, [ebx]
|
||||
cmp eax, fs_NumFloppyServices
|
||||
jae fs_OnRamdisk.not_impl
|
||||
call reserve_flp
|
||||
mov [flp_number], cl
|
||||
mov ecx, [ebx+12]
|
||||
mov edx, [ebx+16]
|
||||
; add edx, std_application_base_address
|
||||
add ebx, 4
|
||||
call dword [fs_FloppyServices + eax*4]
|
||||
and [flp_status], 0
|
||||
mov [image_of_eax], eax
|
||||
mov [image_of_ebx], ebx
|
||||
ret
|
||||
|
||||
fs_FloppyServices:
|
||||
dd fs_FloppyRead
|
||||
dd fs_FloppyReadFolder
|
||||
dd fs_FloppyRewrite
|
||||
dd fs_FloppyWrite
|
||||
dd fs_FloppySetFileEnd
|
||||
dd fs_FloppyGetFileInfo
|
||||
dd fs_FloppySetFileInfo
|
||||
dd 0
|
||||
dd fs_FloppyDelete
|
||||
dd fs_FloppyCreateFolder
|
||||
fs_NumFloppyServices = ($ - fs_FloppyServices)/4
|
||||
|
||||
;*******************************************************
|
||||
fs_OnCd0:
|
||||
call reserve_cd
|
||||
@ -583,16 +505,6 @@ fs_CdServices:
|
||||
dd fs_NotImplemented
|
||||
fs_NumCdServices = ($ - fs_CdServices)/4
|
||||
|
||||
;*******************************************************
|
||||
|
||||
fs_HasRamdisk:
|
||||
mov al, 1 ; we always have ramdisk
|
||||
ret
|
||||
fs_HasFloppy:
|
||||
cmp byte [DRIVE_DATA], 0
|
||||
setnz al
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
fs_HasCd0:
|
||||
test byte [DRIVE_DATA+1], 10000000b
|
||||
@ -617,36 +529,6 @@ fs_HasCd3:
|
||||
; out: CF=1 => no more partitions
|
||||
; CF=0 => eax=next partition number
|
||||
|
||||
fs_NextRamdisk:
|
||||
; we always have /rd/1
|
||||
test eax, eax
|
||||
stc
|
||||
jnz @f
|
||||
mov al, 1
|
||||
clc
|
||||
@@:
|
||||
ret
|
||||
|
||||
fs_NextFloppy:
|
||||
; we have /fd/1 iff (([DRIVE_DATA] and 0xF0) != 0) and /fd/2 iff (([DRIVE_DATA] and 0x0F) != 0)
|
||||
test byte [DRIVE_DATA], 0xF0
|
||||
jz .no1
|
||||
test eax, eax
|
||||
jnz .no1
|
||||
inc eax
|
||||
ret ; CF cleared
|
||||
.no1:
|
||||
test byte [DRIVE_DATA], 0x0F
|
||||
jz .no2
|
||||
cmp al, 2
|
||||
jae .no2
|
||||
mov al, 2
|
||||
clc
|
||||
ret
|
||||
.no2:
|
||||
stc
|
||||
ret
|
||||
|
||||
;*******************************************************
|
||||
fs_NextCd:
|
||||
; we always have /cdX/1
|
||||
|
@ -759,9 +759,10 @@ no_mode_0x12:
|
||||
; Initialize system timer (IRQ0)
|
||||
call PIT_init
|
||||
|
||||
; CALCULATE FAT CHAIN FOR RAMDISK
|
||||
|
||||
call calculatefatchain
|
||||
; Register ramdisk file system
|
||||
mov esi, boot_initramdisk
|
||||
call boot_log
|
||||
call ramdisk_init
|
||||
|
||||
mov esi, boot_initapic
|
||||
call boot_log
|
||||
@ -1333,8 +1334,8 @@ proc osloop_has_work?
|
||||
jnz .yes
|
||||
call stack_handler_has_work?
|
||||
jnz .yes
|
||||
; call check_fdd_motor_status_has_work?
|
||||
; jnz .yes
|
||||
call check_fdd_motor_status_has_work?
|
||||
jnz .yes
|
||||
call check_ATAPI_device_event_has_work?
|
||||
jnz .yes
|
||||
call check_lights_state_has_work?
|
||||
@ -2673,29 +2674,14 @@ endg
|
||||
align 4
|
||||
sys_cachetodiskette:
|
||||
cmp ebx, 1
|
||||
jne .no_floppy_a_save
|
||||
mov [flp_number], 1
|
||||
jmp .save_image_on_floppy
|
||||
;--------------------------------------
|
||||
align 4
|
||||
.no_floppy_a_save:
|
||||
jb .no_floppy_save
|
||||
cmp ebx, 2
|
||||
jne .no_floppy_b_save
|
||||
mov [flp_number], 2
|
||||
;--------------------------------------
|
||||
align 4
|
||||
.save_image_on_floppy:
|
||||
ja .no_floppy_save
|
||||
call save_image
|
||||
mov [esp + 32], dword 0
|
||||
cmp [FDC_Status], 0
|
||||
je .yes_floppy_save
|
||||
;--------------------------------------
|
||||
align 4
|
||||
.no_floppy_b_save:
|
||||
mov [esp + 32], eax
|
||||
ret
|
||||
.no_floppy_save:
|
||||
mov [esp + 32], dword 1
|
||||
;--------------------------------------
|
||||
align 4
|
||||
.yes_floppy_save:
|
||||
ret
|
||||
;------------------------------------------------------------------------------
|
||||
uglobal
|
||||
@ -5266,19 +5252,6 @@ align 4
|
||||
|
||||
align 4
|
||||
|
||||
syscall_openramdiskfile: ; OpenRamdiskFile
|
||||
|
||||
mov eax, ebx
|
||||
mov ebx, ecx
|
||||
mov ecx, edx
|
||||
mov edx, esi
|
||||
mov esi, 12
|
||||
call fileread
|
||||
mov [esp+32], eax
|
||||
ret
|
||||
|
||||
align 4
|
||||
|
||||
syscall_drawrect: ; DrawRect
|
||||
|
||||
mov edi, edx ; color + gradient
|
||||
@ -5783,12 +5756,11 @@ yes_shutdown_param:
|
||||
cli
|
||||
|
||||
if ~ defined extended_primary_loader
|
||||
mov eax, kernel_file ; load kernel.mnt to 0x7000:0
|
||||
movi esi, 12
|
||||
xor ebx, ebx
|
||||
or ecx, -1
|
||||
mov edx, OS_BASE+0x70000
|
||||
call fileread
|
||||
; load kernel.mnt to 0x7000:0
|
||||
mov ebx, kernel_file_load
|
||||
pushad
|
||||
call file_system_lfn
|
||||
popad
|
||||
|
||||
mov esi, restart_kernel_4000+OS_BASE+0x10000 ; move kernel re-starter to 0x4000:0
|
||||
mov edi, OS_BASE+0x40000
|
||||
@ -5802,8 +5774,6 @@ end if
|
||||
; cld
|
||||
; rep movsd
|
||||
|
||||
call restorefatchain
|
||||
|
||||
call IRQ_mask_all
|
||||
|
||||
if 0
|
||||
|
@ -185,11 +185,9 @@ include "gui/button.inc"
|
||||
|
||||
include "blkdev/disk.inc" ; support for plug-n-play disks
|
||||
include "blkdev/disk_cache.inc" ; caching for plug-n-play disks
|
||||
include "fs/fs.inc" ; syscall
|
||||
include "fs/fat32.inc" ; read / write for fat32 filesystem
|
||||
include "fs/ntfs.inc" ; read / write for ntfs filesystem
|
||||
include "fs/fat12.inc" ; read / write for fat12 filesystem
|
||||
include "blkdev/rd.inc" ; ramdisk read /write
|
||||
include "fs/fat.inc" ; read / write for fat filesystem
|
||||
include "fs/ntfs.inc" ; read / write for ntfs filesystem
|
||||
include "fs/fs_lfn.inc" ; syscall, version 2
|
||||
include "fs/iso9660.inc" ; read for iso9660 filesystem CD
|
||||
include "fs/ext2/ext2.asm" ; read / write for ext2 filesystem
|
||||
|
@ -198,8 +198,7 @@
|
||||
; 0x800A0000 -> AFFFF screen access area
|
||||
; 0x800B0000 -> FFFFF bios rest in peace -area (320k) ?
|
||||
; 0x80100000 -> 27FFFF diskette image (1m5)
|
||||
; 0x80280000 -> 281FFF ramdisk fat (8k)
|
||||
; 0x80282000 -> 283FFF floppy fat (8k)
|
||||
; 0x80280000 -> 283FFF free (16k)
|
||||
;
|
||||
; 0x80284000 -> 28BFFF HDD DMA AREA (32k)
|
||||
; 0x8028C000 -> 297FFF free (48k)
|
||||
|
Loading…
Reference in New Issue
Block a user