Move VGA cursor when writing to screen

This commit is contained in:
thomas committed 2018-03-20 14:11:21 +01:00
1 parent 055c41adb3
commit b50b32afa9
2 files changed
+13

No files matched your search

+10
View File
@@ -1,5 +1,6 @@
#include <vga.h> #include <vga.h>
#include <memory.h> #include <memory.h>
#include <ports.h>
void *vidmem; void *vidmem;
struct vga_cell{ struct vga_cell{
@@ -20,6 +21,14 @@ void vga_init()
format = 0x7; format = 0x7;
} }
void movecursor()
{
outb(0x3D4, 0x0F);
outb(0x3D5, (uint8_t)(cursor & 0xFF));
outb(0x3D4, 0x0E);
outb(0x3D5, (uint8_t)((cursor >> 8) & 0xFF));
}
void flush() void flush()
{ {
memcpy(vidmem, buffer, sizeof(buffer)); memcpy(vidmem, buffer, sizeof(buffer));
@@ -53,4 +62,5 @@ void vga_write(char c)
} }
scroll(); scroll();
flush(); flush();
movecursor();
} }
+3
View File
@@ -1,6 +1,9 @@
// vim: ft=c // vim: ft=c
#include <ttest.h> #include <ttest.h>
#include <ports.h>
#undef outb
#define outb(...)
#include <vga.h> #include <vga.h>
#undef VGA_MEMORY #undef VGA_MEMORY
#define VGA_MEMORY calloc(80*24,3) #define VGA_MEMORY calloc(80*24,3)