Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Код в обработчике клавиатуры:
- if(keycode == ENTER_KEY_CODE) {
- tty_putchar('\n');
- shell_exec(string_mem);
- string_mem_counter = 0;
- memset(string_mem, 0, STRING_MEM_MAX);
- tty_setcolor(VGA_COLOR_LIGHT_GREEN);
- tty_printf("\n $");
- tty_setcolor(VGA_COLOR_LIGHT_CYAN);
- return;
- }
- //Вот код функции shell_exec:
- void shell_exec(char *input_command){
- char *help= "help";
- if(strcmp(input_command, help)==0){
- tty_printf("\nSynapseOS is a free and open source 64x operating system written in FASM and C.\nCommands:\n help - info about commands\n sysinfo - system information");
- } else{
- tty_printf("\n[");
- tty_printf(input_command);
- tty_printf("]");
- }
- }
- //Вот моя реализация strcmp:
- int strcmp(char *str1, char *str2) {
- return memcmp(str1, str2, strlen(str1) + 1);
- }
- //memcmp:
- int memcmp(void *mem1, void *mem2, size_t count) {
- char above, below;
- asm("movl %0, %%esi \n movl %1, %%edi \n movl %2, %%ecx \n repe cmpsb"::"a"(mem1),"b"(mem2),"c"(count));
- asm("seta %0 \n setb %1":"=a"(above),"=b"(below));
- return above - below;
- }
- /*
- В репозитории много мусора, но я его оставлю на всякий случай
- Репозиторий:
- https://github.com/Synapse-OS/SynapseOS
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement