I swear this is going to be a long day.

This commit is contained in:
Jonathan Turner 2023-11-29 08:21:52 -05:00
parent f25003e0d6
commit 18c6d3c858

View File

@ -1,8 +1,6 @@
#include "kernel.h" #include "kernel.h"
// Standard Bois #include "stdio.h"
#include <string.h>
#include <stdlib.h>
// This only runs once and from there on forth only interrupts will cause something to happen // This only runs once and from there on forth only interrupts will cause something to happen
// e.g. displaying to screen and taking input from keyboard // e.g. displaying to screen and taking input from keyboard
@ -39,22 +37,11 @@ void user_input(char *input) {
if (strcmp(input, "END") == 0) { if (strcmp(input, "END") == 0) {
kprint("Stopping the CPU. Bye!\n"); kprint("Stopping the CPU. Bye!\n");
asm volatile("hlt"); asm volatile("hlt");
// } else if (strcmp(input, "ADD") == 0) { } else if (strcmp(input, "ADD") == 0) {
// umem_head = add_node( umem_head, 0x10000, 0x100, true, global_id++); if (sstrlen(input, 15) > 4) {
// } kprint("owo");
} else if (strncmp(input, "ADD", 3) == 0) { }
// Parse the base register value from the user input umem_head = add_node( umem_head, 0x10000, 0x100, true, global_id++);
char base_str[16];
// Get input from your input source (you need to implement this)
strncpy(base_str, input + 3, sizeof(base_str) - 1); // Skip the command part
base_str[sizeof(base_str) - 1] = '\0'; // Null-terminate the base_str
// Convert base_str to an integer (you need a suitable conversion function)
u32 base = digit_conver(base_str);
// Now you have the base register input, and you can use it as needed
umem_head = add_node(umem_head, base, 0x100, true, global_id++);
} else if (strcmp(input, "LIST") == 0) { } else if (strcmp(input, "LIST") == 0) {
kprint("***** FORWARD ****\n"); kprint("***** FORWARD ****\n");
print_list( umem_head, true); print_list( umem_head, true);