6 static void clearscr(void);
7 static void scroll(void);
9 int cursor_x, cursor_y, cursor_vis, cursor_blink;
10 unsigned char scrbuf[TERM_COLS * TERM_ROWS];
19 void term_cleanup(void)
23 static void clearscr(void)
25 memset(scrbuf, ' ', sizeof scrbuf);
26 cursor_x = cursor_y = 0;
29 static void scroll(void)
31 memmove(scrbuf, scrbuf + TERM_COLS, (TERM_ROWS - 1) * TERM_COLS);
32 memset(scrbuf + (TERM_ROWS - 1) * TERM_COLS, ' ', TERM_COLS);
35 static int proc_char(int c)
37 static int cbuf[8], clen;
43 printf(" %xh", (unsigned int)c);
58 if(c < ' ' || c > '7') {
64 if(c < ' ' || c > 'o') {
69 cursor_y = cbuf[2] - ' ';
94 if(cursor_y >= TERM_ROWS - 1) {
96 cursor_y = TERM_ROWS - 1;
111 if(cursor_x < TERM_COLS - 1) {
121 case 0xe: /* SO TODO */
123 case 0xf: /* SI TODO */
135 cursor_x = cursor_y = 0;
139 scrbuf[cursor_y * TERM_COLS + cursor_x] = c;
140 if(++cursor_x >= TERM_COLS) {
149 int term_proc(char *buf, int sz)
154 redisp |= proc_char(*buf++);