1115410Sscottl\ Copyright (c) 2003 Scott Long <scottl@freebsd.org>
2120031Sscottl\ Copyright (c) 2003 Aleksander Fafula <alex@fafula.com>
3254105Sdteske\ Copyright (c) 2006-2013 Devin Teske <dteske@FreeBSD.org>
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$
28115410Sscottl
29115410Sscottlmarker task-beastie.4th
30115410Sscottl
31222417Sjulianinclude /boot/delay.4th
32115410Sscottl
33222417Sjulianvariable logoX
34222417Sjulianvariable logoY
35115410Sscottl
36222417Sjulian\ Initialize logo placement to defaults
37222417Sjulian46 logoX !
38222417Sjulian4  logoY !
39115410Sscottl
40222417Sjulian: beastie-logo ( x y -- ) \ color BSD mascot (19 rows x 34 columns)
41115410Sscottl
42222417Sjulian2dup at-xy ."               [31m,        ," 1+
43120031Sscottl2dup at-xy ."              /(        )`" 1+
44120031Sscottl2dup at-xy ."              \ \___   / |" 1+
45120031Sscottl2dup at-xy ."              /- [37m_[31m  `-/  '" 1+
46120031Sscottl2dup at-xy ."             ([37m/\/ \[31m \   /\" 1+
47120031Sscottl2dup at-xy ."             [37m/ /   |[31m `    \" 1+
48120031Sscottl2dup at-xy ."             [34mO O   [37m) [31m/    |" 1+
49120031Sscottl2dup at-xy ."             [37m`-^--'[31m`<     '" 1+
50120031Sscottl2dup at-xy ."            (_.)  _  )   /" 1+
51222417Sjulian2dup at-xy ."             `.___/`    /" 1+
52120031Sscottl2dup at-xy ."               `-----' /" 1+
53120031Sscottl2dup at-xy ."  [33m<----.[31m     __ / __   \" 1+
54120031Sscottl2dup at-xy ."  [33m<----|====[31mO)))[33m==[31m) \) /[33m====|" 1+
55120031Sscottl2dup at-xy ."  [33m<----'[31m    `--' `.__,' \" 1+
56120031Sscottl2dup at-xy ."               |        |" 1+
57120031Sscottl2dup at-xy ."                \       /       /\" 1+
58120031Sscottl2dup at-xy ."           [36m______[31m( (_  / \______/" 1+
59120031Sscottl2dup at-xy ."         [36m,'  ,-----'   |" 1+
60222417Sjulian     at-xy ."         `--{__________)[37m"
61222417Sjulian
62222417Sjulian	\ Put the cursor back at the bottom
63222417Sjulian	0 25 at-xy
64120031Sscottl;
65120031Sscottl
66222417Sjulian: beastiebw-logo ( x y -- ) \ B/W BSD mascot (19 rows x 34 columns)
67222417Sjulian
68222417Sjulian	2dup at-xy ."               ,        ," 1+
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 ."             O O   ) /    |" 1+
75222417Sjulian	2dup at-xy ."             `-^--'`<     '" 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 ."  <----|====O)))==) \) /====|" 1+
81222417Sjulian	2dup at-xy ."  <----'    `--' `.__,' \" 1+
82222417Sjulian	2dup at-xy ."               |        |" 1+
83222417Sjulian	2dup at-xy ."                \       /       /\" 1+
84222417Sjulian	2dup at-xy ."           ______( (_  / \______/" 1+
85222417Sjulian	2dup at-xy ."         ,'  ,-----'   |" 1+
86222417Sjulian	     at-xy ."         `--{__________)"
87222417Sjulian
88222417Sjulian	\ Put the cursor back at the bottom
89222417Sjulian	0 25 at-xy
90115410Sscottl;
91115410Sscottl
92222417Sjulian: fbsdbw-logo ( x y -- ) \ "FreeBSD" logo in B/W (13 rows x 21 columns)
93222417Sjulian
94222417Sjulian	\ We used to use the beastie himself as our default... until the
95222417Sjulian	\ eventual complaint derided his reign of the advanced boot-menu.
96222417Sjulian	\ 
97222417Sjulian	\ This is the replacement of beastie to satiate the haters of our
98222417Sjulian	\ beloved helper-daemon (ready to track down and spear bugs with
99222417Sjulian	\ his trident and sporty sneakers; see above).
100222417Sjulian	\ 
101222417Sjulian	\ Since we merely just changed the default and not the default-
102222417Sjulian	\ location, below is an adjustment to the passed-in coordinates,
103222417Sjulian	\ forever influenced by the proper location of beastie himself
104222417Sjulian	\ kept as the default loader_logo_x/loader_logo_y values.
105222417Sjulian	\ 
106222417Sjulian	5 + swap 6 + swap
107222417Sjulian
108222417Sjulian	2dup at-xy ."  ______" 1+
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	     at-xy ." |____/|_____/|_____/"
121222417Sjulian
122222417Sjulian	\ Put the cursor back at the bottom
123222417Sjulian	0 25 at-xy
124151873Sscottl;
125151873Sscottl
126222417Sjulian: orb-logo ( x y -- ) \ color Orb mascot (15 rows x 30 columns)
127222417Sjulian
128222417Sjulian	3 + \ beastie adjustment (see `fbsdbw-logo' comments above)
129222417Sjulian
130222417Sjulian	2dup at-xy ."  [31m```                        [31;1m`[31m" 1+
131222417Sjulian	2dup at-xy ." s` `.....---...[31;1m....--.```   -/[31m" 1+
132222417Sjulian	2dup at-xy ." +o   .--`         [31;1m/y:`      +.[31m" 1+
133222417Sjulian	2dup at-xy ."  yo`:.            [31;1m:o      `+-[31m" 1+
134222417Sjulian	2dup at-xy ."   y/               [31;1m-/`   -o/[31m" 1+
135222417Sjulian	2dup at-xy ."  .-                  [31;1m::/sy+:.[31m" 1+
136222417Sjulian	2dup at-xy ."  /                     [31;1m`--  /[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`:`" 1+
143222417Sjulian	2dup at-xy ."      [31;1m.--             `--." 1+
144222417Sjulian	     at-xy ."         .---.....----.[37m"
145222417Sjulian
146222417Sjulian 	\ Put the cursor back at the bottom
147222417Sjulian 	0 25 at-xy
148120031Sscottl;
149120031Sscottl
150222417Sjulian: orbbw-logo ( x y -- ) \ B/W Orb mascot (15 rows x 32 columns)
151222417Sjulian
152222417Sjulian	3 + \ beastie adjustment (see `fbsdbw-logo' comments above)
153222417Sjulian
154222417Sjulian	2dup at-xy ."  ```                        `" 1+
155222417Sjulian	2dup at-xy ." s` `.....---.......--.```   -/" 1+
156222417Sjulian	2dup at-xy ." +o   .--`         /y:`      +." 1+
157222417Sjulian	2dup at-xy ."  yo`:.            :o      `+-" 1+
158222417Sjulian	2dup at-xy ."   y/               -/`   -o/" 1+
159222417Sjulian	2dup at-xy ."  .-                  ::/sy+:." 1+
160222417Sjulian	2dup at-xy ."  /                     `--  /" 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	     at-xy ."         .---.....----."
169222417Sjulian
170222417Sjulian 	\ Put the cursor back at the bottom
171222417Sjulian 	0 25 at-xy
172215345Sjhb;
173215345Sjhb
174222417Sjulian\ This function draws any number of beastie logos at (loader_logo_x,
175222417Sjulian\ loader_logo_y) if defined, else (46,4) (to the right of the menu). To choose
176222417Sjulian\ your beastie, set the variable `loader_logo' to the respective logo name.
177222417Sjulian\ 
178222417Sjulian\ Currently available:
179222417Sjulian\ 
180222417Sjulian\ 	NAME        DESCRIPTION
181222417Sjulian\ 	beastie     Color ``Helper Daemon'' mascot (19 rows x 34 columns)
182222417Sjulian\ 	beastiebw   B/W ``Helper Daemon'' mascot (19 rows x 34 columns)
183222417Sjulian\ 	fbsdbw      "FreeBSD" logo in B/W (13 rows x 21 columns)
184254237Sdteske\ 	orb         Color ``Orb'' mascot (15 rows x 30 columns) (2nd default)
185254105Sdteske\ 	orbbw       B/W ``Orb'' mascot (15 rows x 32 columns)
186254237Sdteske\ 	tribute     Color ``Tribute'' (must fit 19 rows x 34 columns) (default)
187254237Sdteske\ 	tributebw   B/W ``Tribute'' (must fit 19 rows x 34 columns)
188222417Sjulian\ 
189222417Sjulian\ NOTE: Setting `loader_logo' to an undefined value (such as "none") will
190222417Sjulian\       prevent beastie from being drawn.
191222417Sjulian\ 
192222417Sjulian: draw-beastie ( -- ) \ at (loader_logo_x,loader_logo_y), else (46,4)
193222417Sjulian
194222417Sjulian	s" loader_logo_x" getenv dup -1 <> if
195222417Sjulian		?number 1 = if logoX ! then
196138258Sscottl	else
197138258Sscottl		drop
198115410Sscottl	then
199222417Sjulian	s" loader_logo_y" getenv dup -1 <> if
200222417Sjulian		?number 1 = if logoY ! then
201222417Sjulian	else
202222417Sjulian		drop
203222417Sjulian	then
204115410Sscottl
205222417Sjulian	s" loader_logo" getenv dup -1 = if
206222417Sjulian		logoX @ logoY @
207222417Sjulian		loader_color? if
208254942Sdteske			orb-logo
209115410Sscottl		else
210254942Sdteske			orbbw-logo
211115410Sscottl		then
212222417Sjulian		drop exit
213115410Sscottl	then
214222417Sjulian
215222417Sjulian	2dup s" beastie" compare-insensitive 0= if
216222417Sjulian		logoX @ logoY @ beastie-logo
217222417Sjulian		2drop exit
218222417Sjulian	then
219222417Sjulian	2dup s" beastiebw" compare-insensitive 0= if
220222417Sjulian		logoX @ logoY @ beastiebw-logo
221222417Sjulian		2drop exit
222222417Sjulian	then
223222417Sjulian	2dup s" fbsdbw" compare-insensitive 0= if
224222417Sjulian		logoX @ logoY @ fbsdbw-logo
225222417Sjulian		2drop exit
226222417Sjulian	then
227222417Sjulian	2dup s" orb" compare-insensitive 0= if
228222417Sjulian		logoX @ logoY @ orb-logo
229222417Sjulian		2drop exit
230222417Sjulian	then
231222417Sjulian	2dup s" orbbw" compare-insensitive 0= if
232222417Sjulian		logoX @ logoY @ orbbw-logo
233222417Sjulian		2drop exit
234222417Sjulian	then
235254237Sdteske	2dup s" tribute" compare-insensitive 0= if
236254237Sdteske		logoX @ logoY @
237254237Sdteske		s" tribute-logo" sfind if
238254237Sdteske			execute
239254237Sdteske		else
240254942Sdteske			drop orb-logo
241254237Sdteske		then
242254237Sdteske		2drop exit
243254237Sdteske	then
244254237Sdteske	2dup s" tributebw" compare-insensitive 0= if
245254237Sdteske		logoX @ logoY @
246254237Sdteske		s" tributebw-logo" sfind if
247254237Sdteske			execute
248254237Sdteske		else
249254942Sdteske			drop orbbw-logo
250254237Sdteske		then
251254237Sdteske		2drop exit
252254237Sdteske	then
253222417Sjulian
254222417Sjulian	2drop
255115410Sscottl;
256115410Sscottl
257222417Sjulian: clear-beastie ( -- ) \ clears beastie from the screen
258222417Sjulian	logoX @ logoY @
259222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
260222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
261222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
262222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
263222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
264222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
265222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
266222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
267222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
268222417Sjulian	2dup at-xy 34 spaces		2drop
269222417Sjulian
270222417Sjulian	\ Put the cursor back at the bottom
271222417Sjulian	0 25 at-xy
272115410Sscottl;
273115410Sscottl
274222417Sjulian: beastie-start ( -- ) \ starts the menu
275116175Sscottl	s" beastie_disable" getenv
276116175Sscottl	dup -1 <> if
277116175Sscottl		s" YES" compare-insensitive 0= if
278116175Sscottl			exit
279116175Sscottl		then
280138258Sscottl	else
281138258Sscottl		drop
282116175Sscottl	then
283222417Sjulian
284222417Sjulian	s" loader_delay" getenv
285222417Sjulian	-1 = if
286222417Sjulian		s" include /boot/menu.rc" evaluate
287222417Sjulian	else
288115410Sscottl		drop
289222417Sjulian		." Loading Menu (Ctrl-C to Abort)" cr
290222417Sjulian		s" set delay_command='include /boot/menu.rc'" evaluate
291222417Sjulian		s" set delay_showdots" evaluate
292222417Sjulian		delay_execute
293115410Sscottl	then
294115410Sscottl;
295