xref: /freebsd/share/examples/bootforth/screen.4th (revision 26a58599a09a6181e0f5abe624021865a0c23186)
1\ Screen manipulation related words.
2
3marker task-screen.4th
4
5: escc	( -- )	\ emit Esc-[
6	91 27 emit emit
7;
8
9: ho	( -- )	\ Home cursor
10	escc 72 emit	\ Esc-[H
11;
12
13: cld	( -- )	\ Clear from current position to end of display
14	escc 74 emit	\ Esc-[J
15;
16
17: clear	( -- )	\ clear screen
18	ho cld
19;
20
21: at-xy	( x y -- )	\ move cursor to x rows, y cols (1-based coords)
22	escc .# 59 emit .# 72 emit	\ Esc-[%d;%dH
23;
24
25: fg	( x -- )	\ Set foreground color
26	escc 3 .# .# 109 emit	\ Esc-[3%dm
27;
28
29: bg	( x -- )	\ Set background color
30	escc 4 .# .# 109 emit	\ Esc-[4%dm
31;
32
33: me	( -- )	\ Mode end (clear attributes)
34	escc 109 emit
35;
36