Fix braces + init_paging args

This commit is contained in:
2026-03-11 19:58:00 +01:00
parent 9d409317e2
commit 8e2a612d88
29 changed files with 147 additions and 229 deletions

View File

@@ -161,11 +161,9 @@ void keyboard_handler()
unsigned char scancode = inb(0x60);
// Key release (bit 7 set)
if (scancode & 0x80)
{
if (scancode & 0x80) {
unsigned char code = scancode & 0x7F;
switch (code)
{
switch (code) {
// Clear the corresponding bit if corresponding key is released
case LEFT_SHIFT_PRESSED:
case RIGHT_SHIFT_PRESSED:
@@ -179,12 +177,9 @@ void keyboard_handler()
break;
}
return;
}
else
{
} else {
// Key press
switch (scancode)
{
switch (scancode) {
// Set bits for corresponding special key press
case LEFT_SHIFT_PRESSED:
case RIGHT_SHIFT_PRESSED:
@@ -200,15 +195,12 @@ void keyboard_handler()
default:
{
// Avoiding buffer overflow from extended keys lol
if (scancode < 128)
{
if (scancode < 128) {
// Should we get a SHIFTED char or a regular one?
unsigned char c = (key_status & SHIFT_PRESSED_BIT) ? keymap_shifted[scancode] : keymap[scancode];
if (c)
{
if (c == '\n')
{
if (c) {
if (c == '\n') {
_putchar('\r');
}
// Should probably have a keyboard buffer here... instead of this
@@ -225,8 +217,7 @@ void keyboard_init(unsigned char layout)
// Here we might go and select PS/2, USB, or other... (once we implement multiple keyboard protocols)
// Keyboard layout selection
switch (layout)
{
switch (layout) {
case US:
keymap = kbdus;
keymap_shifted = kbdus_shifted;
@@ -242,8 +233,7 @@ void keyboard_init(unsigned char layout)
}
// Flush keyboard buffer
while (inb(0x64) & 1)
{
while (inb(0x64) & 1) {
inb(0x60);
}

View File

@@ -13,15 +13,13 @@ void keyboard_handler();
#define ALT_PRESSED_BIT 0b00000010
#define CTRL_PRESSED_BIT 0b00000100
enum SpecialKeys
{
enum SpecialKeys {
SHIFT = 255,
ALT = 254,
CTRL = 253
};
enum SpecialScancodes
{
enum SpecialScancodes {
LEFT_SHIFT_PRESSED = 0x2A,
LEFT_SHIFT_RELEASED = 0xAA,
RIGHT_SHIFT_PRESSED = 0x36,
@@ -32,8 +30,7 @@ enum SpecialScancodes
ALT_RELEASED = 0xB8
};
enum KeyboardLayout
{
enum KeyboardLayout {
US,
FR
};