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