1281843Sdteske\ Copyright (c) 2003 Scott Long <scottl@FreeBSD.org>
2120031Sscottl\ Copyright (c) 2003 Aleksander Fafula <alex@fafula.com>
3281843Sdteske\ Copyright (c) 2006-2015 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: releng/10.3/sys/boot/forth/beastie.4th 294446 2016-01-20 16:59:37Z emaste $
28115410Sscottl
29115410Sscottlmarker task-beastie.4th
30115410Sscottl
31281843Sdteskeonly forth definitions
32262701Sdteske
33222417Sjulianvariable logoX
34222417Sjulianvariable logoY
35115410Sscottl
36222417Sjulian\ Initialize logo placement to defaults
37222417Sjulian46 logoX !
38222417Sjulian4  logoY !
39115410Sscottl
40222417Sjulian\ This function draws any number of beastie logos at (loader_logo_x,
41222417Sjulian\ loader_logo_y) if defined, else (46,4) (to the right of the menu). To choose
42222417Sjulian\ your beastie, set the variable `loader_logo' to the respective logo name.
43222417Sjulian\ 
44281843Sdteske\ NOTE: Each is defined as a logo function in /boot/logo-${loader_logo}.4th
45281843Sdteske\ NOTE: If `/boot/logo-${loader_logo}.4th' does not exist or does not define
46281843Sdteske\       a `logo' function, no beastie is drawn.
47222417Sjulian\ 
48222417Sjulian: draw-beastie ( -- ) \ at (loader_logo_x,loader_logo_y), else (46,4)
49222417Sjulian
50222417Sjulian	s" loader_logo_x" getenv dup -1 <> if
51222417Sjulian		?number 1 = if logoX ! then
52281843Sdteske	else drop then
53222417Sjulian	s" loader_logo_y" getenv dup -1 <> if
54222417Sjulian		?number 1 = if logoY ! then
55281843Sdteske	else drop then
56115410Sscottl
57281843Sdteske
58281843Sdteske	\ If `logo' is defined, execute it
59281843Sdteske	s" logo" sfind ( -- xt|0 bool ) if
60281843Sdteske		logoX @ logoY @ rot execute
61262703Sdteske	else
62281843Sdteske		\ Not defined; try-include desired logo file
63281843Sdteske		drop ( xt = 0 ) \ cruft
64281843Sdteske		s" loader_logo" getenv dup -1 = over 0= or if
65281843Sdteske			dup 0= if 2drop else drop then \ getenv result unused
66281843Sdteske			loader_color? if
67281843Sdteske				s" try-include /boot/logo-orb.4th"
68281843Sdteske			else
69281843Sdteske				s" try-include /boot/logo-orbbw.4th"
70281843Sdteske			then
71115410Sscottl		else
72281843Sdteske			2drop ( c-addr/u -- ) \ getenv result unused
73281843Sdteske			s" try-include /boot/logo-${loader_logo}.4th"
74115410Sscottl		then
75281843Sdteske		evaluate
76281843Sdteske		1 spaces
77281843Sdteske
78281843Sdteske		\ Execute `logo' if defined now
79281843Sdteske		s" logo" sfind if
80281843Sdteske			logoX @ logoY @ rot execute
81281843Sdteske		else drop then
82115410Sscottl	then
83115410Sscottl;
84115410Sscottl
85281843Sdteskealso support-functions
86222417Sjulian
87222417Sjulian: beastie-start ( -- ) \ starts the menu
88281843Sdteske	s" beastie_disable" getenv dup -1 <> if
89116175Sscottl		s" YES" compare-insensitive 0= if
90262701Sdteske			any_conf_read? if
91294417Sroyger				load_xen_throw
92262701Sdteske				load_kernel
93262701Sdteske				load_modules
94262701Sdteske			then
95262701Sdteske			exit \ to autoboot (default)
96116175Sscottl		then
97281843Sdteske	else drop then
98222417Sjulian
99281843Sdteske	s" loader_delay" getenv -1 = if
100222417Sjulian		s" include /boot/menu.rc" evaluate
101222417Sjulian	else
102115410Sscottl		drop
103222417Sjulian		." Loading Menu (Ctrl-C to Abort)" cr
104222417Sjulian		s" set delay_command='include /boot/menu.rc'" evaluate
105222417Sjulian		s" set delay_showdots" evaluate
106222417Sjulian		delay_execute
107115410Sscottl	then
108115410Sscottl;
109262701Sdteske
110281843Sdteskeonly forth definitions
111