diff --git a/src/drivers/framebuffer.c b/src/drivers/framebuffer.c index 922573e..528b0dd 100644 --- a/src/drivers/framebuffer.c +++ b/src/drivers/framebuffer.c @@ -91,3 +91,4 @@ void scroll() } } } + diff --git a/src/drivers/timer.c b/src/drivers/timer.c index 29520c0..8c8c419 100644 --- a/src/drivers/timer.c +++ b/src/drivers/timer.c @@ -6,6 +6,12 @@ volatile unsigned long global_ticks = 0; void timer_handler() { global_ticks++; + if (global_ticks % 20 == 0) + { + draw_cursor(white); + } else if (global_ticks % 20 == 10) { + erase_cursor(); + } } void timer_install() diff --git a/src/kernel/kmain.c b/src/kernel/kmain.c index 5aba0fb..bc3dde1 100644 --- a/src/kernel/kmain.c +++ b/src/kernel/kmain.c @@ -61,15 +61,14 @@ uint8_t *tags = mb_info->tags; tags += ((tag_size + 7) & ~7); } - serial_printf(3, "Framebuffer Address: 0x%x\r\n", fb_info->framebuffer_addr); -serial_printf(3, "Framebuffer Width: %u\r\n", fb_info->framebuffer_width); -serial_printf(3, "Framebuffer Height: %u\r\n", fb_info->framebuffer_height); -serial_printf(3, "Framebuffer Pitch: %u\r\n", fb_info->framebuffer_pitch); -serial_printf(3, "Framebuffer BPP: %u\r\n", fb_info->framebuffer_bpp); + serial_printf(3, "Framebuffer Address: 0x%x\r", fb_info->framebuffer_addr); + serial_printf(3, "Framebuffer Width: %u\r\n", fb_info->framebuffer_width); + serial_printf(3, "Framebuffer Height: %u\r\n", fb_info->framebuffer_height); + serial_printf(3, "Framebuffer Pitch: %u\r\n", fb_info->framebuffer_pitch); + serial_printf(3, "Framebuffer BPP: %u\r\n", fb_info->framebuffer_bpp); if (fb_info) { - log("Entered fb_info\r\n", 3); framebuffer = (uint32_t *)(uintptr_t) fb_info->framebuffer_addr; uint32_t width = fb_info->framebuffer_width; @@ -77,6 +76,7 @@ serial_printf(3, "Framebuffer BPP: %u\r\n", fb_info->framebuffer_bpp); uint32_t pitch = fb_info->framebuffer_pitch; uint32_t bpp = fb_info->framebuffer_bpp; + //8x16 font, not padded VGA_WIDTH = width/8; VGA_HEIGHT = height/16; @@ -92,41 +92,14 @@ serial_printf(3, "Framebuffer BPP: %u\r\n", fb_info->framebuffer_bpp); draw_char(0+i, 0+i, y_offset, white, black); } */ - - /* TEST print red square - for (uint32_t y = 0; y < 10; y++) { - for (uint32_t x = 0; x < 10; x++) { - putpixel(framebuffer, (int)pitch, (int)bpp, x, y, red); - //framebuffer[y * (pitch / 4) + x] = 0xFF0000; // Rouge - } - } - */ - - 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); - } - */ - - for (int i=0; i<100; i++) - { - printf("%d\n", i); } - //colorputs("Wow, such colorful output!", green, blue); + + printf("[kernel] framebuffer discovered at 0x%x\n", fb_info->framebuffer_addr); + printf("[kernel] fb0: width=%u, height=%u, pitch=%u, bpp=%u\n", fb_info->framebuffer_width, fb_info->framebuffer_height, fb_info->framebuffer_pitch, fb_info->framebuffer_bpp); colorputs(ascii_title, green, black); - while (1); - - - /* init_serial(); log("serial connection established\n", 3); gdt_install(); @@ -139,17 +112,16 @@ serial_printf(3, "Framebuffer BPP: %u\r\n", fb_info->framebuffer_bpp); __asm__ __volatile__("sti"); log("initialized IRQs\n", 2), - clear(); - colorputs(ascii_title, 10); - colorputs(" by @xamidev - star the repo for a cookie!\n\n", 14); + //clear(); + //colorputs(ascii_title, 10); + //colorputs(" by @xamidev - star the repo for a cookie!\n\n", ); - init_paging(); - printf("Hello, paging world!\n"); + //init_paging(); //test_read_sector(); - uint32_t *ptr = (uint32_t*)0xA0000000; - uint32_t do_page_fault = *ptr; + //uint32_t *ptr = (uint32_t*)0xA0000000; + //uint32_t do_page_fault = *ptr; timer_install(); serial_printf(2, "%d\tinitialized timer handler", global_ticks); @@ -157,5 +129,5 @@ serial_printf(3, "Framebuffer BPP: %u\r\n", fb_info->framebuffer_bpp); serial_printf(2, "%d\tinitialized keyboard handler", global_ticks); shell_install(); serial_printf(2, "%d\tstarted system shell", global_ticks); - */ + } diff --git a/src/libc/stdio.c b/src/libc/stdio.c index 932af77..3ea1076 100644 --- a/src/libc/stdio.c +++ b/src/libc/stdio.c @@ -11,11 +11,32 @@ extern uint32_t VGA_WIDTH; extern uint32_t VGA_HEIGHT; unsigned int VGA_X = 0, VGA_Y = 0; +#define CURSOR_WIDTH 8 +#define CURSOR_HEIGHT 16 +extern int scanline; + +void draw_cursor(uint32_t color) +{ + for (int y=12; y