; ===========================================================================
; CEFS - File System DFS 1.0 - Disk File System Driver     teknopup@gmail.com
; ===========================================================================

FS1_VERSION    EQU 1
MAX_DRIVES     EQU 'Z' -'A' + 1

FA_Archive equ 01
FA_Hidden  equ 02
FA_RW      equ 04
FA_Exec    equ 08
FA_Dir     equ 16
FA_Deleted equ 128
FA_Normal  equ FA_Archive+FA_RW
FA_Program equ FA_Normal+FA_Exec
Filename$  equ 31

attr_read_only EQU 1
attr_hidden    EQU 2
attr_system    EQU 4
attr_volume    EQU 8
attr_dir       EQU 10h
attr_archive   EQU 20h

dfsdata:
fs1_ID   db 0ceh
fs1_VER  dw FS1_VERSION
swapfile db '\swap.$$$',0             ; (hidden) (system) (locked)
swapattr db FA_Hidden+FA_RW
dfsinitd db 0

iNode:
dfsfileinf:
         iNode_Filename  db Filename$ dup(0) 
         iNode_Attribute db FA_Normal 
         ; 01  set = archive
         ; 02  set = hidden
         ; 04  set = R/W access if 0 then read only
         ; 08  set = exec. access
         ; 32  set = Directory
         ; 64  set = 
         ; 128 set = deleted
         iNode_FileOwner dw 0      ; system admin = 65535, 0 = ALL  
         iNode_FileDate  dw -1
         iNode_FileTime  dw -1
         iNode_FileSize  dd 0
         iNode_FileBlock dd -1     ; cluster
iNode_Size EQU & - iNode

dfsbufmod db 0
dfswrksec dw ?
dfsbuf    db 512 dup(?)
; dfslinkbuf db 512 dup(?)
; dfsrootbuf db 512 dup(?)

; === Public interface ==================================================

;dfsfindnext
;dfsfindfirst
;dfssearch
;dfsfileexist
;dfsattr
;dfswrite
;dfsread
;dfsclose
;dfsopen
;dfscreate
;dfsfcopy

fs1_seek proc far

     ret
fs1_seek endp

fs1_tell proc far
; Get Current File Position

     ret
fs1_tell endp

fs1_eof proc far

     ret
fs1_eof endp

fs1_rewind proc far

     ret
fs1_rewind endp

fs1_putc proc far

     ret
fs1_putc endp

fs1_getc proc far

     ret
fs1_getc endp

fs1_read proc far

     ret
fs1_read endp

fs1_write proc far

     ret 
fs1_write endp

fs1_unlink proc far

     ret 
fs1_unlink endp

fs1_open proc far

     ret 
fs1_open endp

fs1_close proc far

     ret
fs1_close endp

fs1_getcwd proc far
; Get Current Working Directory

     ret
fs1_getcwd endp

fs1_mkdir proc far

     ret
fs1_mkdir endp

fs1_chdir proc far

     ret
fs1_chdir endp

fs1_rmdir proc far

     ret
fs1_rmdir endp

fs1_rename proc far
; Rename a File of Directory

     ret
fs1_rename endp

fs1_delete proc far
; Delete a File or Directory

     ret
fs1_delete endp

fs1_fsize proc far

     ret
fs1_fsize endp

fs1_ffirst proc far

     ret
fs1_ffirst endp

fs1_fnext proc far

     ret
fs1_fnext endp

fs1_setfattr proc far

     ret
fs1_setfattr endp

fs1_getfattr proc far

     ret
fs1_getfattr endp


fs1_setftdate proc far

     ret
fs1_setftdate endp

fs1_getftdate proc far

     ret
fs1_getftdate endp

; === Private interface ==================================================

fs1_getlabel proc far

     ret
fs1_getlabel endp

fs1_setlabel proc far

     ret
fs1_setlabel endp

fs1_freespace proc far

     ret
fs1_freespace proc far

fs1_format proc far
; AX = 1 hardformat

     ret
fs1_format endp

fs1_mount PROC far
     push es
     ; check partitions on drive 80h for fs1
     ; if found then mount them.

     pop  es
     ret
fs1_mount ENDP

fs1_unmount PROC far
     push es


     pop  es
     ret
fs1_unmount ENDP

; ===========================================================================
fs1_init proc far
;  Initialize the Volume
;  Returns File System Version Number 
; ===========================================================================
dfsinit:
   push ds
   push cs
   pop  ds

   mov  al, dfsinitd
   or   al, al
   jnz  dfsix

        mov  al, 1
        mov  dfsinitd, al
dfsix:
   pop  ds
   ret
dfsinit endp
     
     ret
fs1_init endp




