summaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2024-05-27 13:58:00 -0500
committerDanny Holman <dholman@gymli.org>2024-05-27 13:58:00 -0500
commit61760f9301427ea56a62ec02af3d0d8ae4745be7 (patch)
treec63057d16075b2b411eab36424f1d481b4a8c9f1 /drivers/video
parentlibk: create a subset libc for kernel use (diff)
downloadbox-61760f9301427ea56a62ec02af3d0d8ae4745be7.tar.gz
box-61760f9301427ea56a62ec02af3d0d8ae4745be7.tar.zst
box-61760f9301427ea56a62ec02af3d0d8ae4745be7.zip
drivers: create a subdir just for driver code
Create a subdirectory branching from the project root. This directory will contain nothing but driver and device code. Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to '')
-rw-r--r--drivers/video/framebuffer.c (renamed from arch/i386/kernel/framebuffer.c)20
1 files changed, 12 insertions, 8 deletions
diff --git a/arch/i386/kernel/framebuffer.c b/drivers/video/framebuffer.c
index 602bddb..3df3df4 100644
--- a/arch/i386/kernel/framebuffer.c
+++ b/drivers/video/framebuffer.c
@@ -1,14 +1,13 @@
-#include <kernel/vga.h>
+#include <kernel/video/framebuffer.h>
+#include <kernel/video/vga.h>
+#include <kernel/asm.h>
+#include <kernel/kthread.h>
#include <kernel/paging.h>
#include <kernel/pic.h>
-#include <kernel/string.h>
+#include <libk/string.h>
#include <stddef.h>
#include <stdint.h>
-static const size_t VGA_WIDTH = 80;
-static const size_t VGA_HEIGHT = 25;
-static uint16_t *const VGA_MEMORY = (uint16_t*)0xC03FF000;
-
static size_t fb_row;
static size_t fb_column;
static uint8_t fb_color;
@@ -44,8 +43,6 @@ void _fb_scroll(void) {
}
void fb_init(void) {
- map_page(NULL, 0xB8000, (uintptr_t)VGA_MEMORY, 0x003);
-
fb_row = 0;
fb_column = 0;
fb_color = vga_entry_color(VGA_COLOR_LIGHT_GREY, VGA_COLOR_BLACK);
@@ -65,6 +62,13 @@ void fb_setcolor(uint8_t color) {
void fb_setpos(int x, int y) {
fb_row = y;
fb_column = x;
+ _update_cursor(fb_column, fb_row+1);
+}
+
+void fb_offsetpos(int dx, int dy) {
+ fb_row += dy;
+ fb_column += dx;
+ _update_cursor(fb_column, fb_row+1);
}
void fb_putchar(char c) {