diff --git a/Makefile b/Makefile index 94e8bbb..acbfaf4 100644 --- a/Makefile +++ b/Makefile @@ -21,9 +21,10 @@ $(BUILD_DIR)/main_floppy.img: bootloader kernel dd if=$(BUILD_DIR)/stage1.bin of=$(BUILD_DIR)/main_floppy.img conv=notrunc mcopy -i $(BUILD_DIR)/main_floppy.img $(BUILD_DIR)/stage2.bin "::stage2.bin" mmd -i $(BUILD_DIR)/main_floppy.img "::boot" - mcopy -i $(BUILD_DIR)/main_floppy.img $(BUILD_DIR)/kernel.bin "::kernel.bin" # move to boot dir + mcopy -i $(BUILD_DIR)/main_floppy.img $(BUILD_DIR)/kernel.bin "::kernel.bin" mmd -i $(BUILD_DIR)/main_floppy.img "::misc" - mcopy -i $(BUILD_DIR)/main_floppy.img test.txt "::test.txt" # move to misc dir + mcopy -v -i $(BUILD_DIR)/main_floppy.img kernelparams "::misc" + mcopy -i $(BUILD_DIR)/main_floppy.img test "::misc" # # Bootloader diff --git a/kernelparams b/kernelparams index e69de29..3086fdf 100644 --- a/kernelparams +++ b/kernelparams @@ -0,0 +1 @@ +verbose \ No newline at end of file diff --git a/src/bootloader/stage2/fat.c b/src/bootloader/stage2/fat.c index df2e9b6..d9a7018 100644 --- a/src/bootloader/stage2/fat.c +++ b/src/bootloader/stage2/fat.c @@ -325,13 +325,14 @@ FAT_File* FAT_Open(DISK* disk, const char* path) // ignore leading slash if (path[0] == '/') path++; - + printf("Path: %s\r\n", path); FAT_File* current = &g_Data->RootDirectory.Public; while (*path) { // extract next file name from path bool isLast = false; const char* delim = strchr(path, '/'); + printf("DELIM: %s\r\n", delim); if (delim != NULL) { memcpy(name, path, delim - path); @@ -349,10 +350,17 @@ FAT_File* FAT_Open(DISK* disk, const char* path) // find directory entry in current directory FAT_DirectoryEntry entry; - if (FAT_FindFile(disk, current, name, &entry)) + if (!FAT_FindFile(disk, current, name, &entry)) { FAT_Close(current); + printf("FAT: %s not found\r\n", name); + return NULL; + } else + { + FAT_Close(current); + printf("We make it here.\r\n"); + // check if directory if (!isLast && entry.Attributes & FAT_ATTRIBUTE_DIRECTORY == 0) { @@ -363,13 +371,6 @@ FAT_File* FAT_Open(DISK* disk, const char* path) // open new directory entry current = FAT_OpenEntry(disk, &entry); } - else - { - FAT_Close(current); - - printf("FAT: %s not found\r\n", name); - return NULL; - } } return current; diff --git a/src/bootloader/stage2/main.c b/src/bootloader/stage2/main.c index 82db728..1c1bb7b 100644 --- a/src/bootloader/stage2/main.c +++ b/src/bootloader/stage2/main.c @@ -67,31 +67,44 @@ void* g_data = (void*)0x20000; printf("Failed!\nDisk Initialization Error!\n"); goto end; } - printf("Done!\n"); + // printf("Done!\n"); - // test fat driver - printf("Testing FAT Driver..."); - // read test.txt - FAT_File* ft = FAT_Open(&disk, "/"); - char buffer[100]; - uint32_t testread; - ft = FAT_Open(&disk, "test.txt"); // move test.txt in MISC folder later (TM) - while ((testread = FAT_Read(&disk, ft, sizeof(buffer), buffer))) - { - for (uint32_t i = 0; i < testread; i++) - { - if (buffer[i] == '\n') - putc('\r'); - putc(buffer[i]); - } - } - FAT_Close(ft); + // // test fat driver + // printf("Testing FAT Driver..."); + // // read test.txt + // FAT_File* ft = FAT_Open(&disk, "/misc"); + // char buffer[100]; + // uint32_t testread; + // ft = FAT_Open(&disk, "test"); // move test.txt in MISC folder later (TM) + // while ((testread = FAT_Read(&disk, ft, sizeof(buffer), buffer))) + // { + // for (uint32_t i = 0; i < testread; i++) + // { + // if (buffer[i] == '\n') + // putc('\r'); + // putc(buffer[i]); + // } + // } + // FAT_Close(ft); - printf("Detecting Memory...\n"); + printf("Detecting Memory..."); // prep boot params g_BootParams.BootDevice = bootDrive; Memory_Detect(&g_BootParams.Memory); - + printf("Done!\n"); + // // kernel params... + // FAT_File* kp = FAT_Open(&disk, "/misc"); + // uint32_t kernelparams; + // while ((kernelparams = FAT_Read(&disk, kp, sizeof(buffer), buffer))) + // { + // for (uint32_t i = 0; i < kernelparams; i++) + // { + // if (buffer[i] == '\n') + // putc('\r'); + // putc(buffer[i]); + // } + // } + // FAT_Close(kp); // load kernel from disk printf("Loading Kernel..."); diff --git a/src/kernel/dri/keyboard.h b/src/kernel/dri/keyboard.h index 0a8849d..1d27a22 100644 --- a/src/kernel/dri/keyboard.h +++ b/src/kernel/dri/keyboard.h @@ -6,8 +6,10 @@ #pragma once void Print_Key(int scancode); - -typedef enum { // ill do it LATER! +// Scancodes for a QWERTY layout; +// Will add support for alt layouts like for example DVORAK (my layout of choice) +// Kinda need to tbh, cuz even with QEMU i can't type lolololol +typedef enum { KEYSCAN_ESC = 1 , KEYSCAN_1 = 2 , KEYSCAN_2 = 3 , diff --git a/src/kernel/dri/serial.c b/src/kernel/dri/serial.c new file mode 100644 index 0000000..60e9c6c --- /dev/null +++ b/src/kernel/dri/serial.c @@ -0,0 +1,6 @@ +/*----------------*\ +|Nanite OS | +|Copyright (C) 2025| +|Tyler McGurrin | +\*----------------*/ +#include "serial.h" \ No newline at end of file diff --git a/src/kernel/dri/serial.h b/src/kernel/dri/serial.h new file mode 100644 index 0000000..9d63cd8 --- /dev/null +++ b/src/kernel/dri/serial.h @@ -0,0 +1,6 @@ +/*----------------*\ +|Nanite OS | +|Copyright (C) 2025| +|Tyler McGurrin | +\*----------------*/ +#pragma once \ No newline at end of file diff --git a/src/libs/boot/bootparams.h b/src/libs/boot/bootparams.h index f161edc..50b2a5b 100644 --- a/src/libs/boot/bootparams.h +++ b/src/libs/boot/bootparams.h @@ -22,5 +22,6 @@ typedef struct typedef struct { MemoryInfo Memory; + char KernelParams; uint8_t BootDevice; } BootParams; diff --git a/src/libs/version.h b/src/libs/version.h index 86d9a11..19cdf80 100644 --- a/src/libs/version.h +++ b/src/libs/version.h @@ -6,5 +6,5 @@ #pragma once #define LOGO " _ _____ _ __________________\n / | / / | / | / / _/_ __/ ____/\n / |/ / /| | / |/ // / / / / __/ \n / /| / ___ |/ /| // / / / / /___ \n/_/ |_/_/ |_/_/ |_/___/ /_/ /_____/ \n" -#define VERSION "RD-00015" +#define VERSION "RD-00017" #define BOOTLOGO " _ ______ ____ ____ ______\n / | / / __ )/ __ \\/ __ /_ __/\n / |/ / __ / / / / / / // / \n / /| / /_/ / /_/ / /_/ // / \n/_/ |_/_____/\\____/\\____//_/ \n" diff --git a/test.txt b/test similarity index 100% rename from test.txt rename to test