From: Alan Cox Date: Sun, 14 Dec 2014 18:24:43 +0000 (+0000) Subject: vt: Add support for switching vt state X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=46b2540bf1bfc0bcbe51047a65fa09068b5eb6e6;p=FUZIX.git vt: Add support for switching vt state We need this for the MTX512 but it will also be useful later for MSX, as the MSX also has a load of VDP RAM that we can use to support multiple text consoles just like Xenix and later Linux did on a PC. --- diff --git a/Kernel/include/vt.h b/Kernel/include/vt.h index 6aecef73..709bed0e 100644 --- a/Kernel/include/vt.h +++ b/Kernel/include/vt.h @@ -11,9 +11,19 @@ #define VT_INITIAL_LINE 0 #endif +struct vt_switch { + uint8_t vtmode; + signed char cursorx; + signed char cursory; + signed char ncursory; +}; + /* Core functions */ void vtoutput(unsigned char *p, unsigned int len); void vtinit(void); +/* Mode switcher functions */ +void vt_save(struct vt_switch *vt); +void vt_load(struct vt_switch *vt); /* Platform functions */ void clear_lines(int8_t y, int8_t ct); void clear_across(int8_t y, int8_t x, int16_t l); diff --git a/Kernel/vt.c b/Kernel/vt.c index 81ffb65d..901e413a 100644 --- a/Kernel/vt.c +++ b/Kernel/vt.c @@ -1,5 +1,6 @@ #include #include +#include #ifdef CONFIG_VT /* @@ -38,10 +39,10 @@ */ -static int vtmode; +static uint8_t vtmode; static signed char cursorx; static signed char cursory = VT_INITIAL_LINE; -static int ncursory; +static signed char ncursory; static void cursor_fix(void) { @@ -188,6 +189,26 @@ void vtinit(void) cursor_on(0, 0); } +#ifdef CONFIG_VT_MULTI + +void vt_save(struct vt_switch *vt) +{ + cursor_off(); + vt->vtmode = vtmode; + vt->cursorx = cursorx; + vt->cursory = cursory; + vt->ncursory = ncursory; +} + +void vt_load(struct vt_switch *vt) +{ + vtmode = vt->vtmode; + cursorx = vt->cursorx; + cursory = vt->cursory; + ncursory = vt->ncursory; + cursor_on(cursory, cursorx); +} +#endif #ifdef CONFIG_VT_SIMPLE