beastie.4th revision 257650
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: head/sys/boot/forth/beastie.4th 257650 2013-11-04 20:28:10Z dteske $
28115410Sscottl
29115410Sscottlmarker task-beastie.4th
30115410Sscottl
31222417Sjulianinclude /boot/delay.4th
32115410Sscottl
33257650Sdteskeonly forth definitions also support-functions
34257650Sdteske
35222417Sjulianvariable logoX
36222417Sjulianvariable logoY
37115410Sscottl
38222417Sjulian\ Initialize logo placement to defaults
39222417Sjulian46 logoX !
40222417Sjulian4  logoY !
41115410Sscottl
42222417Sjulian: beastie-logo ( x y -- ) \ color BSD mascot (19 rows x 34 columns)
43115410Sscottl
44222417Sjulian2dup at-xy ."               [31m,        ," 1+
45120031Sscottl2dup at-xy ."              /(        )`" 1+
46120031Sscottl2dup at-xy ."              \ \___   / |" 1+
47120031Sscottl2dup at-xy ."              /- [37m_[31m  `-/  '" 1+
48120031Sscottl2dup at-xy ."             ([37m/\/ \[31m \   /\" 1+
49120031Sscottl2dup at-xy ."             [37m/ /   |[31m `    \" 1+
50120031Sscottl2dup at-xy ."             [34mO O   [37m) [31m/    |" 1+
51120031Sscottl2dup at-xy ."             [37m`-^--'[31m`<     '" 1+
52120031Sscottl2dup at-xy ."            (_.)  _  )   /" 1+
53222417Sjulian2dup at-xy ."             `.___/`    /" 1+
54120031Sscottl2dup at-xy ."               `-----' /" 1+
55120031Sscottl2dup at-xy ."  [33m<----.[31m     __ / __   \" 1+
56120031Sscottl2dup at-xy ."  [33m<----|====[31mO)))[33m==[31m) \) /[33m====|" 1+
57120031Sscottl2dup at-xy ."  [33m<----'[31m    `--' `.__,' \" 1+
58120031Sscottl2dup at-xy ."               |        |" 1+
59120031Sscottl2dup at-xy ."                \       /       /\" 1+
60120031Sscottl2dup at-xy ."           [36m______[31m( (_  / \______/" 1+
61120031Sscottl2dup at-xy ."         [36m,'  ,-----'   |" 1+
62222417Sjulian     at-xy ."         `--{__________)[37m"
63222417Sjulian
64222417Sjulian	\ Put the cursor back at the bottom
65222417Sjulian	0 25 at-xy
66120031Sscottl;
67120031Sscottl
68222417Sjulian: beastiebw-logo ( x y -- ) \ B/W BSD mascot (19 rows x 34 columns)
69222417Sjulian
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 ."             / /   | `    \" 1+
76222417Sjulian	2dup at-xy ."             O O   ) /    |" 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 ."  <----.     __ / __   \" 1+
82222417Sjulian	2dup at-xy ."  <----|====O)))==) \) /====|" 1+
83222417Sjulian	2dup at-xy ."  <----'    `--' `.__,' \" 1+
84222417Sjulian	2dup at-xy ."               |        |" 1+
85222417Sjulian	2dup at-xy ."                \       /       /\" 1+
86222417Sjulian	2dup at-xy ."           ______( (_  / \______/" 1+
87222417Sjulian	2dup at-xy ."         ,'  ,-----'   |" 1+
88222417Sjulian	     at-xy ."         `--{__________)"
89222417Sjulian
90222417Sjulian	\ Put the cursor back at the bottom
91222417Sjulian	0 25 at-xy
92115410Sscottl;
93115410Sscottl
94222417Sjulian: fbsdbw-logo ( x y -- ) \ "FreeBSD" logo in B/W (13 rows x 21 columns)
95222417Sjulian
96222417Sjulian	\ We used to use the beastie himself as our default... until the
97222417Sjulian	\ eventual complaint derided his reign of the advanced boot-menu.
98222417Sjulian	\ 
99222417Sjulian	\ This is the replacement of beastie to satiate the haters of our
100222417Sjulian	\ beloved helper-daemon (ready to track down and spear bugs with
101222417Sjulian	\ his trident and sporty sneakers; see above).
102222417Sjulian	\ 
103222417Sjulian	\ Since we merely just changed the default and not the default-
104222417Sjulian	\ location, below is an adjustment to the passed-in coordinates,
105222417Sjulian	\ forever influenced by the proper location of beastie himself
106222417Sjulian	\ kept as the default loader_logo_x/loader_logo_y values.
107222417Sjulian	\ 
108222417Sjulian	5 + swap 6 + swap
109222417Sjulian
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	2dup at-xy ." |     |      |      |" 1+
122222417Sjulian	     at-xy ." |____/|_____/|_____/"
123222417Sjulian
124222417Sjulian	\ Put the cursor back at the bottom
125222417Sjulian	0 25 at-xy
126151873Sscottl;
127151873Sscottl
128222417Sjulian: orb-logo ( x y -- ) \ color Orb mascot (15 rows x 30 columns)
129222417Sjulian
130222417Sjulian	3 + \ beastie adjustment (see `fbsdbw-logo' comments above)
131222417Sjulian
132222417Sjulian	2dup at-xy ."  [31m```                        [31;1m`[31m" 1+
133222417Sjulian	2dup at-xy ." s` `.....---...[31;1m....--.```   -/[31m" 1+
134222417Sjulian	2dup at-xy ." +o   .--`         [31;1m/y:`      +.[31m" 1+
135222417Sjulian	2dup at-xy ."  yo`:.            [31;1m:o      `+-[31m" 1+
136222417Sjulian	2dup at-xy ."   y/               [31;1m-/`   -o/[31m" 1+
137222417Sjulian	2dup at-xy ."  .-                  [31;1m::/sy+:.[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-.[31m" 1+
144222417Sjulian	2dup at-xy ."    `:`                  [31;1m`:`" 1+
145222417Sjulian	2dup at-xy ."      [31;1m.--             `--." 1+
146222417Sjulian	     at-xy ."         .---.....----.[37m"
147222417Sjulian
148222417Sjulian 	\ Put the cursor back at the bottom
149222417Sjulian 	0 25 at-xy
150120031Sscottl;
151120031Sscottl
152222417Sjulian: orbbw-logo ( x y -- ) \ B/W Orb mascot (15 rows x 32 columns)
153222417Sjulian
154222417Sjulian	3 + \ beastie adjustment (see `fbsdbw-logo' comments above)
155222417Sjulian
156222417Sjulian	2dup at-xy ."  ```                        `" 1+
157222417Sjulian	2dup at-xy ." s` `.....---.......--.```   -/" 1+
158222417Sjulian	2dup at-xy ." +o   .--`         /y:`      +." 1+
159222417Sjulian	2dup at-xy ."  yo`:.            :o      `+-" 1+
160222417Sjulian	2dup at-xy ."   y/               -/`   -o/" 1+
161222417Sjulian	2dup at-xy ."  .-                  ::/sy+:." 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	2dup at-xy ."      .--             `--." 1+
170222417Sjulian	     at-xy ."         .---.....----."
171222417Sjulian
172222417Sjulian 	\ Put the cursor back at the bottom
173222417Sjulian 	0 25 at-xy
174215345Sjhb;
175215345Sjhb
176222417Sjulian\ This function draws any number of beastie logos at (loader_logo_x,
177222417Sjulian\ loader_logo_y) if defined, else (46,4) (to the right of the menu). To choose
178222417Sjulian\ your beastie, set the variable `loader_logo' to the respective logo name.
179222417Sjulian\ 
180222417Sjulian\ Currently available:
181222417Sjulian\ 
182222417Sjulian\ 	NAME        DESCRIPTION
183222417Sjulian\ 	beastie     Color ``Helper Daemon'' mascot (19 rows x 34 columns)
184222417Sjulian\ 	beastiebw   B/W ``Helper Daemon'' mascot (19 rows x 34 columns)
185222417Sjulian\ 	fbsdbw      "FreeBSD" logo in B/W (13 rows x 21 columns)
186254237Sdteske\ 	orb         Color ``Orb'' mascot (15 rows x 30 columns) (2nd default)
187254105Sdteske\ 	orbbw       B/W ``Orb'' mascot (15 rows x 32 columns)
188254237Sdteske\ 	tribute     Color ``Tribute'' (must fit 19 rows x 34 columns) (default)
189254237Sdteske\ 	tributebw   B/W ``Tribute'' (must fit 19 rows x 34 columns)
190222417Sjulian\ 
191222417Sjulian\ NOTE: Setting `loader_logo' to an undefined value (such as "none") will
192222417Sjulian\       prevent beastie from being drawn.
193222417Sjulian\ 
194222417Sjulian: draw-beastie ( -- ) \ at (loader_logo_x,loader_logo_y), else (46,4)
195222417Sjulian
196222417Sjulian	s" loader_logo_x" getenv dup -1 <> if
197222417Sjulian		?number 1 = if logoX ! then
198138258Sscottl	else
199138258Sscottl		drop
200115410Sscottl	then
201222417Sjulian	s" loader_logo_y" getenv dup -1 <> if
202222417Sjulian		?number 1 = if logoY ! then
203222417Sjulian	else
204222417Sjulian		drop
205222417Sjulian	then
206115410Sscottl
207222417Sjulian	s" loader_logo" getenv dup -1 = if
208222417Sjulian		logoX @ logoY @
209222417Sjulian		loader_color? if
210254942Sdteske			orb-logo
211115410Sscottl		else
212254942Sdteske			orbbw-logo
213115410Sscottl		then
214222417Sjulian		drop exit
215115410Sscottl	then
216222417Sjulian
217222417Sjulian	2dup s" beastie" compare-insensitive 0= if
218222417Sjulian		logoX @ logoY @ beastie-logo
219222417Sjulian		2drop exit
220222417Sjulian	then
221222417Sjulian	2dup s" beastiebw" compare-insensitive 0= if
222222417Sjulian		logoX @ logoY @ beastiebw-logo
223222417Sjulian		2drop exit
224222417Sjulian	then
225222417Sjulian	2dup s" fbsdbw" compare-insensitive 0= if
226222417Sjulian		logoX @ logoY @ fbsdbw-logo
227222417Sjulian		2drop exit
228222417Sjulian	then
229222417Sjulian	2dup s" orb" compare-insensitive 0= if
230222417Sjulian		logoX @ logoY @ orb-logo
231222417Sjulian		2drop exit
232222417Sjulian	then
233222417Sjulian	2dup s" orbbw" compare-insensitive 0= if
234222417Sjulian		logoX @ logoY @ orbbw-logo
235222417Sjulian		2drop exit
236222417Sjulian	then
237254237Sdteske	2dup s" tribute" compare-insensitive 0= if
238254237Sdteske		logoX @ logoY @
239254237Sdteske		s" tribute-logo" sfind if
240254237Sdteske			execute
241254237Sdteske		else
242254942Sdteske			drop orb-logo
243254237Sdteske		then
244254237Sdteske		2drop exit
245254237Sdteske	then
246254237Sdteske	2dup s" tributebw" compare-insensitive 0= if
247254237Sdteske		logoX @ logoY @
248254237Sdteske		s" tributebw-logo" sfind if
249254237Sdteske			execute
250254237Sdteske		else
251254942Sdteske			drop orbbw-logo
252254237Sdteske		then
253254237Sdteske		2drop exit
254254237Sdteske	then
255222417Sjulian
256222417Sjulian	2drop
257115410Sscottl;
258115410Sscottl
259222417Sjulian: clear-beastie ( -- ) \ clears beastie from the screen
260222417Sjulian	logoX @ logoY @
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 1+		2dup at-xy 34 spaces 1+
269222417Sjulian	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
270222417Sjulian	2dup at-xy 34 spaces		2drop
271222417Sjulian
272222417Sjulian	\ Put the cursor back at the bottom
273222417Sjulian	0 25 at-xy
274115410Sscottl;
275115410Sscottl
276222417Sjulian: beastie-start ( -- ) \ starts the menu
277116175Sscottl	s" beastie_disable" getenv
278116175Sscottl	dup -1 <> if
279116175Sscottl		s" YES" compare-insensitive 0= if
280257650Sdteske			any_conf_read? if
281257650Sdteske				load_kernel
282257650Sdteske				load_modules
283257650Sdteske			then
284257650Sdteske			exit \ to autoboot (default)
285116175Sscottl		then
286138258Sscottl	else
287138258Sscottl		drop
288116175Sscottl	then
289222417Sjulian
290222417Sjulian	s" loader_delay" getenv
291222417Sjulian	-1 = if
292222417Sjulian		s" include /boot/menu.rc" evaluate
293222417Sjulian	else
294115410Sscottl		drop
295222417Sjulian		." Loading Menu (Ctrl-C to Abort)" cr
296222417Sjulian		s" set delay_command='include /boot/menu.rc'" evaluate
297222417Sjulian		s" set delay_showdots" evaluate
298222417Sjulian		delay_execute
299115410Sscottl	then
300115410Sscottl;
301257650Sdteske
302257650Sdteskeonly forth also
303