1 11a5e2cf 2024-01-16 benni /* $NetBSD: screen.c,v 1.34 2021/05/02 12:50:46 rillig Exp $ */
4 11a5e2cf 2024-01-16 benni * Copyright (c) 1992, 1993
5 11a5e2cf 2024-01-16 benni * The Regents of the University of California. All rights reserved.
7 11a5e2cf 2024-01-16 benni * This code is derived from software contributed to Berkeley by
8 11a5e2cf 2024-01-16 benni * Chris Torek and Darren F. Provine.
10 11a5e2cf 2024-01-16 benni * Redistribution and use in source and binary forms, with or without
11 11a5e2cf 2024-01-16 benni * modification, are permitted provided that the following conditions
13 11a5e2cf 2024-01-16 benni * 1. Redistributions of source code must retain the above copyright
14 11a5e2cf 2024-01-16 benni * notice, this list of conditions and the following disclaimer.
15 11a5e2cf 2024-01-16 benni * 2. Redistributions in binary form must reproduce the above copyright
16 11a5e2cf 2024-01-16 benni * notice, this list of conditions and the following disclaimer in the
17 11a5e2cf 2024-01-16 benni * documentation and/or other materials provided with the distribution.
18 11a5e2cf 2024-01-16 benni * 3. Neither the name of the University nor the names of its contributors
19 11a5e2cf 2024-01-16 benni * may be used to endorse or promote products derived from this software
20 11a5e2cf 2024-01-16 benni * without specific prior written permission.
22 11a5e2cf 2024-01-16 benni * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 11a5e2cf 2024-01-16 benni * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 11a5e2cf 2024-01-16 benni * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 11a5e2cf 2024-01-16 benni * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 11a5e2cf 2024-01-16 benni * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 11a5e2cf 2024-01-16 benni * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 11a5e2cf 2024-01-16 benni * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 11a5e2cf 2024-01-16 benni * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 11a5e2cf 2024-01-16 benni * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 11a5e2cf 2024-01-16 benni * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 11a5e2cf 2024-01-16 benni * SUCH DAMAGE.
34 11a5e2cf 2024-01-16 benni * @(#)screen.c 8.1 (Berkeley) 5/31/93
38 11a5e2cf 2024-01-16 benni * Tetris screen control.
41 11a5e2cf 2024-01-16 benni #include <sys/cdefs.h>
42 11a5e2cf 2024-01-16 benni #include <sys/ioctl.h>
44 11a5e2cf 2024-01-16 benni #include <setjmp.h>
45 11a5e2cf 2024-01-16 benni #include <signal.h>
46 11a5e2cf 2024-01-16 benni #include <stdio.h>
47 11a5e2cf 2024-01-16 benni #include <stdlib.h>
48 11a5e2cf 2024-01-16 benni #include <string.h>
49 11a5e2cf 2024-01-16 benni #include <term.h>
50 11a5e2cf 2024-01-16 benni #include <termios.h>
51 11a5e2cf 2024-01-16 benni #include <unistd.h>
53 11a5e2cf 2024-01-16 benni #ifndef sigmask
54 11a5e2cf 2024-01-16 benni #define sigmask(s) (1 << ((s) - 1))
57 b600ed35 2024-07-25 benni #if defined(__linux__) && !defined(XTABS)
58 b600ed35 2024-07-25 benni # define OXTABS 0x01800
61 11a5e2cf 2024-01-16 benni #include "screen.h"
62 11a5e2cf 2024-01-16 benni #include "tetris.h"
64 11a5e2cf 2024-01-16 benni static cell curscreen[B_SIZE]; /* 1 => standout (or otherwise marked) */
65 11a5e2cf 2024-01-16 benni static int curscore;
66 11a5e2cf 2024-01-16 benni static int isset; /* true => terminal is in game mode */
67 11a5e2cf 2024-01-16 benni static struct termios oldtt;
68 11a5e2cf 2024-01-16 benni static void (*tstp)(int);
70 11a5e2cf 2024-01-16 benni static void scr_stop(int);
71 11a5e2cf 2024-01-16 benni static void stopset(int) __dead;
73 60af9557 2024-01-16 benni extern int ospeed;
77 11a5e2cf 2024-01-16 benni * Routine used by tputs().
83 11a5e2cf 2024-01-16 benni return (putchar(c));
87 11a5e2cf 2024-01-16 benni * putstr() is for unpadded strings (either as in termcap(5) or
88 11a5e2cf 2024-01-16 benni * simply literal strings); putpad() is for padded strings with
89 11a5e2cf 2024-01-16 benni * count=1. (See screen.h for putpad().)
91 11a5e2cf 2024-01-16 benni #define putstr(s) (void)fputs(s, stdout)
93 11a5e2cf 2024-01-16 benni static void
94 11a5e2cf 2024-01-16 benni moveto(int r, int c)
98 11a5e2cf 2024-01-16 benni buf = tiparm(cursor_address, r, c);
99 11a5e2cf 2024-01-16 benni if (buf != NULL)
100 11a5e2cf 2024-01-16 benni putpad(buf);
103 11a5e2cf 2024-01-16 benni static void
104 11a5e2cf 2024-01-16 benni setcolor(int c)
106 11a5e2cf 2024-01-16 benni char *buf;
107 11a5e2cf 2024-01-16 benni char monochrome[] = "\033[0m";
108 11a5e2cf 2024-01-16 benni if (nocolor == 1)
110 11a5e2cf 2024-01-16 benni if (set_a_foreground == NULL)
113 11a5e2cf 2024-01-16 benni if (c == 0 || c == 7)
114 11a5e2cf 2024-01-16 benni buf = monochrome;
116 11a5e2cf 2024-01-16 benni buf = tiparm(set_a_foreground, c);
117 11a5e2cf 2024-01-16 benni if (buf != NULL)
118 11a5e2cf 2024-01-16 benni putpad(buf);
122 11a5e2cf 2024-01-16 benni * Set up from termcap.
125 11a5e2cf 2024-01-16 benni scr_init(void)
128 11a5e2cf 2024-01-16 benni setupterm(NULL, 0, NULL);
129 11a5e2cf 2024-01-16 benni if (clear_screen == NULL)
130 11a5e2cf 2024-01-16 benni stop("cannot clear screen");
131 11a5e2cf 2024-01-16 benni if (cursor_address == NULL || cursor_up == NULL)
132 11a5e2cf 2024-01-16 benni stop("cannot do random cursor positioning");
135 11a5e2cf 2024-01-16 benni /* this foolery is needed to modify tty state `atomically' */
136 11a5e2cf 2024-01-16 benni static jmp_buf scr_onstop;
138 11a5e2cf 2024-01-16 benni static void
139 11a5e2cf 2024-01-16 benni stopset(int sig)
141 11a5e2cf 2024-01-16 benni sigset_t set;
143 11a5e2cf 2024-01-16 benni (void) signal(sig, SIG_DFL);
144 11a5e2cf 2024-01-16 benni (void) kill(getpid(), sig);
145 11a5e2cf 2024-01-16 benni sigemptyset(&set);
146 11a5e2cf 2024-01-16 benni sigaddset(&set, sig);
147 11a5e2cf 2024-01-16 benni (void) sigprocmask(SIG_UNBLOCK, &set, (sigset_t *)0);
148 11a5e2cf 2024-01-16 benni longjmp(scr_onstop, 1);
151 11a5e2cf 2024-01-16 benni static void
152 11a5e2cf 2024-01-16 benni scr_stop(int sig)
154 11a5e2cf 2024-01-16 benni sigset_t set;
156 11a5e2cf 2024-01-16 benni scr_end();
157 11a5e2cf 2024-01-16 benni (void) kill(getpid(), sig);
158 11a5e2cf 2024-01-16 benni sigemptyset(&set);
159 11a5e2cf 2024-01-16 benni sigaddset(&set, sig);
160 11a5e2cf 2024-01-16 benni (void) sigprocmask(SIG_UNBLOCK, &set, (sigset_t *)0);
161 11a5e2cf 2024-01-16 benni scr_set();
162 11a5e2cf 2024-01-16 benni scr_msg(key_msg, 1);
166 11a5e2cf 2024-01-16 benni * Set up screen mode.
169 11a5e2cf 2024-01-16 benni scr_set(void)
171 11a5e2cf 2024-01-16 benni struct winsize ws;
172 11a5e2cf 2024-01-16 benni struct termios newtt;
173 11a5e2cf 2024-01-16 benni sigset_t nsigset, osigset;
174 11a5e2cf 2024-01-16 benni void (*ttou)(int);
176 11a5e2cf 2024-01-16 benni sigemptyset(&nsigset);
177 11a5e2cf 2024-01-16 benni sigaddset(&nsigset, SIGTSTP);
178 11a5e2cf 2024-01-16 benni sigaddset(&nsigset, SIGTTOU);
179 11a5e2cf 2024-01-16 benni (void) sigprocmask(SIG_BLOCK, &nsigset, &osigset);
180 11a5e2cf 2024-01-16 benni if ((tstp = signal(SIGTSTP, stopset)) == SIG_IGN)
181 11a5e2cf 2024-01-16 benni (void) signal(SIGTSTP, SIG_IGN);
182 11a5e2cf 2024-01-16 benni if ((ttou = signal(SIGTTOU, stopset)) == SIG_IGN)
183 11a5e2cf 2024-01-16 benni (void) signal(SIGTTOU, SIG_IGN);
185 11a5e2cf 2024-01-16 benni * At last, we are ready to modify the tty state. If
186 11a5e2cf 2024-01-16 benni * we stop while at it, stopset() above will longjmp back
187 11a5e2cf 2024-01-16 benni * to the setjmp here and we will start over.
189 11a5e2cf 2024-01-16 benni (void) setjmp(scr_onstop);
190 11a5e2cf 2024-01-16 benni (void) sigprocmask(SIG_SETMASK, &osigset, (sigset_t *)0);
191 11a5e2cf 2024-01-16 benni Rows = 0, Cols = 0;
192 11a5e2cf 2024-01-16 benni if (ioctl(0, TIOCGWINSZ, &ws) == 0) {
193 11a5e2cf 2024-01-16 benni Rows = ws.ws_row;
194 11a5e2cf 2024-01-16 benni Cols = ws.ws_col;
196 11a5e2cf 2024-01-16 benni if (Rows == 0)
197 11a5e2cf 2024-01-16 benni Rows = lines;
198 11a5e2cf 2024-01-16 benni if (Cols == 0)
199 11a5e2cf 2024-01-16 benni Cols = columns;
200 11a5e2cf 2024-01-16 benni if (Rows < MINROWS || Cols < MINCOLS) {
201 11a5e2cf 2024-01-16 benni (void) fprintf(stderr,
202 11a5e2cf 2024-01-16 benni "the screen is too small: must be at least %dx%d, ",
203 11a5e2cf 2024-01-16 benni MINCOLS, MINROWS);
204 11a5e2cf 2024-01-16 benni stop(""); /* stop() supplies \n */
206 11a5e2cf 2024-01-16 benni Offset = (Rows - D_LAST + D_FIRST - 2) / 2;
207 11a5e2cf 2024-01-16 benni if (tcgetattr(0, &oldtt) < 0)
208 11a5e2cf 2024-01-16 benni stop("tcgetattr() fails");
209 11a5e2cf 2024-01-16 benni newtt = oldtt;
210 11a5e2cf 2024-01-16 benni newtt.c_lflag &= ~(ICANON|ECHO);
211 11a5e2cf 2024-01-16 benni newtt.c_oflag &= ~OXTABS;
212 11a5e2cf 2024-01-16 benni if (tcsetattr(0, TCSADRAIN, &newtt) < 0)
213 11a5e2cf 2024-01-16 benni stop("tcsetattr() fails");
214 11a5e2cf 2024-01-16 benni ospeed = cfgetospeed(&newtt);
215 11a5e2cf 2024-01-16 benni (void) sigprocmask(SIG_BLOCK, &nsigset, &osigset);
218 11a5e2cf 2024-01-16 benni * We made it. We are now in screen mode, modulo TIstr
219 11a5e2cf 2024-01-16 benni * (which we will fix immediately).
221 11a5e2cf 2024-01-16 benni const char *tstr;
222 11a5e2cf 2024-01-16 benni if ((tstr = enter_ca_mode) != NULL)
223 11a5e2cf 2024-01-16 benni putstr(tstr);
224 11a5e2cf 2024-01-16 benni if ((tstr = cursor_invisible) != NULL)
225 11a5e2cf 2024-01-16 benni putstr(tstr);
226 11a5e2cf 2024-01-16 benni if (tstp != SIG_IGN)
227 11a5e2cf 2024-01-16 benni (void) signal(SIGTSTP, scr_stop);
228 11a5e2cf 2024-01-16 benni if (ttou != SIG_IGN)
229 11a5e2cf 2024-01-16 benni (void) signal(SIGTTOU, ttou);
231 11a5e2cf 2024-01-16 benni isset = 1;
232 11a5e2cf 2024-01-16 benni (void) sigprocmask(SIG_SETMASK, &osigset, (sigset_t *)0);
233 11a5e2cf 2024-01-16 benni scr_clear();
237 11a5e2cf 2024-01-16 benni * End screen mode.
240 11a5e2cf 2024-01-16 benni scr_end(void)
242 11a5e2cf 2024-01-16 benni sigset_t nsigset, osigset;
244 11a5e2cf 2024-01-16 benni sigemptyset(&nsigset);
245 11a5e2cf 2024-01-16 benni sigaddset(&nsigset, SIGTSTP);
246 11a5e2cf 2024-01-16 benni sigaddset(&nsigset, SIGTTOU);
247 11a5e2cf 2024-01-16 benni (void) sigprocmask(SIG_BLOCK, &nsigset, &osigset);
248 11a5e2cf 2024-01-16 benni /* move cursor to last line */
249 11a5e2cf 2024-01-16 benni const char *tstr;
250 11a5e2cf 2024-01-16 benni if ((tstr = cursor_to_ll) != NULL)
251 11a5e2cf 2024-01-16 benni putstr(tstr);
253 11a5e2cf 2024-01-16 benni moveto(Rows - 1, 0);
254 11a5e2cf 2024-01-16 benni /* exit screen mode */
255 11a5e2cf 2024-01-16 benni if ((tstr = exit_ca_mode) != NULL)
256 11a5e2cf 2024-01-16 benni putstr(tstr);
257 11a5e2cf 2024-01-16 benni if ((tstr = cursor_normal) != NULL)
258 11a5e2cf 2024-01-16 benni putstr(tstr);
259 11a5e2cf 2024-01-16 benni (void) fflush(stdout);
260 11a5e2cf 2024-01-16 benni (void) tcsetattr(0, TCSADRAIN, &oldtt);
261 11a5e2cf 2024-01-16 benni isset = 0;
262 11a5e2cf 2024-01-16 benni /* restore signals */
263 11a5e2cf 2024-01-16 benni (void) signal(SIGTSTP, tstp);
264 11a5e2cf 2024-01-16 benni (void) sigprocmask(SIG_SETMASK, &osigset, (sigset_t *)0);
268 11a5e2cf 2024-01-16 benni stop(const char *why)
271 11a5e2cf 2024-01-16 benni if (isset)
272 11a5e2cf 2024-01-16 benni scr_end();
273 11a5e2cf 2024-01-16 benni (void) fprintf(stderr, "aborting: %s\n", why);
278 11a5e2cf 2024-01-16 benni * Clear the screen, forgetting the current contents in the process.
281 11a5e2cf 2024-01-16 benni scr_clear(void)
284 11a5e2cf 2024-01-16 benni putpad(clear_screen);
285 11a5e2cf 2024-01-16 benni curscore = -1;
286 11a5e2cf 2024-01-16 benni memset((char *)curscreen, 0, sizeof(curscreen));
289 11a5e2cf 2024-01-16 benni #if vax && !__GNUC__
290 11a5e2cf 2024-01-16 benni typedef int regcell; /* pcc is bad at `register char', etc */
292 11a5e2cf 2024-01-16 benni typedef cell regcell;
296 11a5e2cf 2024-01-16 benni * Update the screen.
299 11a5e2cf 2024-01-16 benni scr_update(void)
301 11a5e2cf 2024-01-16 benni cell *bp, *sp;
302 11a5e2cf 2024-01-16 benni regcell so, cur_so = 0;
303 11a5e2cf 2024-01-16 benni int i, ccol, j;
304 11a5e2cf 2024-01-16 benni sigset_t nsigset, osigset;
305 11a5e2cf 2024-01-16 benni static const struct shape *lastshape;
307 11a5e2cf 2024-01-16 benni sigemptyset(&nsigset);
308 11a5e2cf 2024-01-16 benni sigaddset(&nsigset, SIGTSTP);
309 11a5e2cf 2024-01-16 benni (void) sigprocmask(SIG_BLOCK, &nsigset, &osigset);
311 11a5e2cf 2024-01-16 benni /* always leave cursor after last displayed point */
312 11a5e2cf 2024-01-16 benni curscreen[D_LAST * B_COLS - 1] = -1;
314 11a5e2cf 2024-01-16 benni if (score != curscore) {
315 11a5e2cf 2024-01-16 benni if (cursor_home)
316 11a5e2cf 2024-01-16 benni putpad(cursor_home);
318 11a5e2cf 2024-01-16 benni moveto(0, 0);
319 11a5e2cf 2024-01-16 benni setcolor(0);
320 11a5e2cf 2024-01-16 benni (void) printf("Score: %d", score);
321 11a5e2cf 2024-01-16 benni curscore = score;
324 11a5e2cf 2024-01-16 benni /* draw preview of nextpattern */
325 11a5e2cf 2024-01-16 benni if (showpreview && (nextshape != lastshape)) {
326 11a5e2cf 2024-01-16 benni static int r=5, c=2;
327 11a5e2cf 2024-01-16 benni int tr, tc, t;
329 11a5e2cf 2024-01-16 benni lastshape = nextshape;
331 11a5e2cf 2024-01-16 benni /* clean */
332 11a5e2cf 2024-01-16 benni putpad(exit_standout_mode);
333 11a5e2cf 2024-01-16 benni moveto(r-1, c-1); putstr(" ");
334 11a5e2cf 2024-01-16 benni moveto(r, c-1); putstr(" ");
335 11a5e2cf 2024-01-16 benni moveto(r+1, c-1); putstr(" ");
336 11a5e2cf 2024-01-16 benni moveto(r+2, c-1); putstr(" ");
338 11a5e2cf 2024-01-16 benni moveto(r-3, c-2);
339 11a5e2cf 2024-01-16 benni putstr("Next shape:");
341 11a5e2cf 2024-01-16 benni /* draw */
342 11a5e2cf 2024-01-16 benni setcolor(nextshape->color);
343 11a5e2cf 2024-01-16 benni putpad(enter_standout_mode);
344 11a5e2cf 2024-01-16 benni moveto(r, 2*c);
345 11a5e2cf 2024-01-16 benni putstr(" ");
346 11a5e2cf 2024-01-16 benni for(i=0; i<3; i++) {
347 11a5e2cf 2024-01-16 benni t = c + r*B_COLS;
348 11a5e2cf 2024-01-16 benni t += nextshape->off[i];
350 11a5e2cf 2024-01-16 benni tr = t / B_COLS;
351 11a5e2cf 2024-01-16 benni tc = t % B_COLS;
353 11a5e2cf 2024-01-16 benni moveto(tr, 2*tc);
354 11a5e2cf 2024-01-16 benni putstr(" ");
356 11a5e2cf 2024-01-16 benni putpad(exit_standout_mode);
359 11a5e2cf 2024-01-16 benni bp = &board[D_FIRST * B_COLS];
360 11a5e2cf 2024-01-16 benni sp = &curscreen[D_FIRST * B_COLS];
361 11a5e2cf 2024-01-16 benni for (j = D_FIRST; j < D_LAST; j++) {
362 11a5e2cf 2024-01-16 benni ccol = -1;
363 11a5e2cf 2024-01-16 benni for (i = 0; i < B_COLS; bp++, sp++, i++) {
364 11a5e2cf 2024-01-16 benni if (*sp == (so = *bp))
367 11a5e2cf 2024-01-16 benni if (i != ccol) {
368 11a5e2cf 2024-01-16 benni if (cur_so && move_standout_mode) {
369 11a5e2cf 2024-01-16 benni putpad(exit_standout_mode);
370 11a5e2cf 2024-01-16 benni cur_so = 0;
372 11a5e2cf 2024-01-16 benni moveto(RTOD(j + Offset), CTOD(i));
374 11a5e2cf 2024-01-16 benni if (enter_standout_mode) {
375 11a5e2cf 2024-01-16 benni if (so != cur_so) {
376 11a5e2cf 2024-01-16 benni setcolor(so);
377 11a5e2cf 2024-01-16 benni putpad(so ?
378 11a5e2cf 2024-01-16 benni enter_standout_mode :
379 11a5e2cf 2024-01-16 benni exit_standout_mode);
380 11a5e2cf 2024-01-16 benni cur_so = so;
382 11a5e2cf 2024-01-16 benni #ifdef DEBUG
383 11a5e2cf 2024-01-16 benni char buf[3];
384 11a5e2cf 2024-01-16 benni snprintf(buf, sizeof(buf), "%d%d", so, so);
385 11a5e2cf 2024-01-16 benni putstr(buf);
387 11a5e2cf 2024-01-16 benni putstr(" ");
390 11a5e2cf 2024-01-16 benni putstr(so ? "XX" : " ");
391 11a5e2cf 2024-01-16 benni ccol = i + 1;
393 11a5e2cf 2024-01-16 benni * Look ahead a bit, to avoid extra motion if
394 11a5e2cf 2024-01-16 benni * we will be redrawing the cell after the next.
395 11a5e2cf 2024-01-16 benni * Motion probably takes four or more characters,
396 11a5e2cf 2024-01-16 benni * so we save even if we rewrite two cells
397 11a5e2cf 2024-01-16 benni * `unnecessarily'. Skip it all, though, if
398 11a5e2cf 2024-01-16 benni * the next cell is a different color.
400 11a5e2cf 2024-01-16 benni #define STOP (B_COLS - 3)
401 11a5e2cf 2024-01-16 benni if (i > STOP || sp[1] != bp[1] || so != bp[1])
403 11a5e2cf 2024-01-16 benni if (sp[2] != bp[2])
404 11a5e2cf 2024-01-16 benni sp[1] = -1;
405 11a5e2cf 2024-01-16 benni else if (i < STOP && so == bp[2] && sp[3] != bp[3]) {
406 11a5e2cf 2024-01-16 benni sp[2] = -1;
407 11a5e2cf 2024-01-16 benni sp[1] = -1;
411 11a5e2cf 2024-01-16 benni if (cur_so)
412 11a5e2cf 2024-01-16 benni putpad(exit_standout_mode);
413 11a5e2cf 2024-01-16 benni (void) fflush(stdout);
414 11a5e2cf 2024-01-16 benni (void) sigprocmask(SIG_SETMASK, &osigset, (sigset_t *)0);
418 11a5e2cf 2024-01-16 benni * Write a message (set!=0), or clear the same message (set==0).
419 11a5e2cf 2024-01-16 benni * (We need its length in case we have to overwrite with blanks.)
422 11a5e2cf 2024-01-16 benni scr_msg(char *s, int set)
425 11a5e2cf 2024-01-16 benni if (set || clr_eol == NULL) {
426 11a5e2cf 2024-01-16 benni int l = strlen(s);
428 11a5e2cf 2024-01-16 benni moveto(Rows - 2, ((Cols - l) >> 1) - 1);
430 11a5e2cf 2024-01-16 benni putstr(s);
432 11a5e2cf 2024-01-16 benni while (--l >= 0)
433 11a5e2cf 2024-01-16 benni (void) putchar(' ');
435 11a5e2cf 2024-01-16 benni moveto(Rows - 2, 0);
436 11a5e2cf 2024-01-16 benni putpad(clr_eol);