From 159ad1c78995df18f60c77b3b91c4a80ac328fdf Mon Sep 17 00:00:00 2001 From: shockrahwow Date: Thu, 14 Nov 2019 16:40:52 -0800 Subject: [PATCH] goal is to get this to work when its ran/called --- shell.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 shell.c diff --git a/shell.c b/shell.c new file mode 100644 index 0000000..1830a5c --- /dev/null +++ b/shell.c @@ -0,0 +1,39 @@ +// NOTE: we shouldn't have to worry about scrolling so the library/kernel +// should do this for us +// Oh yes +#include "stlio.h" +#include "types.h" + +#define bsize 101 + +#define banner0 "_______ _______ _________" +#define banner1 "\\ _ \\____________ ____ ____ ____ \\ _ \\ / _____/" +#define banner2 "/ /_\\ \\_ __ \\__ \\ / \\ / ___\\_/ __ \\/ /_\\ \\ \\_____ \\ " +#define banner3 "\\ \\_/ \\ | \\// __ \\| | \\/ /_/ > ___/\\ \\_/ \\/ \\" +#define banner4 " \\_____ /__| (____ /___| /\\___ / \\___ >\\_____ /_______ /" +#define banner5 " \\/ \\/ \\//_____/ \\/ \\/ \\/ " + +void smain(void) { + // print out a nice banner on start + printf(banner0); + printf(banner1); + printf(banner2); + printf(banner3); + printf(banner4); + printf(banner5); + + char buffer[bsize]; + while(1) { + // read into buffer bsize bytes, if we reach bsize then we just keep replacing that character + // keep in mind however that backspace will take us back as well + u32 bytes = read(buffer, bsize); // reeads n - 1 characters as the last one is always null + // now we process options + if(strcmp(buffer, "quit") == 0) { + break; + } + // generate a random number on the screen for now + if(strcmp(buffer, "rand") == 0) { + printHex(random32(5000)); + } + } +}