#include "kernel.h" #include "interrupts.h" #include "../lib/logger/log.h" // logger facilities #define FOOLOS_MODULE_NAME "shell" #define COMMAND_LENGTH 255 static char command[COMMAND_LENGTH]; static int pos=0; // in timer: uint16_t timer16; void shell_init() { pos=0; command[0]=0; scr_put_string("Command> "); } void shell_put(char x) { log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"char:%c",x); if(pos0); pos--; command[pos]=0; } int strcmp(char *b1, char *b2) { int i=0; while(b1[i]==b2[i]&&b1[i]!=0&&b2[i]!=0) i++; if(b1[i]==0&&b2[i]==0)return 1; return 0; } // TODO: EXECUTE LATER not inside INTERRUPT !!! void shell_execute() { //scr_nextline(); //scr_put_string(" processing command: "); //scr_put_string_nl(command); if(1==strcmp(command,"TIME")) { log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%d seconds passed since system start.",timer16); } else if(1==strcmp(command,"EIGHT")) { int_generate88(); } else if(1==strcmp(command,"READ")) { uint8_t *read= flpydsk_read_sector (10); } else { log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"command unknown"); } pos=0; scr_nextline(); scr_put_string("Command> "); }