diff --git a/src/driver/vbe.c b/src/driver/vbe.c index a0c89db..95d8a7c 100644 --- a/src/driver/vbe.c +++ b/src/driver/vbe.c @@ -146,8 +146,33 @@ void vbe_putchar(char ch) { } void vbe_write(const char *data, size_t size) { - for (size_t i = 0; i < size; i++) - vbe_putchar(data[i]); + static const long hextable[] = { + [0 ... 255] = -1, // bit aligned access into this table is considerably + ['0'] = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, // faster for most modern processors, + ['A'] = 10, 11, 12, 13, 14, 15, // for the space conscious, reduce to + ['a'] = 10, 11, 12, 13, 14, 15 // signed char. + }; + + for (;*data; ++data){ + char c = *data; + if(c == '\033'){ + uint32_t text_color = 0; + ++data; + while (*data && text_color >= 0) { + text_color = (text_color << 4) | hextable[*data++]; + if(*data == ';')break; + } + color = text_color; + }else if(c == '\034'){ + uint32_t text_color = 0,a = 0; + ++data; + while (*data && text_color >= 0) { + text_color = (text_color << 4) | hextable[*data++]; + if(*data == ';')break; + } + back_color = text_color; + } else vbe_putchar(c); + } } void vbe_writestring(const char *data) { @@ -173,7 +198,7 @@ void initVBE(multiboot_t *info) { width = info->framebuffer_width; height = info->framebuffer_height; color = 0xc6c6c6; - back_color = 0x343541; + back_color = 0x1c1c1c; c_width = width / 9; c_height = height / 16; diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index dc2248b..c7fd509 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -48,7 +48,7 @@ int check_task(int *pid){ struct task_struct *shell = found_task_pid(*pid); while (1){ if(shell->state == TASK_DEATH){ - printf("\033\n[Task-Check]: Task was throw exception.\036\n"); + printf("\n[Task-Check]: Task was throw exception.\n"); printf("Enter any key to restart kernel.> "); getc(); printf("\n"); diff --git a/src/sysapp/shell.c b/src/sysapp/shell.c index a3e0240..7ab87d7 100644 --- a/src/sysapp/shell.c +++ b/src/sysapp/shell.c @@ -357,7 +357,7 @@ void setup_shell() { while (1) { vfs_getPath(buffer); - printf("%s@localhost: %s\\$ ", user1, buffer); + printf("\03343cd80;%s@localhost: \0334169E1;%s\\\033c6c6c6;$ ", user1, buffer); if (gets(com, MAX_COMMAND_LEN) <= 0) continue; argc = cmd_parse(com, argv, ' ');