vt: minor fixes and a temporary hack
authorAlan Cox <alan@etchedpixels.co.uk>
Thu, 27 Nov 2014 01:01:50 +0000 (01:01 +0000)
committerAlan Cox <alan@etchedpixels.co.uk>
Thu, 27 Nov 2014 01:01:50 +0000 (01:01 +0000)
We have overlapped input/output so should use memmove - just we don't yet
have a memmove in all our support code - botch it for now

Add support to start on a different line (eg below boot rom info)

Allow a mapping function for simple mode (eg for Petscii and for 6809
boxes with the 6847)

Kernel/include/vt.h
Kernel/vt.c

index 52e4cdb..6aecef7 100644 (file)
@@ -1,6 +1,16 @@
 #ifndef __VT_DOT_H__
 #define __VT_DOT_H__
 
+/* Optional defines */
+
+#ifndef VT_MAP_CHAR
+#define VT_MAP_CHAR(x)         (x)
+#endif
+
+#ifndef VT_INITIAL_LINE
+#define VT_INITIAL_LINE 0
+#endif
+
 /* Core functions */
 void vtoutput(unsigned char *p, unsigned int len);
 void vtinit(void);
index be17c30..77cf3cb 100644 (file)
@@ -40,7 +40,7 @@
 
 static int vtmode;
 static signed char cursorx;
-static signed char cursory;
+static signed char cursory = VT_INITIAL_LINE;
 static int ncursory;
 
 static void cursor_fix(void)
@@ -191,6 +191,7 @@ void vtinit(void)
 
 #ifdef CONFIG_VT_SIMPLE
 
+
 static unsigned char *cpos;
 static unsigned char csave;
 
@@ -208,12 +209,12 @@ void cursor_on(int8_t y, int8_t x)
 {
        cpos = char_addr(y, x);
        csave = *cpos;
-       *cpos = '_';
+       *cpos = VT_MAP_CHAR('_');
 }
 
 void plot_char(int8_t y, int8_t x, uint16_t c)
 {
-       *char_addr(y, x) = c;
+       *char_addr(y, x) = VT_MAP_CHAR(c);
 }
 
 void clear_lines(int8_t y, int8_t ct)
@@ -228,9 +229,17 @@ void clear_across(int8_t y, int8_t x, int16_t l)
        memset(s, ' ', l);
 }
 
+/* FIXME: these should use memmove */
+
 void scroll_up(void)
 {
-       memcpy(VT_BASE, VT_BASE + VT_WIDTH, VT_WIDTH * VT_BOTTOM);
+       unsigned char *p = VT_BASE;
+       int n = VT_WIDTH * VT_BOTTOM;
+       while (n--) {
+               *p = p[VT_WIDTH];
+               p++;
+       }
+//     memcpy(VT_BASE, VT_BASE + VT_WIDTH, VT_WIDTH * VT_BOTTOM);
 }
 
 void scroll_down(void)