diff --git a/src/drivers/framebuffer.c b/src/drivers/framebuffer.c index b148102..02687bd 100644 --- a/src/drivers/framebuffer.c +++ b/src/drivers/framebuffer.c @@ -32,7 +32,7 @@ void draw_char(unsigned short int c, int cx, int cy, uint32_t fg, uint32_t bg) int offs = (cy * font->height * scanline) + - (cx * (font->width + 1) * sizeof(PIXEL)); + (cx * (font->width) * sizeof(PIXEL)); unsigned int x, y; int line, mask; diff --git a/src/kernel/kmain.c b/src/kernel/kmain.c index c1d8691..ca81b11 100644 --- a/src/kernel/kmain.c +++ b/src/kernel/kmain.c @@ -28,12 +28,10 @@ typedef struct { char* ascii_title = "\n" -" oooooooooo o888 oooo ooooooo oooooooo8\n" -" 888 888 888 ooooooo oo oooooo 888 ooooo o888 888o 888 \n" -" 888oooo88 888 ooooo888 888 888 888o888 888 888 888oooooo \n" -" 888 888 888 888 888 888 888 8888 88o 888o o888 888\n" -" o888ooo888 o888o 88ooo88 8o o888o o888o o888o o888o 88ooo88 o88oooo888\n\n" -" --------------------------------- v0.3.55 --------------------------------\n\n"; +"*******************************\n" +"| Blank OS version 0.3.68-dev |\n" +"*******************************\n" +"\n"; unsigned int g_multiboot_info_address; @@ -44,6 +42,7 @@ int scanline; uint32_t VGA_WIDTH; uint32_t VGA_HEIGHT; + void kmain(multiboot2_info *mb_info) { @@ -105,8 +104,20 @@ serial_printf(3, "Framebuffer BPP: %u\r\n", fb_info->framebuffer_bpp); log("Drew to framebuffer.\r\n", 3); } + /* puts("This should work by now! Enter Graphics Mode."); printf("\nMy name is %s, and I'm %d. 0x%x", "Alan", 34, 0xdeadbeef); + + for (int i=0; i<512; i++) + { + printf("%d ", i); + } + */ + + //colorputs("Wow, such colorful output!", green, blue); + + colorputs(ascii_title, green, black); + while (1); diff --git a/src/kernel/shell.c b/src/kernel/shell.c index 4dc49f1..1bef02e 100644 --- a/src/kernel/shell.c +++ b/src/kernel/shell.c @@ -73,7 +73,7 @@ void shell_install() { char input_buffer[BUFFER_SIZE]; char* argv[MAX_ARGS]; - colorputs("blankos> ", 9); + //colorputs("blankos> ", 9); get_input(input_buffer, BUFFER_SIZE); puts("\n"); diff --git a/src/libc/stdio.c b/src/libc/stdio.c index e606888..080da3d 100644 --- a/src/libc/stdio.c +++ b/src/libc/stdio.c @@ -10,15 +10,6 @@ extern uint32_t VGA_WIDTH; extern uint32_t VGA_HEIGHT; unsigned int VGA_X = 0, VGA_Y = 0; -enum Colors -{ - // AARRGGBB? - white = 0xFFFFFFFF, - black = 0x00000000, - red = 0x00FF0000, - green = 0x0000FF00, - blue = 0x000000FF, -}; void move_cursor(int x, int y) { @@ -115,7 +106,7 @@ void putc(char c) move_cursor(VGA_X, VGA_Y); } -void colorputc(char c, unsigned int color) +void colorputc(char c, uint32_t fg, uint32_t bg) { switch(c) { @@ -130,8 +121,7 @@ void colorputc(char c, unsigned int color) VGA_X += 4; break; default: - putchar(c, VGA_X, VGA_Y, white, black); - //putcolor(VGA_X, VGA_Y, color); + putchar(c, VGA_X, VGA_Y, fg, bg); VGA_X++; break; } @@ -154,11 +144,11 @@ void puts(const char* str) } } -void colorputs(const char* str, unsigned int color) +void colorputs(const char* str, uint32_t fg, uint32_t bg) { while (*str) { - colorputc(*str, color); + colorputc(*str, fg, bg); str++; } } diff --git a/src/libc/stdio.h b/src/libc/stdio.h index 0c6e457..b8ac4be 100644 --- a/src/libc/stdio.h +++ b/src/libc/stdio.h @@ -14,14 +14,14 @@ void move_cursor(int x, int y); void putchar(unsigned short int c, int x, int y, uint32_t fg, uint32_t bg); void puts(const char* str); -void colorputs(const char* str, unsigned int color); void clear(void); +void colorputs(const char* str, uint32_t fg, uint32_t bg); void putcolor(int x, int y, unsigned int color); char getchar(int x, int y); unsigned int getcolor(int x, int y); void scroll(int lines); void putc(char c); -void colorputc(char c, unsigned int color); +void colorputc(char c, uint32_t fg, uint32_t bg); #define PRINTF_STATE_START 0 #define PRINTF_STATE_LENGTH 1 @@ -43,4 +43,14 @@ void get_input(char *buffer, int size); void dtostrf(double val, char *buffer, int precision); +enum Colors +{ + // AARRGGBB? + white = 0xFFFFFFFF, + black = 0x00000000, + red = 0x00FF0000, + green = 0x0000FF00, + blue = 0x000000FF, +}; + #endif diff --git a/src/programs/conway.c b/src/programs/conway.c index 703512d..93de491 100644 --- a/src/programs/conway.c +++ b/src/programs/conway.c @@ -15,7 +15,7 @@ void print_grid(const unsigned char grid[X][Y]) //(grid[i][j] == LIVE) ? putc(42) : putc(32); if (grid[i][j] == LIVE) { serial_printf(3, "alive"); - colorputc(32, 120); + //colorputc(32, 120); } else { putc(32); } diff --git a/src/programs/misc.c b/src/programs/misc.c index 25d9743..93fd47f 100644 --- a/src/programs/misc.c +++ b/src/programs/misc.c @@ -18,7 +18,7 @@ void program_rainbow() for (int i=0; i