From: Alan Cox Date: Thu, 27 Nov 2014 01:01:50 +0000 (+0000) Subject: vt: minor fixes and a temporary hack X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=eccc5b978a7905d0cf6f06dea542a454a8f71dc7;p=FUZIX.git vt: minor fixes and a temporary hack 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) --- diff --git a/Kernel/include/vt.h b/Kernel/include/vt.h index 52e4cdb0..6aecef73 100644 --- a/Kernel/include/vt.h +++ b/Kernel/include/vt.h @@ -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); diff --git a/Kernel/vt.c b/Kernel/vt.c index be17c30e..77cf3cb1 100644 --- a/Kernel/vt.c +++ b/Kernel/vt.c @@ -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)