isr: improve keyboard handler

This commit is contained in:
2025-03-19 21:46:46 +03:00
parent 5bff255a7a
commit c9d6e6183d
3 changed files with 19 additions and 16 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ extern kmain ; this function is gonna be located in our c code(kernel
start:
mov esp, stack_top
; cli ;clears the interrupts
cli ;clears the interrupts
lgdt [gdt]
mov ax, DATA_SEG
+16 -12
View File
@@ -4,6 +4,16 @@
#include "../include/screen.h"
#include "../include/pic.h"
typedef size_t uword_t;
struct interrupt_frame
{
uword_t ip;
uword_t cs;
uword_t flags;
uword_t sp;
uword_t ss;
};
void isr_custom();
void default_handler();
@@ -56,22 +66,16 @@ void default_handler()
}
#include <stddef.h>
#include <stdint.h>
typedef size_t uword_t;
struct interrupt_frame
void handle_keyboard()
{
uword_t ip;
uword_t cs;
uword_t flags;
uword_t sp;
uword_t ss;
};
uint8_t scancode = inb(0x60);
printf("%X ", scancode);
}
__attribute__((interrupt)) void isr_custom(struct interrupt_frame *frame)
{
terminal_writestring("YOOOOO!!!!!! I LOVE KATYA!!!!");
//terminal_writestring("YOOOOO!!!!!! I LOVE KATYA!!!!");
handle_keyboard();
pic_end_int(0x21);
}
+2 -3
View File
@@ -26,10 +26,9 @@ void kmain()
disk_info info;
get_disk_info(&info);
printf("CYL HEAD SECT: %X %X %X\n", info.cylinders, info.heads, info.sectors);
while(1)
{
if(inportb(0x64) & 0x1)
/* if(inportb(0x64) & 0x1)
{
unsigned char key = inportb(0x60);
if(key == 2)
@@ -39,6 +38,6 @@ void kmain()
else
terminal_writestring("dunno what is it\n");
}
}
*/ }
}