Author | Matthew Schinkel, copyright (c) 2009, all rights reserved. |
Adapted-by | |
Compiler | >=2.4k |
this library reads files & folders from a fat32 formatted media such as sd cards & hard disks. BETA VERSION!
http://www.microsoft.com/whdc/system/platform/firmware/fatgen.mspx http://www.pjrc.com/tech/8051/ide/fat32.html http://en.wikipedia.org/wiki/File_Allocation_Table
This lib does not create filename's on fat32 partitions, although it may in the future. Please see this article http://www.desktoplinux.com/news/NS4980952387.html?kc=rss before you think about implementing writing of filenames into your project.
No dependency found
var dword fat32_root_dir_first_cluster -- the location of the root dir's first cluster, should be 2
var bit fat32_is_volume_id at fat32_attrib : 3
const byte FAT32_DIRECTORY = 0
var dword fat32_file_cluster -- file's start cluster number after file_read_info()
var word fat32_dir_file_count -- number of files in current directory
var byte fat32_sectors_per_cluster -- the number of sectors per cluster, usually 8
var byte file_ext[3] -- holds file extension after file_read_info()
var bit fat32_is_read_only at fat32_attrib : 0
var bit fat32_filter_is_volume_id at fat32_attrib_filter : 3
var dword fat32_fat_begin -- the location of the file alocation table for current partition
const byte FAT32_ENTRY_IS_PART_OF_LONG_NAME = 0x0F -- entry has a few characters of a long filename
var bit fat32_is_directory at fat32_attrib : 4
var dword fat32_file_size -- holds file size after file_read_info()
var bit fat32_filter_is_archive at fat32_attrib_filter : 5
var byte fat32_attrib
var dword fat32_root_dir -- sector location of the root dir
const byte FAT32_FILE = 1
var byte fat32_attrib_filter = 0 -- default is do not filter any file attributes
var bit fat32_is_hidden at fat32_attrib : 1
var bit fat32_filter_is_system at fat32_attrib_filter : 2
const byte FAT32_ENTRY_NOT_IN_USE = 0xE5 -- usually from a deleted file
var bit fat32_filter_is_directory at fat32_attrib_filter : 4
var bit fat32_is_system at fat32_attrib : 2
var dword fat32_file_location -- holds file location after file_read_info()
var dword fat32_cluster_begin -- the location of the beginning of clusters (where files & folders data is)
var byte fat32_filename_count = 0
var dword fat32_current_dir_location -- sector location of last dir read
var bit fat32_filter_is_hidden at fat32_attrib_filter : 1
var bit fat32_is_archive at fat32_attrib : 5
var bit fat32_filter_is_read_only at fat32_attrib_filter : 0
fat32_write_entry(word in address, byte*FAT32_ENTRIES_MAX in entry_data)
fat32_create_dword(byte in val4, byte in val3, byte in val2, byte in val1, dword out result1)
fat32_read_boot_sector(byte in partition_select)
fat32_list_dir()
fat32_read_file_info(byte*FAT32_ENTRIES_MAX in file_number)
fat32_read_filename()
fat32_read_entry(word in address, byte*FAT32_ENTRIES_MAX out entry_data)
fat32_read_file(byte out in_b, byte out in_a)
fat32_init(byte in primary_partition_number)
fat32_file_open(byte in file_number) return bit
fat_32_read_filename_char() return byte
fat32_cd(byte in file_number) return bit
var dword fat32_root_dir_first_cluster -- the location of the root dir's first cluster, should be 2
No documentation found
var bit fat32_is_volume_id at fat32_attrib : 3
No documentation found
const byte FAT32_DIRECTORY = 0
read fragment locations from fat, store in fat32_dir_fragments_start & fat32_dir_fragment_cluster_count arrays
var dword fat32_file_cluster -- file's start cluster number after file_read_info()
No documentation found
var word fat32_dir_file_count -- number of files in current directory
No documentation found
var byte fat32_sectors_per_cluster -- the number of sectors per cluster, usually 8
No documentation found
var byte file_ext[3] -- holds file extension after file_read_info()
No documentation found
var bit fat32_is_read_only at fat32_attrib : 0
No documentation found
var bit fat32_filter_is_volume_id at fat32_attrib_filter : 3
No documentation found
var dword fat32_fat_begin -- the location of the file alocation table for current partition
No documentation found
const byte FAT32_ENTRY_IS_PART_OF_LONG_NAME = 0x0F -- entry has a few characters of a long filename
No documentation found
var bit fat32_is_directory at fat32_attrib : 4
No documentation found
var dword fat32_file_size -- holds file size after file_read_info()
vars you can read info from
var bit fat32_filter_is_archive at fat32_attrib_filter : 5
No documentation found
var byte fat32_attrib
Create file fat32_attribute variables
var dword fat32_root_dir -- sector location of the root dir
No documentation found
const byte FAT32_FILE = 1
No documentation found
var byte fat32_attrib_filter = 0 -- default is do not filter any file attributes
filter file attributes
var bit fat32_is_hidden at fat32_attrib : 1
No documentation found
var bit fat32_filter_is_system at fat32_attrib_filter : 2
No documentation found
const byte FAT32_ENTRY_NOT_IN_USE = 0xE5 -- usually from a deleted file
READ DIR INFO, STORE INTO ENTRY_LOCATION ARRAY refers to fat32 directory entry characters
var bit fat32_filter_is_directory at fat32_attrib_filter : 4
No documentation found
var bit fat32_is_system at fat32_attrib : 2
No documentation found
var dword fat32_file_location -- holds file location after file_read_info()
No documentation found
var dword fat32_cluster_begin -- the location of the beginning of clusters (where files & folders data is)
No documentation found
var byte fat32_filename_count = 0
No documentation found
var dword fat32_current_dir_location -- sector location of last dir read
No documentation found
var bit fat32_filter_is_hidden at fat32_attrib_filter : 1
No documentation found
var bit fat32_is_archive at fat32_attrib : 5
No documentation found
var bit fat32_filter_is_read_only at fat32_attrib_filter : 0
No documentation found
fat32_write_entry(word in address, byte*FAT32_ENTRIES_MAX in entry_data)
these procedures may get removed.
fat32_create_dword(byte in val4, byte in val3, byte in val2, byte in val1, dword out result1)
creates a dword from 4 bytes old procedure, needs to be fixed or removed
fat32_read_boot_sector(byte in partition_select)
Reads a fat32 boot sector to get the location of the root directory and FAT Location on the media for the partition selected. Only primary partitions are supported. Secondary partitions are not.
fat32_list_dir()
requires serial connection to your pc, you may modify this for your own application requires: include format.jal, serial_hw.jal
fat32_read_file_info(byte*FAT32_ENTRIES_MAX in file_number)
reads file info such as filename, filesize, filelocation, etc. into memory.
fat32_read_filename()
send the current filename via serial port, you may modify this for your own application. requires serial_hw.jal
fat32_read_entry(word in address, byte*FAT32_ENTRIES_MAX out entry_data)
No documentation found
fat32_read_file(byte out in_b, byte out in_a)
read data from the currently opened file.
fat32_init(byte in primary_partition_number)
initalize fat32
_fat32_send_dword(dword in dval1)
Send dword via serial port (for troubleshooting only)
fat32_file_open(byte in file_number) return bit
No documentation found
fat_32_read_filename_char() return byte
No documentation found
fat32_cd(byte in file_number) return bit
change directory, returns 1 = success, 0 = not a directory