beastie.4th revision 222417
1115410Sscottl\ Copyright (c) 2003 Scott Long <scottl@freebsd.org>
2120031Sscottl\ Copyright (c) 2003 Aleksander Fafula <alex@fafula.com>
3222417Sjulian\ Copyright (c) 2006-2011 Devin Teske <devinteske@hotmail.com>
4115410Sscottl\ All rights reserved.
5222417Sjulian\ 
6115410Sscottl\ Redistribution and use in source and binary forms, with or without
7115410Sscottl\ modification, are permitted provided that the following conditions
8115410Sscottl\ are met:
9115410Sscottl\ 1. Redistributions of source code must retain the above copyright
10115410Sscottl\    notice, this list of conditions and the following disclaimer.
11115410Sscottl\ 2. Redistributions in binary form must reproduce the above copyright
12115410Sscottl\    notice, this list of conditions and the following disclaimer in the
13115410Sscottl\    documentation and/or other materials provided with the distribution.
14222417Sjulian\ 
15115410Sscottl\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16115410Sscottl\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17115410Sscottl\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18115410Sscottl\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19115410Sscottl\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20115410Sscottl\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21115410Sscottl\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22115410Sscottl\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23115410Sscottl\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24115410Sscottl\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25115410Sscottl\ SUCH DAMAGE.
26222417Sjulian\ 
27115410Sscottl\ $FreeBSD: head/sys/boot/forth/beastie.4th 222417 2011-05-28 08:50:38Z julian $
28115410Sscottl
29115410Sscottlmarker task-beastie.4th
30115410Sscottl
31222417Sjulianinclude /boot/color.4th
32222417Sjulianinclude /boot/delay.4th
33115410Sscottl
34222417Sjulianvariable logoX
35222417Sjulianvariable logoY
36115410Sscottl
37222417Sjulian\ Initialize logo placement to defaults
38222417Sjulian46 logoX !
39222417Sjulian4  logoY !
40115410Sscottl
41222417Sjulian: beastie-logo ( x y -- ) \ color BSD mascot (19 rows x 34 columns)
42115410Sscottl
43222417Sjulian2dup at-xy ."               [31m,        ," 1+
44120031Sscottl2dup at-xy ."              /(        )`" 1+
45120031Sscottl2dup at-xy ."              \ \___   / |" 1+
46120031Sscottl2dup at-xy ."              /- [37m_[31m  `-/  '" 1+
47120031Sscottl2dup at-xy ."             ([37m/\/ \[31m \   /\" 1+
48120031Sscottl2dup at-xy ."             [37m/ /   |[31m `    \" 1+
49120031Sscottl2dup at-xy ."             [34mO O   [37m) [31m/    |" 1+
50120031Sscottl2dup at-xy ."             [37m`-^--'[31m`<     '" 1+
51120031Sscottl2dup at-xy ."            (_.)  _  )   /" 1+
52222417Sjulian2dup at-xy ."             `.___/`    /" 1+
53120031Sscottl2dup at-xy ."               `-----' /" 1+
54120031Sscottl2dup at-xy ."  [33m<----.[31m     __ / __   \" 1+
55120031Sscottl2dup at-xy ."  [33m<----|====[31mO)))[33m==[31m) \) /[33m====|" 1+
56120031Sscottl2dup at-xy ."  [33m<----'[31m    `--' `.__,' \" 1+
57120031Sscottl2dup at-xy ."               |        |" 1+
58120031Sscottl2dup at-xy ."                \       /       /\" 1+
59120031Sscottl2dup at-xy ."           [36m______[31m( (_  / \______/" 1+
60120031Sscottl2dup at-xy ."         [36m,'  ,-----'   |" 1+
61222417Sjulian     at-xy ."         `--{__________)[37m"
62222417Sjulian
63222417Sjulian	\ Put the cursor back at the bottom
64222417Sjulian	0 25 at-xy
65120031Sscottl;
66120031Sscottl
67222417Sjulian: beastiebw-logo ( x y -- ) \ B/W BSD mascot (19 rows x 34 columns)
68222417Sjulian
69222417Sjulian	2dup at-xy ."               ,        ," 1+
70222417Sjulian	2dup at-xy ."              /(        )`" 1+
71222417Sjulian	2dup at-xy ."              \ \___   / |" 1+
72222417Sjulian	2dup at-xy ."              /- _  `-/  '" 1+
73222417Sjulian	2dup at-xy ."             (/\/ \ \   /\" 1+
74222417Sjulian	2dup at-xy ."             / /   | `    \" 1+
75222417Sjulian	2dup at-xy ."             O O   ) /    |" 1+
76222417Sjulian	2dup at-xy ."             `-^--'`<     '" 1+
77222417Sjulian	2dup at-xy ."            (_.)  _  )   /" 1+
78222417Sjulian	2dup at-xy ."             `.___/`    /" 1+
79222417Sjulian	2dup at-xy ."               `-----' /" 1+
80222417Sjulian	2dup at-xy ."  <----.     __ / __   \" 1+
81222417Sjulian	2dup at-xy ."  <----|====O)))==) \) /====|" 1+
82222417Sjulian	2dup at-xy ."  <----'    `--' `.__,' \" 1+
83222417Sjulian	2dup at-xy ."               |        |" 1+
84222417Sjulian	2dup at-xy ."                \       /       /\" 1+
85222417Sjulian	2dup at-xy ."           ______( (_  / \______/" 1+
86222417Sjulian	2dup at-xy ."         ,'  ,-----'   |" 1+
87222417Sjulian	     at-xy ."         `--{__________)"
88222417Sjulian
89222417Sjulian	\ Put the cursor back at the bottom
90222417Sjulian	0 25 at-xy
91115410Sscottl;
92115410Sscottl
93222417Sjulian: fbsdbw-logo ( x y -- ) \ "FreeBSD" logo in B/W (13 rows x 21 columns)
94222417Sjulian
95222417Sjulian	\ We used to use the beastie himself as our default... until the
96222417Sjulian	\ eventual complaint derided his reign of the advanced boot-menu.
97222417Sjulian	\ 
98222417Sjulian	\ This is the replacement of beastie to satiate the haters of our
99222417Sjulian	\ beloved helper-daemon (ready to track down and spear bugs with
100222417Sjulian	\ his trident and sporty sneakers; see above).
101222417Sjulian	\ 
102222417Sjulian	\ Since we merely just changed the default and not the default-
103222417Sjulian	\ location, below is an adjustment to the passed-in coordinates,
104222417Sjulian	\ forever influenced by the proper location of beastie himself
105222417Sjulian	\ kept as the default loader_logo_x/loader_logo_y values.
106222417Sjulian	\ 
107222417Sjulian	5 + swap 6 + swap
108222417Sjulian
109222417Sjulian	2dup at-xy ."  ______" 1+
110222417Sjulian	2dup at-xy ." |  ____| __ ___  ___ " 1+
111222417Sjulian	2dup at-xy ." | |__ | '__/ _ \/ _ \" 1+
112222417Sjulian	2dup at-xy ." |  __|| | |  __/  __/" 1+
113222417Sjulian	2dup at-xy ." | |   | | |    |    |" 1+
114222417Sjulian	2dup at-xy ." |_|   |_|  \___|\___|" 1+
115222417Sjulian	2dup at-xy ."  ____   _____ _____" 1+
116222417Sjulian	2dup at-xy ." |  _ \ / ____|  __ \" 1+
117222417Sjulian	2dup at-xy ." | |_) | (___ | |  | |" 1+
118222417Sjulian	2dup at-xy ." |  _ < \___ \| |  | |" 1+
119222417Sjulian	2dup at-xy ." | |_) |____) | |__| |" 1+
120222417Sjulian	2dup at-xy ." |     |      |      |" 1+
121222417Sjulian	     at-xy ." |____/|_____/|_____/"
122222417Sjulian
123222417Sjulian	\ Put the cursor back at the bottom
124222417Sjulian	0 25 at-xy
125151873Sscottl;
126151873Sscottl
127222417Sjulian: orb-logo ( x y -- ) \ color Orb mascot (15 rows x 30 columns)
128222417Sjulian
129222417Sjulian	3 + \ beastie adjustment (see `fbsdbw-logo' comments above)
130222417Sjulian
131222417Sjulian	2dup at-xy ."  [31m```                        [31;1m`[31m" 1+
132222417Sjulian	2dup at-xy ." s` `.....---...[31;1m....--.```   -/[31m" 1+
133222417Sjulian	2dup at-xy ." +o   .--`         [31;1m/y:`      +.[31m" 1+
134222417Sjulian	2dup at-xy ."  yo`:.            [31;1m:o      `+-[31m" 1+
135222417Sjulian	2dup at-xy ."   y/               [31;1m-/`   -o/[31m" 1+
136222417Sjulian	2dup at-xy ."  .-                  [31;1m::/sy+:.[31m" 1+
137222417Sjulian	2dup at-xy ."  /                     [31;1m`--  /[31m" 1+
138222417Sjulian	2dup at-xy ." `:                          [31;1m:`[31m" 1+
139222417Sjulian	2dup at-xy ." `:                          [31;1m:`[31m" 1+
140222417Sjulian	2dup at-xy ."  /                          [31;1m/[31m" 1+
141222417Sjulian	2dup at-xy ."  .-                        [31;1m-.[31m" 1+
142222417Sjulian	2dup at-xy ."   --                      [31;1m-.[31m" 1+
143222417Sjulian	2dup at-xy ."    `:`                  [31;1m`:`" 1+
144222417Sjulian	2dup at-xy ."      [31;1m.--             `--." 1+
145222417Sjulian	     at-xy ."         .---.....----.[37m"
146222417Sjulian
147222417Sjulian 	\ Put the cursor back at the bottom
148222417Sjulian 	0 25 at-xy
149120031Sscottl;
150120031Sscottl
151222417Sjulian: orbbw-logo ( x y -- ) \ B/W Orb mascot (15 rows x 32 columns)
152222417Sjulian
153222417Sjulian	3 + \ beastie adjustment (see `fbsdbw-logo' comments above)
154222417Sjulian
155222417Sjulian	2dup at-xy ."  ```                        `" 1+
156222417Sjulian	2dup at-xy ." s` `.....---.......--.```   -/" 1+
157222417Sjulian	2dup at-xy ." +o   .--`         /y:`      +." 1+
158222417Sjulian	2dup at-xy ."  yo`:.            :o      `+-" 1+
159222417Sjulian	2dup at-xy ."   y/               -/`   -o/" 1+
160222417Sjulian	2dup at-xy ."  .-                  ::/sy+:." 1+
161222417Sjulian	2dup at-xy ."  /                     `--  /" 1+
162222417Sjulian	2dup at-xy ." `:                          :`" 1+
163222417Sjulian	2dup at-xy ." `:                          :`" 1+
164222417Sjulian	2dup at-xy ."  /                          /" 1+
165222417Sjulian	2dup at-xy ."  .-                        -." 1+
166222417Sjulian	2dup at-xy ."   --                      -." 1+
167222417Sjulian	2dup at-xy ."    `:`                  `:`" 1+
168222417Sjulian	2dup at-xy ."      .--             `--." 1+
169222417Sjulian	     at-xy ."         .---.....----."
170222417Sjulian
171222417Sjulian 	\ Put the cursor back at the bottom
172222417Sjulian 	0 25 at-xy
173215345Sjhb;
174215345Sjhb
175222417Sjulian\ This function draws any number of beastie logos at (loader_logo_x,
176222417Sjulian\ loader_logo_y) if defined, else (46,4) (to the right of the menu). To choose
177222417Sjulian\ your beastie, set the variable `loader_logo' to the respective logo name.
178222417Sjulian\ 
179222417Sjulian\ Currently available:
180222417Sjulian\ 
181222417Sjulian\ 	NAME        DESCRIPTION
182222417Sjulian\ 	beastie     Color ``Helper Daemon'' mascot (19 rows x 34 columns)
183222417Sjulian\ 	beastiebw   B/W ``Helper Daemon'' mascot (19 rows x 34 columns)
184222417Sjulian\ 	fbsdbw      "FreeBSD" logo in B/W (13 rows x 21 columns)
185222417Sjulian\ 	orb         Color ``Orb'' mascot (15 rows x 30 columns)
186222417Sjulian\ 	orbbw       B/W ``Orb'' mascot (15 rows x 32 columns) (default)
187222417Sjulian\ 
188222417Sjulian\ NOTE: Setting `loader_logo' to an undefined value (such as "none") will
189222417Sjulian\       prevent beastie from being drawn.
190222417Sjulian\ 
191222417Sjulian: draw-beastie ( -- ) \ at (loader_logo_x,loader_logo_y), else (46,4)
192222417Sjulian
193222417Sjulian	s" loader_logo_x" getenv dup -1 <> if
194222417Sjulian		?number 1 = if logoX ! then
195138258Sscottl	else
196138258Sscottl		drop
197115410Sscottl	then
198222417Sjulian	s" loader_logo_y" getenv dup -1 <> if
199222417Sjulian		?number 1 = if logoY ! then
200222417Sjulian	else
201222417Sjulian		drop
202222417Sjulian	then
203115410Sscottl
204222417Sjulian	s" loader_logo" getenv dup -1 = if
205222417Sjulian		logoX @ logoY @
206222417Sjulian		loader_color? if
207222417Sjulian			orb-logo
208115410Sscottl		else
209222417Sjulian			orbbw-logo
210115410Sscottl		then
211222417Sjulian		drop exit
212115410Sscottl	then
213222417Sjulian
214222417Sjulian	2dup s" beastie" compare-insensitive 0= if
215222417Sjulian		logoX @ logoY @ beastie-logo
216222417Sjulian		2drop exit
217222417Sjulian	then
218222417Sjulian	2dup s" beastiebw" compare-insensitive 0= if
219222417Sjulian		logoX @ logoY @ beastiebw-logo
220222417Sjulian		2drop exit
221222417Sjulian	then
222222417Sjulian	2dup s" fbsdbw" compare-insensitive 0= if
223222417Sjulian		logoX @ logoY @ fbsdbw-logo
224222417Sjulian		2drop exit
225222417Sjulian	then
226222417Sjulian	2dup s" orb" compare-insensitive 0= if
227222417Sjulian		logoX @ logoY @ orb-logo
228222417Sjulian		2drop exit
229222417Sjulian	then
230222417Sjulian	2dup s" orbbw" compare-insensitive 0= if
231222417Sjulian		logoX @ logoY @ orbbw-logo
232222417Sjulian		2drop exit
233222417Sjulian	then
234222417Sjulian
235222417Sjulian	2drop
236115410Sscottl;
237115410Sscottl
238222417Sjulian: clear-beastie ( -- ) \ clears beastie from the screen
239222417Sjulian	logoX @ logoY @
240222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
241222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
242222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
243222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
244222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
245222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
246222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
247222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
248222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
249222417Sjulian	2dup at-xy 34 spaces		2drop
250222417Sjulian
251222417Sjulian	\ Put the cursor back at the bottom
252222417Sjulian	0 25 at-xy
253115410Sscottl;
254115410Sscottl
255222417Sjulian: beastie-start ( -- ) \ starts the menu
256116175Sscottl	s" beastie_disable" getenv
257116175Sscottl	dup -1 <> if
258116175Sscottl		s" YES" compare-insensitive 0= if
259116175Sscottl			exit
260116175Sscottl		then
261138258Sscottl	else
262138258Sscottl		drop
263116175Sscottl	then
264222417Sjulian
265222417Sjulian	s" loader_delay" getenv
266222417Sjulian	-1 = if
267222417Sjulian		s" include /boot/menu.rc" evaluate
268222417Sjulian	else
269115410Sscottl		drop
270222417Sjulian		." Loading Menu (Ctrl-C to Abort)" cr
271222417Sjulian		s" set delay_command='include /boot/menu.rc'" evaluate
272222417Sjulian		s" set delay_showdots" evaluate
273222417Sjulian		delay_execute
274115410Sscottl	then
275115410Sscottl;
276