From 818a6fea63d5427e43becc0d4a5279a631a7f1a6 Mon Sep 17 00:00:00 2001 From: Aleksa Vučković Date: Tue, 26 Oct 2021 22:57:44 +0200 Subject: Small fixes + color + neofetch --- src/c/gdt.c | 1 - src/c/keyboard.c | 4 ++- src/c/keymap.c | 4 +-- src/c/stack_protector.c | 2 +- src/c/tty.c | 73 +++++++++++++++++++++++++++++++++++++------------ src/include/vga.h | 14 +++++----- 6 files changed, 68 insertions(+), 30 deletions(-) (limited to 'src') 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 "); + //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); -- cgit v1.2.3