diff options
Diffstat (limited to 'src/c')
| -rw-r--r-- | src/c/gdt.c | 1 | ||||
| -rw-r--r-- | src/c/keyboard.c | 4 | ||||
| -rw-r--r-- | src/c/keymap.c | 4 | ||||
| -rw-r--r-- | src/c/stack_protector.c | 2 | ||||
| -rw-r--r-- | src/c/tty.c | 73 |
5 files changed, 61 insertions, 23 deletions
diff --git a/src/c/gdt.c b/src/c/gdt.c index 32d070b..739fe70 100644 --- a/src/c/gdt.c +++ b/src/c/gdt.c @@ -16,7 +16,6 @@ struct gdt_pointer uint32_t offset; } __attribute__((packed)); -// asm function extern void load_gdt(struct gdt_pointer *gdtp); struct gdt_entry gdt[5]; diff --git a/src/c/keyboard.c b/src/c/keyboard.c index 473ec20..d573472 100644 --- a/src/c/keyboard.c +++ b/src/c/keyboard.c @@ -17,6 +17,7 @@ size_t buffer_index=0; void previous_field(void); void terminal_putchar(char c); void tty(char *buffer); +void prompt(void); void clear(); void us_en(char keymap[]); @@ -48,6 +49,7 @@ void enter() for(int i=0;i<BUFFER_SIZE;i++) buffer[i]='\0'; buffer_index=0; } + prompt(); return; } @@ -88,6 +90,7 @@ void keyboard_handler() { clear(); prompt(); + printf("%s",buffer); return; } } @@ -100,6 +103,5 @@ void keyboard_handler() { ispressed[keycode-0x80]=0; } - } } diff --git a/src/c/keymap.c b/src/c/keymap.c index 04c79b2..d3d13aa 100644 --- a/src/c/keymap.c +++ b/src/c/keymap.c @@ -5,8 +5,8 @@ void us_en(char keymap[]) keymap[0x03]='2'; //2 pressed keymap[0x04]='3'; //3 pressed keymap[0x05]='4'; //4 pressed - keymap[0x06]='4'; //5 pressed - keymap[0x07]='5'; //6 pressed + keymap[0x06]='5'; //5 pressed + keymap[0x07]='6'; //6 pressed keymap[0x08]='7'; //7 pressed keymap[0x09]='8'; //8 pressed keymap[0x0A]='9'; //9 pressed diff --git a/src/c/stack_protector.c b/src/c/stack_protector.c index 50e4316..3289cec 100644 --- a/src/c/stack_protector.c +++ b/src/c/stack_protector.c @@ -9,7 +9,7 @@ uintptr_t __stack_chk_guard = STACK_CHK_GUARD; -__attribute__((noreturn)) +//__attribute__((noreturn)) void __stack_chk_fail(void) { #if __STDC_HOSTED__ diff --git a/src/c/tty.c b/src/c/tty.c index 8516489..116a15e 100644 --- a/src/c/tty.c +++ b/src/c/tty.c @@ -48,9 +48,9 @@ void merge(char parts[][CMD_LENGTH]) printf("%s\n",str1); } -void ls(size_t numberof,char parts[][CMD_LENGTH]) +void ls() { - printf("filesystem not implemented yet, %d,%s\n",numberof,parts[0]); + printf("Filesystem not implemented yet\n"); } void number(size_t numberof,char parts[][CMD_LENGTH]) @@ -58,8 +58,8 @@ void number(size_t numberof,char parts[][CMD_LENGTH]) if(numberof==1) printf("Please enter a number\n"); else { - printf("number times two is %d\n",2*stoi(parts[1])); - printf("number times two is %f\n",2*stof(parts[1])); + printf("Entered integer number is %d\n",stoi(parts[1])); + printf("Entered float number is: %f\n",stof(parts[1])); } } @@ -70,26 +70,63 @@ void uptime() void prompt() { - printf("[user@myos] > "); + //printf("[user@myos]$ "); + set_color(VGA_COLOR_RED,VGA_COLOR_BLACK); + printf("["); + set_color(VGA_COLOR_YELLOW,VGA_COLOR_BLACK); + printf("user"); + set_color(VGA_COLOR_GREEN,VGA_COLOR_BLACK); + printf("@"); + set_color(VGA_COLOR_BLUE,VGA_COLOR_BLACK); + printf("myos"); + set_color(VGA_COLOR_RED,VGA_COLOR_BLACK); + printf("]"); + set_color(VGA_COLOR_LIGHT_GREY,VGA_COLOR_BLACK); + printf("$ "); } void neofetch() { - set_color(VGA_COLOR_RED,VGA_COLOR_BLACK); - printf(" <*>\n"); - printf(" <*>\n"); - printf(" <*>\n"); - printf(" <*>\n"); - printf(" <*>\n"); - printf(" <*>\n"); - printf(" <*>\n"); - printf("<*******>\n"); - printf(" <***>\n"); - printf(" <*>\n"); + set_color(VGA_COLOR_WHITE,VGA_COLOR_BLACK); + printf(" . "); printf("Dobrodosli u moj \n"); + printf(" J:L (\"\"\") "); printf("operativni sistem :) \n"); + printf(" |:| III "); printf("Uzivajte! \n"); + printf(" |:| III "); printf(" \n"); + printf(" |:| III "); printf("Welcome to my \n"); + printf(" |:| __III__ "); printf("operating system :) \n"); + printf(" |:| /:-.___,-:\\ "); printf("Enjoy your stay! \n"); + printf(" |:| \\] |:| [/ "); printf(" \n"); + printf(" |:| |:| "); printf(" \n"); + printf(" |:| |:| "); printf(" \n"); + printf(" |:| |:| "); printf(" \n"); + printf(" /] |:| [\\ |:| "); printf(" \n"); + printf(" \\:-'\"\"\"`-:/ |:| "); printf(" \n"); + printf(" \"\"III\"\" |:| "); printf(" \n"); + printf(" III |:| "); printf(" \n"); + printf(" III |:| "); printf(" \n"); + printf(" III |:| "); printf("napravio/made by: \n"); + printf(" (___) J:F "); printf("Aleksa Vuckovic \n"); + printf(" \" "); printf(" \n"); + + for(size_t i=0;i<16;i++) + { + if(i==0) set_color(i,VGA_COLOR_WHITE); + else set_color(i,VGA_COLOR_BLACK); + printf("@%d ",i); + } + printf("\n"); + + set_color(VGA_COLOR_LIGHT_GREY,VGA_COLOR_BLACK); uptime(); } +void help() +{ + printf("Currently available commands:\n"); + printf("clear echo merge ls number uptime neofetch help\n"); +} + void tty(char *buffer) { char parts[CMD_LENGTH][CMD_LENGTH]; @@ -98,10 +135,10 @@ void tty(char *buffer) if(stringcmp(parts[0],"clear")) clear(); else if(stringcmp(parts[0],"echo")) echo(numberof,parts); else if(stringcmp(parts[0],"merge")) merge(parts); - else if(stringcmp(parts[0],"ls")) ls(numberof,parts); + else if(stringcmp(parts[0],"ls")) ls(); else if(stringcmp(parts[0],"number")) number(numberof,parts); else if(stringcmp(parts[0],"uptime")) uptime(); else if(stringcmp(parts[0],"neofetch")) neofetch(); + else if(stringcmp(parts[0],"help")) help(); else printf("command not found: %s\n",parts[0]); - prompt(); } |
