diff --git a/include/airlys/vga.h b/include/airlys/vga.h index 4564642..bf8780f 100644 --- a/include/airlys/vga.h +++ b/include/airlys/vga.h @@ -43,5 +43,6 @@ void vga_write(const char* data, size_t size); void vga_puts(const char* str); void vga_puthex(uint64_t val); void vga_putdec(uint64_t val); +void vga_print_prompt(void); #endif /* AIRLYS_VGA_H */ diff --git a/kernel/keyboard.c b/kernel/keyboard.c index 61376c8..276937f 100644 --- a/kernel/keyboard.c +++ b/kernel/keyboard.c @@ -63,9 +63,7 @@ static void keyboard_callback(registers_t* regs) { if (c != 0) { if (c == '\n') { vga_putchar('\n'); - vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK); - vga_puts("Airlys >>> "); - vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK); + vga_print_prompt(); } else { vga_putchar(c); } diff --git a/kernel/kmain.c b/kernel/kmain.c index 96c7a4c..2edc3df 100644 --- a/kernel/kmain.c +++ b/kernel/kmain.c @@ -61,9 +61,7 @@ void kernel_main(uint64_t magic, uint64_t addr) { vga_puts(" >>> Interactive Console Active. Type on your keyboard to test hardware input:\n"); vga_puts(" ------------------------------------------------------------------------------\n\n"); - vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK); - vga_puts("Airlys >>> "); - vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK); + vga_print_prompt(); /* Infinite safe idle loop awaiting hardware interrupts */ for (;;) { diff --git a/kernel/vga.c b/kernel/vga.c index bbbe5b9..c0c821d 100644 --- a/kernel/vga.c +++ b/kernel/vga.c @@ -54,7 +54,7 @@ void vga_clear(void) { void vga_putchar(char c) { if (c == '\b') { - if (vga_column > 0) { + if (vga_column > 12) { vga_column--; const size_t index = vga_row * VGA_WIDTH + vga_column; vga_buffer[index] = vga_entry(' ', vga_current_color); @@ -138,3 +138,31 @@ void vga_putdec(uint64_t val) { vga_putchar(buf[i]); } } + +void vga_print_prompt(void) { + /* Line 1: ┌──(root@airlys-os)-[/home/user] */ + vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK); + vga_putchar((char)0xDA); /* CP437 box top-left: ┌ */ + vga_putchar((char)0xC4); /* CP437 horizontal: ─ */ + vga_putchar((char)0xC4); /* CP437 horizontal: ─ */ + vga_puts("("); + + vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK); + vga_puts("root"); + + vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK); + vga_puts("@airlys-os)-["); + + vga_set_color(VGA_COLOR_LIGHT_BLUE, VGA_COLOR_BLACK); + vga_puts("/home/user"); + + vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK); + vga_puts("]\n"); + + /* Line 2: └─Airlys >> */ + vga_putchar((char)0xC0); /* CP437 box bottom-left: └ */ + vga_putchar((char)0xC4); /* CP437 horizontal: ─ */ + vga_puts("Airlys >> "); + + vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK); +}