void printPrettyTime() { tcputs(itoa(getHours()),COLOR_WHITE); tcputs(":",COLOR_WHITE); tcputs(itoa(getMinutes()),COLOR_WHITE); tcputs(":",COLOR_WHITE); tcputs(itoa(getSeconds()),COLOR_WHITE); tputs("\n"); }
void testTimer() { tcputs("Testing Timer....\n",COLOR_WHITE); int i = 0; for (i = 0; i < 10; i++) { wait(1000); //wait for 100 milliseconds tcputs("TICK\n",COLOR_WHITE); } }
void help() { tcputs("Availible Commands:\n",COLOR_WHITE); NODE* current = &head; for (int i = 0; i < numOfCmds; i++) { tcputs(current->name, COLOR_WHITE); tputs("\n"); current = current->next; } }
NODE* findCommand(char* command) { int i = 0; NODE* current; current = &head; for(i = 0; i<numOfCmds; i++)//while(current->next) { if (current->c1 == command[0]) { if (current->c2 == command[1]) { if (current->c3 == command[2]) { if (current->len == (strlen(command))) { return current; } } } } current = current->next; } tcputs("ERROR COMMAND NOT FOUND\n", COLOR_RED); return NULL; }
void init_shell() { getCmdCount(); populateCommands(); tcputs("$>> ", COLOR_GREEN); irq_install_handler(1, keyboard_handler); waitCmd(); }
void runShell(char* command) { NODE* cmd; cmd = findCommand(command); if (cmd) cmd->cmd(); tcputs("$>> ", COLOR_GREEN); waitCmd(); }
void mallocTestCmd() { tcputs("MallocTest\n", COLOR_WHITE); int* testArray = (int*)malloc(5*sizeof(int)); int test[5] = {1,2,3,4,5}; tputs("Array is allocated at: "); tputs(itoa(testArray)); tputs("\n"); testArray[0] = 10; testArray[1] = 22; testArray[2] = 33; testArray[3] = 45; testArray[4] = 56; if (testArray[0] == 10) tputs("\tPASS\n"); else tcputs("\tFAIL\n", COLOR_RED); if (testArray[1] == 22) tputs("\tPASS\n"); else tcputs("\tFAIL\n", COLOR_RED); if (testArray[2] == 33) tputs("\tPASS\n"); else tcputs("\tFAIL\n", COLOR_RED); if (testArray[3] == 45) tputs("\tPASS\n"); else tcputs("\tFAIL\n", COLOR_RED); if (testArray[4] == 56) tputs("\tPASS\n"); else tcputs("\tFAIL\n", COLOR_RED); int* test2 = (int*)malloc(100*sizeof(int)); int i = 0; for (i = 0; i<100; i++) test2[i] = i; for (i = 0; i<100; i++) { tputs(itoa(test2[i])); } tputs(itoa(test2)); tputs("\n"); tputs(itoa(test)); tputs("\n"); }
void runShell() { tcputs("$>> ", COLOR_GREEN); }
void init_shell() { tcputs("$>> ", COLOR_GREEN); irq_install_handler(1, keyboard_handler); //doesn't work because init_shell() will return as soon as it passes this if branch }
void initForth() { tcputs("ok\n", COLOR_WHITE); for(;;); }
void info() { tcputs("HobbyOS\nCopyright GPUJake 2014\n", COLOR_WHITE); }
void run() { tcputs("Running...\n",COLOR_WHITE); }