aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--drivers/gfx-as.S11
-rw-r--r--drivers/gfx.c12
-rw-r--r--drivers/include/gfx.h2
4 files changed, 22 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 00c3bcf..60370ce 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@ ISODIR = isodir
all: kappa.bin
-test: iso
+test: kappa.iso
@echo "EMULATOR kappa.iso"
@$(QEMU) kappa.iso
diff --git a/drivers/gfx-as.S b/drivers/gfx-as.S
index 81744d5..9daf53a 100644
--- a/drivers/gfx-as.S
+++ b/drivers/gfx-as.S
@@ -2,6 +2,7 @@
.extern fb_height
.extern fb_stride
.extern fb_bpp
+ .extern _gfx_fgcol
.extern _gfx_bgcol
.extern framebuffer
@@ -85,3 +86,13 @@ gfx_vline:
popl %ebx
popl %esi
ret
+
+ .global gfx_drawpixel_32bpp
+gfx_drawpixel_32bpp:
+ movzwl fb_stride, %eax
+ movl framebuffer, %edx
+ imull 8(%esp), %eax
+ movl _gfx_fgcol, %ecx
+ addl 4(%esp), %eax
+ movl %ecx, (%edx,%eax,4)
+ ret
diff --git a/drivers/gfx.c b/drivers/gfx.c
index c27d61a..b781adc 100644
--- a/drivers/gfx.c
+++ b/drivers/gfx.c
@@ -25,6 +25,7 @@ static int cursor_x, cursor_y;
uint32_t _gfx_fgcol, _gfx_bgcol;
void (*gfx_clear)(void);
+void (*gfx_drawpixel)(int x, int y);
void gfx_set_background(uint32_t col)
{
@@ -46,11 +47,11 @@ uint32_t gfx_get_foreground(void)
return _gfx_fgcol;
}
-void gfx_drawpixel(int x, int y)
+/* assembly */
+void gfx_drawpixel_test(int x, int y)
{
- ((uint32_t*)framebuffer)[y * fb_width + x] = _gfx_fgcol;
+ ((uint32_t*)framebuffer)[y * fb_stride + x] = _gfx_fgcol;
}
-
/* implemented in assembly now */
/*
void gfx_clear(uint32_t col)
@@ -281,6 +282,11 @@ bool gfx_init(struct vbe_info_t *vbe_mode_info)
printf("WARNING: BPP != 32, falling back to text mode...\n");
return false;
}
+ else
+ {
+ extern void gfx_drawpixel_32bpp(int, int);
+ gfx_drawpixel = &gfx_drawpixel_32bpp;
+ }
set_putchar(gfx_putchar);
set_puts(gfx_puts);
diff --git a/drivers/include/gfx.h b/drivers/include/gfx.h
index 81be70d..6f0f171 100644
--- a/drivers/include/gfx.h
+++ b/drivers/include/gfx.h
@@ -34,7 +34,7 @@ struct vbe_info_t;
bool gfx_init(struct vbe_info_t *vbe_mode_info);
-void gfx_drawpixel(int x, int y);
+extern void (*gfx_drawpixel)(int x, int y);
/* transparent background */
void gfx_drawchar(int x, int y, int ch);