VBE驱动更新

This commit is contained in:
xiaoyi1212 2024-06-04 23:46:37 +08:00
parent 02c5624824
commit 2c0b386a8b
3 changed files with 30 additions and 5 deletions

View File

@ -146,8 +146,33 @@ void vbe_putchar(char ch) {
} }
void vbe_write(const char *data, size_t size) { void vbe_write(const char *data, size_t size) {
for (size_t i = 0; i < size; i++) static const long hextable[] = {
vbe_putchar(data[i]); [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) { void vbe_writestring(const char *data) {
@ -173,7 +198,7 @@ void initVBE(multiboot_t *info) {
width = info->framebuffer_width; width = info->framebuffer_width;
height = info->framebuffer_height; height = info->framebuffer_height;
color = 0xc6c6c6; color = 0xc6c6c6;
back_color = 0x343541; back_color = 0x1c1c1c;
c_width = width / 9; c_width = width / 9;
c_height = height / 16; c_height = height / 16;

View File

@ -48,7 +48,7 @@ int check_task(int *pid){
struct task_struct *shell = found_task_pid(*pid); struct task_struct *shell = found_task_pid(*pid);
while (1){ while (1){
if(shell->state == TASK_DEATH){ 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.> "); printf("Enter any key to restart kernel.> ");
getc(); getc();
printf("\n"); printf("\n");

View File

@ -357,7 +357,7 @@ void setup_shell() {
while (1) { while (1) {
vfs_getPath(buffer); 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; if (gets(com, MAX_COMMAND_LEN) <= 0) continue;
argc = cmd_parse(com, argv, ' '); argc = cmd_parse(com, argv, ' ');