feat(kernel): implement official two-line Kali-style Airlys prompt in bare-metal VGA driver
This commit is contained in:
1 parent
abcc8dafc5
commit
a8486515cc
4 files changed
+32
-7
No files matched your search
@@ -43,5 +43,6 @@ void vga_write(const char* data, size_t size);
|
|||||||
void vga_puts(const char* str);
|
void vga_puts(const char* str);
|
||||||
void vga_puthex(uint64_t val);
|
void vga_puthex(uint64_t val);
|
||||||
void vga_putdec(uint64_t val);
|
void vga_putdec(uint64_t val);
|
||||||
|
void vga_print_prompt(void);
|
||||||
|
|
||||||
#endif /* AIRLYS_VGA_H */
|
#endif /* AIRLYS_VGA_H */
|
||||||
+1
-3
@@ -63,9 +63,7 @@ static void keyboard_callback(registers_t* regs) {
|
|||||||
if (c != 0) {
|
if (c != 0) {
|
||||||
if (c == '\n') {
|
if (c == '\n') {
|
||||||
vga_putchar('\n');
|
vga_putchar('\n');
|
||||||
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
|
vga_print_prompt();
|
||||||
vga_puts("Airlys >>> ");
|
|
||||||
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
|
|
||||||
} else {
|
} else {
|
||||||
vga_putchar(c);
|
vga_putchar(c);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -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(" >>> Interactive Console Active. Type on your keyboard to test hardware input:\n");
|
||||||
vga_puts(" ------------------------------------------------------------------------------\n\n");
|
vga_puts(" ------------------------------------------------------------------------------\n\n");
|
||||||
|
|
||||||
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
|
vga_print_prompt();
|
||||||
vga_puts("Airlys >>> ");
|
|
||||||
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
|
|
||||||
|
|
||||||
/* Infinite safe idle loop awaiting hardware interrupts */
|
/* Infinite safe idle loop awaiting hardware interrupts */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|||||||
+29
-1
@@ -54,7 +54,7 @@ void vga_clear(void) {
|
|||||||
|
|
||||||
void vga_putchar(char c) {
|
void vga_putchar(char c) {
|
||||||
if (c == '\b') {
|
if (c == '\b') {
|
||||||
if (vga_column > 0) {
|
if (vga_column > 12) {
|
||||||
vga_column--;
|
vga_column--;
|
||||||
const size_t index = vga_row * VGA_WIDTH + vga_column;
|
const size_t index = vga_row * VGA_WIDTH + vga_column;
|
||||||
vga_buffer[index] = vga_entry(' ', vga_current_color);
|
vga_buffer[index] = vga_entry(' ', vga_current_color);
|
||||||
@@ -138,3 +138,31 @@ void vga_putdec(uint64_t val) {
|
|||||||
vga_putchar(buf[i]);
|
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);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user