1 ; =============================================================================
2 ; BareMetal -- a 64-bit OS written in Assembly for x86-64 systems
3 ; Copyright (C) 2008-2012 Return Infinity -- see LICENSE.TXT
5 ; File System Functions
6 ; =============================================================================
13 ; This source acts as an abstraction layer between the OS and an actual File
14 ; System driver. A check can go here to detect the actual FS used and call the
15 ; appropriate FS driver.
19 ; cmp [os_FS], 1 ; FAT16
20 ; je os_fat16_file_read
21 ; cmp [os_FS], 2 ; FAT32
22 ; je os_fat32_file_read
26 ; -----------------------------------------------------------------------------
27 ; os_file_read -- Read a file from disk into memory
28 ; IN: RSI = Address of filename string
29 ; RDI = Memory location where file will be loaded to
30 ; OUT: Carry is set if the file was not found or an error occured
32 jmp os_fat16_file_read
33 ; -----------------------------------------------------------------------------
36 ; -----------------------------------------------------------------------------
37 ; os_file_write -- Write a file from memory to disk
38 ; IN: RSI = Memory location of data to be written
39 ; RDI = Address of filename string
40 ; RCX = Number of bytes to write
41 ; OUT: Carry is set if an error occured
43 jmp os_fat16_file_write
44 ; -----------------------------------------------------------------------------
47 ; -----------------------------------------------------------------------------
48 ; os_file_rename -- Rename a file on disk
49 ; IN: RSI = Memory location of file name to change
50 ; RDI = Memory location of new file name
51 ; OUT: Carry is set if the file was not found or an error occured
54 ; -----------------------------------------------------------------------------
57 ; -----------------------------------------------------------------------------
58 ; os_file_delete -- Delete a file from disk
59 ; IN: RSI = Memory location of file name to delete
60 ; OUT: Carry is set if the file was not found or an error occured
62 jmp os_fat16_file_delete
63 ; -----------------------------------------------------------------------------
66 ; -----------------------------------------------------------------------------
67 ; os_file_get_list -- Generate a list of files on disk
68 ; IN: RDI = location to store list
69 ; OUT: RDI = pointer to end of list
71 jmp os_fat16_get_file_list
72 ; -----------------------------------------------------------------------------
75 ; -----------------------------------------------------------------------------
76 ; os_file_size -- Return the size of a file on disk
77 ; IN: RSI = Address of filename string
78 ; OUT: RCX = Size in bytes
79 ; Carry is set if the file was not found or an error occured
81 jmp os_fat16_get_file_size
82 ; -----------------------------------------------------------------------------
85 ; =============================================================================