Add: read keyboard input (getch)

This commit is contained in:
xamidev
2024-07-21 15:23:32 +02:00
parent b8faf9dd8e
commit 05393b36f8
7 changed files with 53 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
#include "stdio.h"
#include "string.h"
#include "stdint.h"
#include "../kernel/system.h"
char* fb = (char *) 0x000B8000;
const unsigned VGA_WIDTH = 80;
@@ -335,3 +336,23 @@ int* printf_number(int* argp, int length, bool sign, int radix)
return argp;
}
int getch()
{
return keyboard_getchar();
}
void get_input(char *buffer, int size) {
int index = 0;
char c;
while (index < size-1)
{
c = getch();
if (c == '\n') break;
buffer[index++] = c;
putc(c);
}
buffer[index] = '\0';
}