Move VGA cursor when writing to screen

This commit is contained in:
Thomas Lovén 2017-12-04 12:25:04 +01:00
parent 055c41adb3
commit b50b32afa9
2 changed files with 13 additions and 0 deletions

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();
} }

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)