diff --git a/shell.c b/shell.c index 3ada788..aa5b252 100644 --- a/shell.c +++ b/shell.c @@ -4,26 +4,28 @@ #include "pit.h" char line[LINE_LENGTH]; + void jmain(void) { memset((u8*)line, 0x00, LINE_LENGTH); + printf("Welcome to jankos\n"); + printf("Some basic commands to get you started: \n" + " timer: prints out current timer tick\n" + " quit: hangs because power management vry hrd\n"); + printf("Where's the prompt? \n It literally causes triple faults so its invisible :^)\n" + "_Also the cursor is busted and i don't wanna fix it"); while(1) { - printf("jos % "); + memset((u8*)line, 0x00, LINE_LENGTH); read(line, LINE_LENGTH); - printf("\n"); - //asm("xchg bx, bx"); - if(!strcmp("break", line)) { - printf("breaking out"); - memset((u8*)line, 0x00, LINE_LENGTH); + if(strlen(line) == 1) { + continue; } - else if(!strcmp("timer", line)) { + if(!strcmp("quit\n", line)) { + printf("Well I guess we'll hang now\n"); + break; + } + if(!strcmp("timer\n", line)) { printf("Time tick: "); - printhex(pit_timer_ticks); - memset((u8*)line, 0x00, LINE_LENGTH); - } - else { - printf("Attempting a second read: "); - read(line, LINE_LENGTH); - printf(line); + printhex(pit_timer_ticks); putch('\n'); } } } diff --git a/stlio.c b/stlio.c index 9f7499e..f02b020 100644 --- a/stlio.c +++ b/stlio.c @@ -64,6 +64,7 @@ u32 read(char* buffer, u32 size) { if(pit_timer_ticks - kbd_time < 0x20 && state == KBD_RELEASE) { __char_set(&(buffer[bytes]), (u8)kbd_key); if(kbd_key == '\n') { + putch('\n'); return bytes; } bytes++; @@ -72,6 +73,7 @@ u32 read(char* buffer, u32 size) { } pit_timer_wait(1); } + kbd_key = KBD_RELEASE; buffer[size-1] = '\0'; return bytes; }