Index: kernel/genarch/src/drivers/ega/ega.c
===================================================================
--- kernel/genarch/src/drivers/ega/ega.c	(revision c214a65a97b06d5514ff5e480d6619d4663a82d8)
+++ kernel/genarch/src/drivers/ega/ega.c	(revision 561db3f87662526e5b14ca49efc6c1229d0a8a2b)
@@ -61,4 +61,6 @@
 static ioport8_t *ega_base;
 
+#define EMPTY_CHAR  0x0720
+
 chardev_t ega_console;
 
@@ -70,11 +72,11 @@
 	if (ega_cursor < EGA_SCREEN)
 		return;
-
+	
 	memmove((void *) videoram, (void *) (videoram + EGA_COLS * 2),
 	    (EGA_SCREEN - EGA_COLS) * 2);
 	memmove((void *) backbuf, (void *) (backbuf + EGA_COLS * 2),
 	    (EGA_SCREEN - EGA_COLS) * 2);
-	memsetw(videoram + (EGA_SCREEN - EGA_COLS) * 2, EGA_COLS, 0x0720);
-	memsetw(backbuf + (EGA_SCREEN - EGA_COLS) * 2, EGA_COLS, 0x0720);
+	memsetw(videoram + (EGA_SCREEN - EGA_COLS) * 2, EGA_COLS, EMPTY_CHAR);
+	memsetw(backbuf + (EGA_SCREEN - EGA_COLS) * 2, EGA_COLS, EMPTY_CHAR);
 	ega_cursor = ega_cursor - EGA_COLS;
 }
@@ -104,6 +106,13 @@
 	
 	ega_cursor = (hi << 8) | lo;
+	
+	if (ega_cursor >= EGA_SCREEN)
+		ega_cursor = 0;
+	
 	if ((ega_cursor % EGA_COLS) != 0)
 		ega_cursor = (ega_cursor + EGA_COLS) - ega_cursor % EGA_COLS;
+	
+	memsetw(videoram + ega_cursor * 2, EGA_SCREEN - ega_cursor, EMPTY_CHAR);
+	memsetw(backbuf + ega_cursor * 2, EGA_SCREEN - ega_cursor, EMPTY_CHAR);
 	
 	ega_check_cursor();
@@ -120,5 +129,5 @@
 }
 
-static void ega_putchar(chardev_t *d __attribute__((unused)), const char ch, bool silent)
+static void ega_putchar(chardev_t *dev __attribute__((unused)), const char ch, bool silent)
 {
 	ipl_t ipl;
