40void Fileconts(
const char *filename,
const char *ext) {
41 u32 entries_per_sector =
fat16.bytes_per_sector / 32;
42 u32 root_dir_sectors =
43 ((
fat16.root_entry_count * 32) + (
fat16.bytes_per_sector - 1)) /
44 fat16.bytes_per_sector;
48 for (
u32 i = 0; i < root_dir_sectors; i++) {
50 for (
u32 j = 0; j < entries_per_sector; j++) {
56 Padname(filename, name_pad, 8);
57 Padname(ext, ext_pad, 3);
59 if (entry[0] != 0x00 &&
61 Kmemcmp(entry + 0x00, name_pad, 8) == 0 &&
62 Kmemcmp(entry + 0x08, ext_pad, 3) == 0) {
63 u16 clust = entry[0x1A] | (entry[0x1B] << 8);
69 ((clust - 2) *
fat16.sectors_per_cluster);
73 for (
int i = 0; i < 512; i++) {
74 if (data[i] == 0x1A) {
77 if (data[i] >= 0x20 && data[i] <= 0x7E) {