]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/boot/forth/frames.4th
Comments. No functional change(s).
[FreeBSD/FreeBSD.git] / sys / boot / forth / frames.4th
1 \ Copyright (c) 2003 Scott Long <scottl@FreeBSD.org>
2 \ Copyright (c) 2012-2015 Devin Teske <dteske@FreeBSD.org>
3 \ All rights reserved.
4
5 \ Redistribution and use in source and binary forms, with or without
6 \ modification, are permitted provided that the following conditions
7 \ are met:
8 \ 1. Redistributions of source code must retain the above copyright
9 \    notice, this list of conditions and the following disclaimer.
10 \ 2. Redistributions in binary form must reproduce the above copyright
11 \    notice, this list of conditions and the following disclaimer in the
12 \    documentation and/or other materials provided with the distribution.
13
14 \ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 \ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 \ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 \ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 \ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 \ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 \ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 \ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 \ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 \ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 \ SUCH DAMAGE.
25
26 \ $FreeBSD$
27
28 marker task-frames.4th
29
30 \ XXX Filled boxes are left as an exercise for the reader... ;-/
31
32 variable h_el
33 variable v_el
34 variable lt_el
35 variable lb_el
36 variable rt_el
37 variable rb_el
38 variable fill
39
40 \ ASCII frames (used when serial console is detected)
41  45 constant ascii_dash
42 124 constant ascii_pipe
43  43 constant ascii_plus
44
45 s" arch-pc98" environment? [if]
46         \ Single frames
47         149 constant sh_el
48         150 constant sv_el
49         152 constant slt_el
50         154 constant slb_el
51         153 constant srt_el
52         155 constant srb_el
53         \ Double frames
54         149 constant dh_el
55         150 constant dv_el
56         152 constant dlt_el
57         154 constant dlb_el
58         153 constant drt_el
59         155 constant drb_el
60         \ Fillings
61         0 constant fill_none
62         32 constant fill_blank
63         135 constant fill_dark
64         135 constant fill_med
65         135 constant fill_bright
66 [else]
67         \ Single frames
68         196 constant sh_el
69         179 constant sv_el
70         218 constant slt_el
71         192 constant slb_el
72         191 constant srt_el
73         217 constant srb_el
74         \ Double frames
75         205 constant dh_el
76         186 constant dv_el
77         201 constant dlt_el
78         200 constant dlb_el
79         187 constant drt_el
80         188 constant drb_el
81         \ Fillings
82         0 constant fill_none
83         32 constant fill_blank
84         176 constant fill_dark
85         177 constant fill_med
86         178 constant fill_bright
87 [then]
88
89 : hline ( len x y -- )  \ Draw horizontal single line
90         at-xy           \ move cursor
91         0 do
92                 h_el @ emit
93         loop
94 ;
95
96 : f_ascii ( -- )        ( -- )  \ set frames to ascii
97         ascii_dash h_el !
98         ascii_pipe v_el !
99         ascii_plus lt_el !
100         ascii_plus lb_el !
101         ascii_plus rt_el !
102         ascii_plus rb_el !
103 ;
104
105 : f_single      ( -- )  \ set frames to single
106         boot_serial? if f_ascii exit then
107         sh_el h_el !
108         sv_el v_el !
109         slt_el lt_el !
110         slb_el lb_el !
111         srt_el rt_el !
112         srb_el rb_el !
113 ;
114
115 : f_double      ( -- )  \ set frames to double
116         boot_serial? if f_ascii exit then
117         dh_el h_el !
118         dv_el v_el !
119         dlt_el lt_el !
120         dlb_el lb_el !
121         drt_el rt_el !
122         drb_el rb_el !
123 ;
124
125 : vline ( len x y -- )  \ Draw vertical single line
126         2dup 4 pick
127         0 do
128                 at-xy
129                 v_el @ emit
130                 1+
131                 2dup
132         loop
133         2drop 2drop drop
134 ;
135
136 : box   ( w h x y -- )  \ Draw a box
137         2dup 1+ 4 pick 1- -rot
138         vline           \ Draw left vert line
139         2dup 1+ swap 5 pick + swap 4 pick 1- -rot
140         vline           \ Draw right vert line
141         2dup swap 1+ swap 5 pick 1- -rot
142         hline           \ Draw top horiz line
143         2dup swap 1+ swap 4 pick + 5 pick 1- -rot
144         hline           \ Draw bottom horiz line
145         2dup at-xy lt_el @ emit \ Draw left-top corner
146         2dup 4 pick + at-xy lb_el @ emit        \ Draw left bottom corner
147         2dup swap 5 pick + swap at-xy rt_el @ emit      \ Draw right top corner
148         2 pick + swap 3 pick + swap at-xy rb_el @ emit
149         2drop
150 ;
151
152 f_single
153 fill_none fill !