struct vt_switch {
uint8_t vtmode;
+ uint8_t vtattr;
+#define VTA_INVERSE 1
+#define VTA_UNDERLINE 2
+#define VTA_ITALIC 4
+#define VTA_FLASH 8
+#define VTA_BOLD 16
+#define VTA_OVERSTRIKE 32
+ /* 64 is set to ensure a valid normal character */
+#define VTA_NOCURSOR 128
signed char cursorx;
signed char cursory;
signed char ncursory;
void do_beep(void);
int vt_ioctl(uint8_t minor, uarg_t op, char *ptr);
int vt_inproc(uint8_t minor, unsigned char c);
+extern uint8_t vtattr_cap;
-#endif
\ No newline at end of file
+#endif
* This code can be banked on its own. If you touch it on Z80 make
* very sure you inspect the asm output for calls to compiler helpers
* and don't add any.
- *
+ *
+ * Possible VT extensions to look at
+ * - Esc-L Insert blank line, move lines below down
+ * - ESC-M Delete cursor line, move up blank bottom
+ * - Colour setting (Atari ST uses esc b/c) but we need
+ * more flexibility and border
+ * - ESC-d erase start to cursor inclusive
+ * - ESC-j save cursor y/x
+ * - ESC-k restore cursor
+ * - ESC-l erase line, cursor to left
+ * - ESC-o erase from start of line to cursor (inclusive)
+ *
+ * Would tty be a better graphics interface than direct ? Probably not ?
*/
static uint8_t vtmode;
+uint8_t vtattr;
static signed char cursorx;
static signed char cursory = VT_INITIAL_LINE;
static signed char ncursory;
}
if (c == 'Y')
return 2;
-
+ if (c == 'a')
+ return 4;
return 0;
}
ncursory = c - ' ';
vtmode++;
continue;
- } else {
+ } else if (vtmode == 3) {
int ncursorx = c - ' ';
if (ncursory >= 0 && ncursorx <= VT_BOTTOM)
cursory = ncursory;
if (ncursorx >= 0 && ncursorx <= VT_RIGHT)
cursorx = ncursorx;
vtmode = 0;
+ } else {
+ vtattr = c;
+ vtmode = 0;
+ continue;
}
}
cursor_on(cursory, cursorx);
#endif
case VTSIZE:
return VT_HEIGHT << 8 | VT_WIDTH;
+ case VTATTRS:
+ return vtattr_cap;
}
}
return tty_ioctl(minor, request, data);
void vt_save(struct vt_switch *vt)
{
vt->vtmode = vtmode;
+ vt->vtattr = vtattr;
vt->cursorx = cursorx;
vt->cursory = cursory;
vt->ncursory = ncursory;
void vt_load(struct vt_switch *vt)
{
vtmode = vt->vtmode;
+ vtattr = vt->vtattr;
cursorx = vt->cursorx;
cursory = vt->cursory;
ncursory = vt->ncursory;