From 9aa56cdce2c3db86de64d7ae2ed6fa98bb8e17bc Mon Sep 17 00:00:00 2001 From: Lucia Ceionia Date: Thu, 22 Sep 2022 10:08:56 -0500 Subject: [PATCH] Actually read the dir --- kernel.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel.c b/kernel.c index 9c42767..f73d4c3 100644 --- a/kernel.c +++ b/kernel.c @@ -143,6 +143,7 @@ void TestFAT() { vga_text += printStr("PartType: ", vga_text); vga_text += printByte(ptype, vga_text); vga_text = (word *)((((((uintptr_t)vga_text)-0xb8000) - ((((uintptr_t)vga_text)-0xb8000) % 160)) + 160)+0xb8000); + asm ("xchgw %bx, %bx"); DFS_GetVolInfo(0, diskReadBuf, pstart, &vi); vga_text += printStr("Label: ", vga_text); @@ -166,20 +167,24 @@ void TestFAT() { vga_text += printStr("ROOT@: ", vga_text); vga_text += printDword(vi.rootdir, vga_text); vga_text = (word *)((((((uintptr_t)vga_text)-0xb8000) - ((((uintptr_t)vga_text)-0xb8000) % 160)) + 160)+0xb8000); + asm ("xchgw %bx, %bx"); vga_text += printStr("Files in root:", vga_text); - vga_text = (word *)((((((uintptr_t)vga_text)-0xb8000) - ((((uintptr_t)vga_text)-0xb8000) % 160)) + 160)+0xb8000); DIRINFO di; + di.scratch = diskReadBuf; + DFS_OpenDir(&vi, (uint8_t*)"", &di); + vga_text = (word *)((((((uintptr_t)vga_text)-0xb8000) - ((((uintptr_t)vga_text)-0xb8000) % 160)) + 160)+0xb8000); DIRENT de; - di.scratch = 0x23000; while (!DFS_GetNext(&vi, &di, &de)) { if (de.name[0]) { for (int i = 0; i < 11 && de.name[i]; i++) { + if (i == 8) { *(uint8_t*)vga_text = ' '; vga_text++; } // space for 8.3 *(uint8_t *)vga_text = de.name[i]; vga_text++; } vga_text = (word *)((((((uintptr_t)vga_text)-0xb8000) - ((((uintptr_t)vga_text)-0xb8000) % 160)) + 160)+0xb8000); } + asm ("xchgw %bx, %bx"); } }