Minor program improvements
This commit is contained in:
Binary file not shown.
@@ -33,6 +33,7 @@ int kmain(int retvalue)
|
|||||||
clear();
|
clear();
|
||||||
|
|
||||||
colorputs(ascii_title, 10);
|
colorputs(ascii_title, 10);
|
||||||
|
colorputs(" by @xamidev - star the repo for a cookie!\n\n", 11);
|
||||||
|
|
||||||
// TODO: Grub modules to load programs
|
// TODO: Grub modules to load programs
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ void shell_install()
|
|||||||
}
|
}
|
||||||
else if (strcmp(input_buffer, "help") == 0)
|
else if (strcmp(input_buffer, "help") == 0)
|
||||||
{
|
{
|
||||||
printf("This is the Blank Operating System\ndesigned for fun by xamidev\n\nCommand help:\n\n\thelp - shows this message\n\tpanic - makes the kernel panic\n\twords - generates random words\n\tprimes - computes prime numbers\n");
|
printf("help\tpanic\twords\tprimes\trainbow\tclear\n");
|
||||||
}
|
}
|
||||||
else if (strcmp(input_buffer, "panic") == 0)
|
else if (strcmp(input_buffer, "panic") == 0)
|
||||||
{
|
{
|
||||||
@@ -35,6 +35,14 @@ void shell_install()
|
|||||||
{
|
{
|
||||||
program_primes();
|
program_primes();
|
||||||
}
|
}
|
||||||
|
else if (strcmp(input_buffer, "rainbow") == 0)
|
||||||
|
{
|
||||||
|
program_rainbow();
|
||||||
|
}
|
||||||
|
else if (strcmp(input_buffer, "clear") == 0)
|
||||||
|
{
|
||||||
|
program_clear();
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
printf("Unknown command %s\n", input_buffer);
|
printf("Unknown command %s\n", input_buffer);
|
||||||
}
|
}
|
||||||
|
|||||||
31
src/programs/misc.c
Normal file
31
src/programs/misc.c
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
// Miscellaneous small programs
|
||||||
|
|
||||||
|
#include "../libc/stdio.h"
|
||||||
|
|
||||||
|
// Print a rainbow colorful text for testing
|
||||||
|
|
||||||
|
#define BUF_SIZE 256
|
||||||
|
#define COLORS 20
|
||||||
|
|
||||||
|
void program_rainbow()
|
||||||
|
{
|
||||||
|
char input_buffer[BUF_SIZE];
|
||||||
|
puts("What to print? ");
|
||||||
|
get_input(input_buffer, BUF_SIZE);
|
||||||
|
puts("\n");
|
||||||
|
|
||||||
|
for (int i=0; i<COLORS; i++)
|
||||||
|
{
|
||||||
|
colorputs(input_buffer, i);
|
||||||
|
puts("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear the terminal
|
||||||
|
|
||||||
|
#define ROWS 25
|
||||||
|
|
||||||
|
void program_clear()
|
||||||
|
{
|
||||||
|
for (int i=0; i<ROWS; i++) scroll(1);
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "../libc/stdint.h"
|
#include "../libc/stdint.h"
|
||||||
#include "../libc/stdio.h"
|
#include "../libc/stdio.h"
|
||||||
|
#include "../kernel/system.h"
|
||||||
|
|
||||||
#define PRIMES_MAX 1000000
|
#define PRIMES_MAX 1000000
|
||||||
|
|
||||||
@@ -18,6 +19,7 @@ void program_primes()
|
|||||||
{
|
{
|
||||||
printf("%d ", x);
|
printf("%d ", x);
|
||||||
}
|
}
|
||||||
|
delay(2);
|
||||||
}
|
}
|
||||||
puts("\n");
|
puts("\n");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,7 @@
|
|||||||
void program_words();
|
void program_words();
|
||||||
void program_primes();
|
void program_primes();
|
||||||
|
|
||||||
|
// Misc
|
||||||
|
void program_rainbow();
|
||||||
|
void program_clear();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user