Add: program: words version 1

This commit is contained in:
xamidev
2024-07-24 15:08:39 +02:00
parent b352d3f4e2
commit 631099a53d
10 changed files with 104 additions and 10 deletions

View File

@@ -36,7 +36,7 @@ int kmain(int retvalue)
// TODO: Grub modules to load programs
//timer_install();
timer_install();
keyboard_install();
shell_install();

View File

@@ -1,6 +1,7 @@
#include "system.h"
#include "../libc/stdio.h"
#include "../libc/string.h"
#include "../programs/programs.h"
#define BUFFER_SIZE 256
@@ -26,6 +27,10 @@ void shell_install()
{
printf("%d", 4/0);
}
else if (strcmp(input_buffer, "words") == 0)
{
program_words();
}
else {
printf("Unknown command %s\n", input_buffer);
}

View File

@@ -22,5 +22,8 @@ void delay(int ticks);
void keyboard_install();
char keyboard_getchar();
void shell_install();
extern volatile unsigned long global_ticks;
#endif

View File

@@ -1,16 +1,11 @@
#include "system.h"
#include "../libc/stdio.h"
int timer_ticks = 0;
volatile unsigned long global_ticks = 0;
void timer_handler()
{
timer_ticks++;
if(timer_ticks % 18 == 0)
{
puts("One second has passed\n");
}
global_ticks++;
}
void timer_install()
@@ -21,6 +16,6 @@ void timer_install()
void delay(int ticks)
{
unsigned long eticks;
eticks = timer_ticks + ticks;
while ((unsigned long)timer_ticks < eticks);
eticks = global_ticks + ticks;
while (global_ticks < eticks);
}