mirror of
https://github.com/fergalmoran/ferglos.git
synced 2026-01-25 18:16:42 +00:00
Keyboard handling working
This commit is contained in:
@@ -8,40 +8,10 @@
|
||||
|
||||
#include "../include/gdt.h"
|
||||
#include "../include/interrupts.h"
|
||||
#include "../include/keyboard.h"
|
||||
#include "../include/stdio.h"
|
||||
#include "../include/types.h"
|
||||
|
||||
void printf(char* str) {
|
||||
static uint16_t* VideoMemory = (uint16_t*)0xb8000;
|
||||
static uint8_t x = 0, y = 0;
|
||||
|
||||
for (int i = 0; str[i] != '\0'; ++i) {
|
||||
switch (str[i]) {
|
||||
case '\n':
|
||||
y++;
|
||||
x = 0;
|
||||
break;
|
||||
default:
|
||||
VideoMemory[80 * y + x] = (VideoMemory[80 * y + x] & 0xFF00) | str[i];
|
||||
x++;
|
||||
break;
|
||||
}
|
||||
|
||||
//line feed after 80 chars (terminal width)
|
||||
if (x >= 80) {
|
||||
y++;
|
||||
x = 0;
|
||||
}
|
||||
//we've reached max screen rows
|
||||
if (y > 25) {
|
||||
for (y = 0; y < 25; y++) {
|
||||
for (x - 0; x < 80; x++) {
|
||||
VideoMemory[80 * y + x] = (VideoMemory[80 * y + x] & 0xFF00) | ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*constructor)();
|
||||
extern "C" constructor start_ctors;
|
||||
extern "C" constructor end_ctors;
|
||||
@@ -51,13 +21,11 @@ extern "C" void call_constructors() {
|
||||
}
|
||||
|
||||
extern "C" void ferglos_Main(const void* multiboot_structure, uint32_t /*mb_mag*/) {
|
||||
printf("Welcome to FerglOS v0.0.2!\n");
|
||||
printf("Hitler blinks.");
|
||||
printf("Welcome to FerglOS v0.0.2!\n\n");
|
||||
|
||||
GlobalDescriptorTable gdt;
|
||||
InterruptManager interrupts(&gdt);
|
||||
|
||||
//instantiate hardware in here somewhere
|
||||
KeyboardDriver keyboard(&interrupts);
|
||||
|
||||
interrupts.Activate();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user