Implement Basic FDD Detection, Begin Implementing Floppy Driver, Bugfixes And More!

This commit is contained in:
Tyler McGurrin 2025-05-30 06:44:02 -04:00
parent 93b72e5a1e
commit ba9d1fae90
10 changed files with 106 additions and 11 deletions

View File

@ -7,4 +7,5 @@ They should be seperated via commas **WITHOUT ANY SPACES!**
- `quietkb` : Makes Keyboard Driver NOT Auto Output pressed keys to Video
## NOTE: THIS IS NOT CURRENTLY FULLY IMPLEMENTED!
## NOTE: THIS IS NOT CURRENTLY FULLY IMPLEMENTED!
(or Really At all For now... Need to make the damn disk calls)

View File

@ -1,6 +1,6 @@
/*----------------*\
|Nanite OS |
|Copyright (C) 2024|
|Copyright (C) 2025|
|Tyler McGurrin |
\*----------------*/
#include "x86.h"
@ -29,8 +29,8 @@ void Memory_Detect(MemoryInfo* memoryInfo)
g_MemRegions[g_MemRegionCount].ACPI = block.ACPI;
++g_MemRegionCount;
printf("E820: base=0x%llx length=0x%llx type=0x%x\n", block.Base, block.Length, block.Type);
// printf("E820: base=0x%llx length=0x%llx type=0x%x\n", block.Base, block.Length, block.Type);
// MAKE IT SHUT THE FUCK UP
ret = x86_E820GetNextBlock(&block, &continuation);
}

12
src/kernel/dri/cmos.c Normal file
View File

@ -0,0 +1,12 @@
/*----------------*\
|Nanite OS |
|Copyright (C) 2025|
|Tyler McGurrin |
\*----------------*/
#include "cmos.h"
void CMOS_RTC_Handler()
{
}

8
src/kernel/dri/cmos.h Normal file
View File

@ -0,0 +1,8 @@
/*----------------*\
|Nanite OS |
|Copyright (C) 2025|
|Tyler McGurrin |
\*----------------*/
#pragma once
void CMOS_RTC_Handler();

View File

@ -0,0 +1,37 @@
/*----------------*\
|Nanite OS |
|Copyright (C) 2025|
|Tyler McGurrin |
\*----------------*/
#include "floppy.h"
#include <stdint.h>
#include <util/binary.h>
#include <arch/i686/io.h>
#include <arch/i686/irq.h>
#define PORT_FLOPPY_TYPE 0x10
int Master_FDD_Detect()
{
int Buffer;
int FDDType;
/* FDD Drive Values
Value: Drive Type:
00h no drive
01h 360 KB 5.25 Drive
02h 1.2 MB 5.25 Drive
03h 720 KB 3.5 Drive
04h 1.44 MB 3.5 Drive
05h 2.88 MB 3.5 drive*/
Buffer = i686_inb(PORT_FLOPPY_TYPE);
int bit = Byte_Parse(Buffer, 0);
int i = 1;
while(i < 4) {
FDDType = bit & bit;
bit = Byte_Parse(Buffer, i);
i++;
}
return FDDType;
}

View File

@ -0,0 +1,8 @@
/*----------------*\
|Nanite OS |
|Copyright (C) 2025|
|Tyler McGurrin |
\*----------------*/
#pragma once
int Master_FDD_Detect();

View File

@ -11,6 +11,10 @@
#include <arch/i686/irq.h>
#include <arch/i686/basicfunc.h>
#include <dri/keyboard.h>
#include <dri/cmos.h>
#include <dri/fat.h>
#include <dri/disk/floppy.h>
#include <dri/disk/ata.h>
#include <util/param.h>
#include "../libs/version.h"
#include "../libs/boot/bootparams.h"
@ -20,12 +24,14 @@
extern uint8_t __bss_start;
extern uint8_t __end;
int masterFDDType;
int uptime;
void timer(Registers* regs)
{
uptime++;
printf("%d", uptime);
movecursorpos(8,14);
// printf("%d", uptime);
// movecursorpos(8,14);
}
int keyboard_scancode;
@ -49,12 +55,18 @@ void __attribute__((section(".entry"))) start(BootParams* bootParams) {
HAL_Initialize();
movecursorpos(19, 8);
printf("Done!\n\n\n\n\n");
i686_IRQ_RegisterHandler(0, timer);
i686_IRQ_RegisterHandler(8, CMOS_RTC_Handler);
// Begin Loading Basic Drivers
printf("Load Keyboard Driver...");
i686_IRQ_RegisterHandler(1, keyboard);
printf("Done!\n");
printf("Uptime: ");
printf("Load Basic Storage Drivers...");
masterFDDType = Master_FDD_Detect();
printf("Done!\n");
printf("Master FDD Type: %d", masterFDDType);
// Debug Info for Memory :3 i REALLY need to make a like serial debug output thingy

15
src/kernel/util/binary.c Normal file
View File

@ -0,0 +1,15 @@
/*----------------*\
|Nanite OS |
|Copyright (C) 2025|
|Tyler McGurrin |
\*----------------*/
#include <stdint.h>
int Byte_Parse(int8_t byteFlag, int whichBit)
{
if (whichBit > 0 && whichBit <= 8)
return (byteFlag & (1<<(whichBit-1)));
else
return 0;
}

View File

@ -1,9 +1,11 @@
/*----------------*\
|Nanite OS |
|Copyright (C) 2024|
|Copyright (C) 2025|
|Tyler McGurrin |
\*----------------*/
#pragma once
#define FLAG_SET(x, flag) x |= (flag)
#define FLAG_UNSET(x, flag) x &= ~(flag)
#define FLAG_UNSET(x, flag) x &= ~(flag)
int Byte_Parse(int8_t byteFlag, int whichBit);

View File

@ -6,5 +6,5 @@
#pragma once
// Version Info MUST stay on line 9! (it gets incremented on build!)
#define LOGO " _ _____ _ __________________\n / | / / | / | / / _/_ __/ ____/\n / |/ / /| | / |/ // / / / / __/ \n / /| / ___ |/ /| // / / / / /___ \n/_/ |_/_/ |_/_/ |_/___/ /_/ /_____/ \n"
#define VERSION "RD-00004"
#define VERSION "RD-00008"
#define BOOTLOGO " _ ______ ____ ____ ______\n / | / / __ )/ __ \\/ __ /_ __/\n / |/ / __ / / / / / / // / \n / /| / /_/ / /_/ / /_/ // / \n/_/ |_/_____/\\____/\\____//_/ \n"