3 void redraw(struct terminal *term)
8 for (byte i = 0; i < COLS * ROWS; i++) {
10 lcd.setCursor(i % COLS, i / COLS);
11 lcd.write(term->contents[i]);
16 void scroll_up(struct terminal *term)
18 for (byte i = 0; i < COLS * (ROWS - 1); i++)
19 term->contents[i] = term->contents[i + COLS];
20 for (byte i = COLS * (ROWS - 1); i < COLS * ROWS; i++)
21 term->contents[i] = ' ';
26 * Special character meanings are defined here.
28 void write(struct terminal *term, char ch)
33 lcd.setCursor(term->x, term->y);
36 if (++term->y >= ROWS) {
40 lcd.setCursor(term->x, term->y);
45 term->contents[term->x + term->y * COLS] = 0x00;
46 lcd.setCursor(term->x, term->y);
48 lcd.setCursor(term->x, term->y);
52 term->contents[term->x + term->y * COLS] = ch;
54 if (++term->x >= COLS) {
56 if (++term->y >= ROWS) {
60 lcd.setCursor(term->x, term->y);