]> wirehaze git hosting - BOS.git/commitdiff

wirehaze git hosting

More VFS/FAT12 structure work
authorChristoffer Bubach <christoffer@ridestore.com>
Sun, 25 Jan 2015 19:34:19 +0000 (20:34 +0100)
committerChristoffer Bubach <christoffer@ridestore.com>
Sun, 25 Jan 2015 19:34:19 +0000 (20:34 +0100)
kernel/fat12/fat12.asm
kernel/int/debug.asm
kernel/kernel.asm
kernel/vfs/vfs.asm

index d7ad9cb1fa176f0ed997617dacff98f1e92af6ad..832df8fedb57910cb3d94c1f4f35b546f0b6f7a0 100644 (file)
@@ -6,29 +6,55 @@
 ;                                                          ;
 ;----------------------------------------------------------;
 
 ;                                                          ;
 ;----------------------------------------------------------;
 
+    ;---------------------------------------------;
+    ;   FAT12 calltable and structure pointer     ;
+    ;---------------------------------------------;
+    FAT12:
+        .data_pointer         dd  0                   ; internal driver data
+        .FSname               db  'FAT12'             ; 5 char filesystem name
+        .init                 dd  init_fat12          ; pointer to init
+        .deinit               dd  0                   ; remove driver
+        .format               dd  0                   ; format drive
+        .mount                dd  0                   ; mount drive
+        .unmount              dd  0                   ; unmount drive
+        .find                 dd  0                   ; find file
+        .findnext             dd  0                   ; get next match
+        .open                 dd  0                   ; open file, get handle
+        .close                dd  0                   ; close file from handle
+        .attrib               dd  0                   ; get/set attrib. and time
+        .read                 dd  0                   ; read file from handle
+        .write                dd  0                   ; write file from handle
+        .seek                 dd  0                   ; seek from handle
+        .rename               dd  0                   ; rename file
+        .remove               dd  0                   ; remove file/dir
+        .create               dd  0                   ; create file/dir
+        .ioctl                dd  0                   ; extra calls if exists
+
     ;---------------------------------------------;
     ;   FAT12 main info structure                 ;
     ;---------------------------------------------;
     ;---------------------------------------------;
     ;   FAT12 main info structure                 ;
     ;---------------------------------------------;
-    struc fat12
+    struc fat12_data
     {
         .disk_number                     db  0        ; which VFS disk number
         .root_dir                        dw  0        ; position of rootdir
     {
         .disk_number                     db  0        ; which VFS disk number
         .root_dir                        dw  0        ; position of rootdir
+        .disk_size                       dd  0        ; total storage size
+        .free_space                      dd  0        ; free space available
         .fat_1                           dd  0        ; position of fat1
         .fat_2                           dd  0        ; position of fat2
         .data_area                       dw  0        ; position of dataarea
         .fat_1                           dd  0        ; position of fat1
         .fat_2                           dd  0        ; position of fat2
         .data_area                       dw  0        ; position of dataarea
-        .disk_size                       dd  0        ; total storage size
-        .free_space                      dd  0        ; free space available
         .boot: times sizeof.bootsector   db  0        ; copy of FAT12 bootsector
         .dir_entries:
             times 16 * sizeof.dir_entry  db  0        ; 512b dir entry buffer
         .fat_buffer:      times 512      db  0        ; 512b FAT cluster info buffer
         .boot: times sizeof.bootsector   db  0        ; copy of FAT12 bootsector
         .dir_entries:
             times 16 * sizeof.dir_entry  db  0        ; 512b dir entry buffer
         .fat_buffer:      times 512      db  0        ; 512b FAT cluster info buffer
-        .filehandles:
+        .foundfile:
+            times 1 * sizeof.search      db  0        ; "DTA" like structure
+        .filehandles:                                 ; "System File Table"
             times 32 * sizeof.filehandle db  0        ; for now, max opened files is 32
     }
 
     virtual at 0                                      ; could use "at esi" instead
             times 32 * sizeof.filehandle db  0        ; for now, max opened files is 32
     }
 
     virtual at 0                                      ; could use "at esi" instead
-        fat12 fat12
-        sizeof.fat12 = $-$$     
+        fat12_data fat12_data
+        sizeof.fat12_data = $-$$     
     end virtual
 
     ;---------------------------------------------;
     end virtual
 
     ;---------------------------------------------;
         sizeof.lfn_entry = $-$$
     end virtual
 
         sizeof.lfn_entry = $-$$
     end virtual
 
+    ;---------------------------------------------;
+    ;   FAT12 file search/DTA structure           ;
+    ;---------------------------------------------;
+    struc search
+    {
+        .searchname:
+            times 255      db  0                      ; file search pattern.
+        .attribute         db  0                      ; search attribute.
+        .direntry          dw  0                      ; directory entry number, 0 based
+        .dircluster        dw  0                      ; starting cluster of dir, 0 root
+        .foundattrib       db  0                      ; attribute of matching file
+        .foundtime         dw  0                      ; file time
+        .founddate         dw  0                      ; file date
+        .foundsize         dw  0                      ; file size
+    }
+
+    virtual at 0
+        search search
+        sizeof.search = $-$$
+    end virtual
+
     ;---------------------------------------------;
     ;   FAT12 file-handle structure               ;
     ;---------------------------------------------;
     ;---------------------------------------------;
     ;   FAT12 file-handle structure               ;
     ;---------------------------------------------;
         .filesize          dd  0                      ; filesize
         .position          dd  0                      ; R/W position in file
         .clusterpos        dw  0                      ; cluster number of last cluster read
         .filesize          dd  0                      ; filesize
         .position          dd  0                      ; R/W position in file
         .clusterpos        dw  0                      ; cluster number of last cluster read
+        .shortname:
+            times 11       db  0                      ; short name
+        .fullname:
+            times 255      db  0                      ; the full LFN
     }
 
     virtual at 0
     }
 
     virtual at 0
     attribute_lfn       = 0x0F                         ; attrb. byte value for LFN dir entry
 
 
     attribute_lfn       = 0x0F                         ; attrb. byte value for LFN dir entry
 
 
-
-
-
-fd0 fat12            ; define fd0 data..  tmp example.
-
-; TODO, alloc memory for struct and keep pointer only.
-; ---------------
-;drive dd 0
-;mov edi, drive+fat12into.boot
-
-;--------------------------------------
-; possible interface to copy/follow,
-; add getFilename/path function?
-;--------------------------------------
-;    INT 21,3C  Create file using handle
-;    INT 21,3D  Open file using handle
-;    INT 21,3E  Close file using handle
-;    INT 21,3F  Read file or device using handle
-;    INT 21,40  Write file or device using handle
-;    INT 21,41  Delete file
-;    INT 21,42  Move file pointer using handle
-;    INT 21,43  Change file mode
-;    INT 21,45  Duplicate file handle
-;    INT 21,46  Force duplicate file handle
-;    INT 21,56  Rename file
-;    INT 21,57  Get/set file date and time using handle
-;    INT 21,5A  Create temporary file (3.x+)
-;    INT 21,5B  Create new file (3.x+)
-;    INT 21,67  Set handle count (DOS 3.3+)
-
 ;--------------------------------------------------------------;
 ;   init_fat12  -  detect if drive fs is fat12 and init        ;
 ;--------------------------------------------------------------;
 ;--------------------------------------------------------------;
 ;   init_fat12  -  detect if drive fs is fat12 and init        ;
 ;--------------------------------------------------------------;
index 4c1fe1939ca76f2bc0f6f5254dcf26d96f79ce90..ae2d6fe69f06676f5cdfd2d9e39fb553642872f7 100755 (executable)
@@ -10,7 +10,7 @@
 ;   variables    ;\r
 ;----------------;\r
          dbg_head        db   'ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»',0\r
 ;   variables    ;\r
 ;----------------;\r
          dbg_head        db   'ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»',0\r
-         dbg_head2       db   'º BOS 0.04 - ERROR: ',0\r
+         dbg_head2       db   'º BOS 0.05 - ERROR: ',0\r
          dbg_head3       db   'º                                  º',0\r
          dbg_press       db   'º  Press any key to continue...    º',0\r
          dbg_restart     db   'º Press a key to restart the PC... º',0\r
          dbg_head3       db   'º                                  º',0\r
          dbg_press       db   'º  Press any key to continue...    º',0\r
          dbg_restart     db   'º Press a key to restart the PC... º',0\r
index 10fdc12aa7c0ac5e289e8fda0f22eca76d2b7243..2f5603e504ee9afafc83e7510013f0bacc97cdf5 100644 (file)
@@ -4,8 +4,8 @@
 ;    BOS 32-bit kernel, expects to be loaded at 32kb    ;\r
 ;    in mem.   Small amount of 16-bit code included.    ;\r
 ;                                                       ;\r
 ;    BOS 32-bit kernel, expects to be loaded at 32kb    ;\r
 ;    in mem.   Small amount of 16-bit code included.    ;\r
 ;                                                       ;\r
-;      For any comments on this code, mail me.          ;\r
-;   http://bos.asmhackers.net/   asmhacker@gmail.com    ;\r
+;    Homepage:   http://bos.asmhackers.net/             ;\r
+;    Repository: http://github.com/bubach/BOS           ;\r
 ;                                                       ;\r
 ;         by: Christoffer Bubach, 2003-2015             ;\r
 ;-------------------------------------------------------;\r
 ;                                                       ;\r
 ;         by: Christoffer Bubach, 2003-2015             ;\r
 ;-------------------------------------------------------;\r
index 30d5590c39e0f5c6f6593c9d2a8d4674ce44db6f..83cd12777cf41230fe4ac869b9ebaf7dbcf8a5bb 100644 (file)
@@ -7,12 +7,6 @@
 ;----------------------------------------------------------;
 
 
 ;----------------------------------------------------------;
 
 
-    ; file handles need to be dword, where the high
-    ; word contains drive number, and the low word
-    ; is the drive/FS specific handle. limits FS to
-    ; a max of 65535 opened files. should be alright. ;)
-
-
     ;---------------------------------------------;
     ;   VFS main structure                        ;
     ;---------------------------------------------;
     ;---------------------------------------------;
     ;   VFS main structure                        ;
     ;---------------------------------------------;
@@ -56,6 +50,7 @@
     struc VFS_filesystem
     {
         .data_pointer         dd  0                   ; internal driver data
     struc VFS_filesystem
     {
         .data_pointer         dd  0                   ; internal driver data
+        .FSname               db  0,0,0,0,0           ; 5 char filesystem name
         .init                 dd  0                   ; pointer to init
         .deinit               dd  0                   ; remove driver
         .format               dd  0                   ; format drive
         .init                 dd  0                   ; pointer to init
         .deinit               dd  0                   ; remove driver
         .format               dd  0                   ; format drive
         .find                 dd  0                   ; find file
         .findnext             dd  0                   ; get next match
         .open                 dd  0                   ; open file, get handle
         .find                 dd  0                   ; find file
         .findnext             dd  0                   ; get next match
         .open                 dd  0                   ; open file, get handle
+        .close                dd  0                   ; close file from handle
+        .attrib               dd  0                   ; get/set attrib. and time
         .read                 dd  0                   ; read file from handle
         .write                dd  0                   ; write file from handle
         .seek                 dd  0                   ; seek from handle
         .read                 dd  0                   ; read file from handle
         .write                dd  0                   ; write file from handle
         .seek                 dd  0                   ; seek from handle
+        .rename               dd  0                   ; rename file
         .remove               dd  0                   ; remove file/dir
         .create               dd  0                   ; create file/dir
         .ioctl                dd  0                   ; extra calls if exists
         .remove               dd  0                   ; remove file/dir
         .create               dd  0                   ; create file/dir
         .ioctl                dd  0                   ; extra calls if exists
@@ -136,4 +134,25 @@ add_fs:
         push   eax
         ;...
         pop    eax
         push   eax
         ;...
         pop    eax
+        ret
+
+;--------------------------------------------------------------;
+;   open_file  -  open file, return handle                     ;
+;--------------------------------------------------------------;
+;                                                              ;
+;       in:  reg = ASCIIZ file name and such                   ;
+;                                                              ;
+;       out: reg = dword file handle                           ;
+;                                                              ;
+;--------------------------------------------------------------;
+open_file:
+        push   eax
+        ; file handles need to be dword, where the high
+        ; word contains drive number, and the low word
+        ; is the drive/FS specific handle.  meaning no internal
+        ; table in VFS, created dynamically with FS info.
+        ; limits FS to a max of 65535 opened files. most use fewer
+        ; as default. FAT12 driver has 32.
+        ; FS reports error if handle is invalid.
+        pop    eax
         ret
\ No newline at end of file
         ret
\ No newline at end of file