diff options
| author | Aleksa Vučković <aleksav013@gmail.com> | 2021-10-26 22:57:44 +0200 |
|---|---|---|
| committer | Aleksa Vučković <aleksav013@gmail.com> | 2021-10-26 22:57:44 +0200 |
| commit | 818a6fea63d5427e43becc0d4a5279a631a7f1a6 (patch) | |
| tree | 618d858176aaab6a2bc3d05389f8b4e31a980389 | |
| parent | 39822cdb0acdd1eec66c2e18e0711fd3cd6f033d (diff) | |
Small fixes + color + neofetch
| -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 | ||||
| -rw-r--r-- | src/include/vga.h | 14 |
6 files changed, 68 insertions, 30 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(); } diff --git a/src/include/vga.h b/src/include/vga.h index d828e48..93d5df3 100644 --- a/src/include/vga.h +++ b/src/include/vga.h @@ -8,20 +8,20 @@ static const size_t VGA_HEIGHT = 25; enum vga_color { VGA_COLOR_BLACK = 0, - VGA_COLOR_BLUE = 1, + VGA_COLOR_DARK_BLUE = 1, VGA_COLOR_GREEN = 2, - VGA_COLOR_CYAN = 3, + VGA_COLOR_TURQUOISE = 3, VGA_COLOR_RED = 4, - VGA_COLOR_MAGENTA = 5, + VGA_COLOR_PURPLE = 5, VGA_COLOR_BROWN = 6, VGA_COLOR_LIGHT_GREY = 7, VGA_COLOR_DARK_GREY = 8, - VGA_COLOR_LIGHT_BLUE = 9, + VGA_COLOR_BLUE = 9, VGA_COLOR_LIGHT_GREEN = 10, - VGA_COLOR_LIGHT_CYAN = 11, + VGA_COLOR_LIGHT_BLUE = 11, VGA_COLOR_LIGHT_RED = 12, - VGA_COLOR_LIGHT_MAGENTA = 13, - VGA_COLOR_LIGHT_BROWN = 14, + VGA_COLOR_PINK = 13, + VGA_COLOR_YELLOW = 14, VGA_COLOR_WHITE = 15, }; void set_color(enum vga_color fg, enum vga_color bg); |
