1281843Sdteske\ Copyright (c) 2003 Scott Long <scottl@FreeBSD.org> 2281843Sdteske\ Copyright (c) 2012-2015 Devin Teske <dteske@FreeBSD.org> 3281843Sdteske\ All rights reserved. 4281843Sdteske\ 5281843Sdteske\ Redistribution and use in source and binary forms, with or without 6281843Sdteske\ modification, are permitted provided that the following conditions 7281843Sdteske\ are met: 8281843Sdteske\ 1. Redistributions of source code must retain the above copyright 9281843Sdteske\ notice, this list of conditions and the following disclaimer. 10281843Sdteske\ 2. Redistributions in binary form must reproduce the above copyright 11281843Sdteske\ notice, this list of conditions and the following disclaimer in the 12281843Sdteske\ documentation and/or other materials provided with the distribution. 13281843Sdteske\ 14281843Sdteske\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15281843Sdteske\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16281843Sdteske\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17281843Sdteske\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18281843Sdteske\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19281843Sdteske\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20281843Sdteske\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21281843Sdteske\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22281843Sdteske\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23281843Sdteske\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24281843Sdteske\ SUCH DAMAGE. 25281843Sdteske\ 26115410Sscottl\ $FreeBSD: releng/10.2/sys/boot/forth/frames.4th 281843 2015-04-22 01:08:40Z dteske $ 27115410Sscottl 28115410Sscottlmarker task-frames.4th 29115410Sscottl 30281843Sdteskevocabulary frame-drawing 31281843Sdteskeonly forth also frame-drawing definitions 32281843Sdteske 33281843Sdteske\ XXX Filled boxes are left as an exercise for the reader... ;-/ 34281843Sdteske 35115410Sscottlvariable h_el 36115410Sscottlvariable v_el 37115410Sscottlvariable lt_el 38115410Sscottlvariable lb_el 39115410Sscottlvariable rt_el 40115410Sscottlvariable rb_el 41115410Sscottlvariable fill 42115410Sscottl 43244048Sdteske\ ASCII frames (used when serial console is detected) 44244048Sdteske 45 constant ascii_dash 45281843Sdteske 61 constant ascii_equal 46244048Sdteske124 constant ascii_pipe 47244048Sdteske 43 constant ascii_plus 48244048Sdteske 49124648Snyans" arch-pc98" environment? [if] 50124648Snyan \ Single frames 51124648Snyan 149 constant sh_el 52124648Snyan 150 constant sv_el 53124648Snyan 152 constant slt_el 54124648Snyan 154 constant slb_el 55124648Snyan 153 constant srt_el 56124648Snyan 155 constant srb_el 57124648Snyan \ Double frames 58124648Snyan 149 constant dh_el 59124648Snyan 150 constant dv_el 60124648Snyan 152 constant dlt_el 61124648Snyan 154 constant dlb_el 62124648Snyan 153 constant drt_el 63124648Snyan 155 constant drb_el 64124648Snyan \ Fillings 65124648Snyan 0 constant fill_none 66124648Snyan 32 constant fill_blank 67124648Snyan 135 constant fill_dark 68124648Snyan 135 constant fill_med 69124648Snyan 135 constant fill_bright 70124648Snyan[else] 71124648Snyan \ Single frames 72124648Snyan 196 constant sh_el 73124648Snyan 179 constant sv_el 74124648Snyan 218 constant slt_el 75124648Snyan 192 constant slb_el 76124648Snyan 191 constant srt_el 77124648Snyan 217 constant srb_el 78124648Snyan \ Double frames 79124648Snyan 205 constant dh_el 80124648Snyan 186 constant dv_el 81124648Snyan 201 constant dlt_el 82124648Snyan 200 constant dlb_el 83124648Snyan 187 constant drt_el 84124648Snyan 188 constant drb_el 85124648Snyan \ Fillings 86124648Snyan 0 constant fill_none 87124648Snyan 32 constant fill_blank 88124648Snyan 176 constant fill_dark 89124648Snyan 177 constant fill_med 90124648Snyan 178 constant fill_bright 91124648Snyan[then] 92115410Sscottl 93281843Sdteskeonly forth definitions also frame-drawing 94281843Sdteske 95115410Sscottl: hline ( len x y -- ) \ Draw horizontal single line 96115410Sscottl at-xy \ move cursor 97115410Sscottl 0 do 98115410Sscottl h_el @ emit 99115410Sscottl loop 100115410Sscottl; 101115410Sscottl 102244048Sdteske: f_ascii ( -- ) ( -- ) \ set frames to ascii 103244048Sdteske ascii_dash h_el ! 104244048Sdteske ascii_pipe v_el ! 105244048Sdteske ascii_plus lt_el ! 106244048Sdteske ascii_plus lb_el ! 107244048Sdteske ascii_plus rt_el ! 108244048Sdteske ascii_plus rb_el ! 109244048Sdteske; 110244048Sdteske 111115410Sscottl: f_single ( -- ) \ set frames to single 112244048Sdteske boot_serial? if f_ascii exit then 113115410Sscottl sh_el h_el ! 114115410Sscottl sv_el v_el ! 115115410Sscottl slt_el lt_el ! 116115410Sscottl slb_el lb_el ! 117115410Sscottl srt_el rt_el ! 118115410Sscottl srb_el rb_el ! 119115410Sscottl; 120115410Sscottl 121115410Sscottl: f_double ( -- ) \ set frames to double 122281843Sdteske boot_serial? if 123281843Sdteske f_ascii 124281843Sdteske ascii_equal h_el ! 125281843Sdteske exit 126281843Sdteske then 127115410Sscottl dh_el h_el ! 128115410Sscottl dv_el v_el ! 129115410Sscottl dlt_el lt_el ! 130115410Sscottl dlb_el lb_el ! 131115410Sscottl drt_el rt_el ! 132115410Sscottl drb_el rb_el ! 133115410Sscottl; 134115410Sscottl 135115410Sscottl: vline ( len x y -- ) \ Draw vertical single line 136115410Sscottl 2dup 4 pick 137115410Sscottl 0 do 138115410Sscottl at-xy 139115410Sscottl v_el @ emit 140115410Sscottl 1+ 141115410Sscottl 2dup 142115410Sscottl loop 143115410Sscottl 2drop 2drop drop 144115410Sscottl; 145115410Sscottl 146115410Sscottl: box ( w h x y -- ) \ Draw a box 147115410Sscottl 2dup 1+ 4 pick 1- -rot 148115410Sscottl vline \ Draw left vert line 149115410Sscottl 2dup 1+ swap 5 pick + swap 4 pick 1- -rot 150115410Sscottl vline \ Draw right vert line 151115410Sscottl 2dup swap 1+ swap 5 pick 1- -rot 152115410Sscottl hline \ Draw top horiz line 153115410Sscottl 2dup swap 1+ swap 4 pick + 5 pick 1- -rot 154115410Sscottl hline \ Draw bottom horiz line 155115410Sscottl 2dup at-xy lt_el @ emit \ Draw left-top corner 156115410Sscottl 2dup 4 pick + at-xy lb_el @ emit \ Draw left bottom corner 157115410Sscottl 2dup swap 5 pick + swap at-xy rt_el @ emit \ Draw right top corner 158115410Sscottl 2 pick + swap 3 pick + swap at-xy rb_el @ emit 159115410Sscottl 2drop 160115410Sscottl; 161115410Sscottl 162115410Sscottlf_single 163115410Sscottlfill_none fill ! 164281843Sdteske 165281843Sdteskeonly forth definitions 166