#include #include "vga.h" #include "fat.h" #include "fs.h" #include "ata.h" #include "panic.h" #include "serial.h" #include "util.h" uint8_t nbuf[11]; void main() { vga_blank(); vga_printsz("Initializing drivers..."); sinit(); vga_printsz("\n Serial ready."); load_fat(); clear_fs_handles(); vga_printsz("\n File system ready.\n\nDisk info:\n Disk label: "); vga_printsn(FAT_INFO->label, 11); vga_printsz("\n Disk size: "); u16_dec(FAT_INFO->sectors >> 1, nbuf); vga_printsz(nbuf); vga_printsz("k\n FAT size: "); u16_dec(FAT_INFO->sectors_per_fat >> 1, nbuf); vga_printsz(nbuf); vga_printsz("k\n Root size: "); u16_dec(FAT_INFO->root_entries >> 5, nbuf); vga_printsz(nbuf); vga_printsz("k\n\nRoot directory:"); fs_handle root = fs_open_root(); struct directory_entry e; while(1) { fs_read(root, 32, &e); if (!e.name[0]) break; if (e.attrib == FA_LFN) continue; uint8_t *p = (uint8_t *)&e; nbuf[3] = 0; vga_printsz("\n "); vga_printsn((uint8_t *)&e.name, 11); vga_printsz(" | 0x"); u8_hex(e.attrib, nbuf); vga_printsz(nbuf); vga_printch(' '); vga_printch(e.attrib & FA_READ_ONLY ? 'R' : '_'); vga_printch(e.attrib & FA_HIDDEN ? 'H' : '_'); vga_printch(e.attrib & FA_SYSTEM ? 'S' : '_'); vga_printch(e.attrib & FA_LABEL ? 'L' : '_'); vga_printch(e.attrib & FA_DIRECTORY ? 'D' : '_'); vga_printch(e.attrib & FA_ARCHIVE ? 'A' : '_'); vga_printsz(" | "); u32_dec(e.length, nbuf); vga_printsz(nbuf); } halt(); }