1280924Sdteske\ Copyright (c) 2003 Scott Long <scottl@FreeBSD.org>
2120031Sscottl\ Copyright (c) 2003 Aleksander Fafula <alex@fafula.com>
3280923Sdteske\ 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/11.0/sys/boot/forth/beastie.4th 293234 2016-01-06 15:50:21Z emaste $
28115410Sscottl
29115410Sscottlmarker task-beastie.4th
30115410Sscottl
31280937Sdteskeonly forth definitions
32257650Sdteske
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\ 
44280933Sdteske\ NOTE: Each is defined as a logo function in /boot/logo-${loader_logo}.4th
45280933Sdteske\ NOTE: If `/boot/logo-${loader_logo}.4th' does not exist or does not define
46280933Sdteske\       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
52280923Sdteske	else drop then
53222417Sjulian	s" loader_logo_y" getenv dup -1 <> if
54222417Sjulian		?number 1 = if logoY ! then
55280923Sdteske	else drop then
56115410Sscottl
57280933Sdteske
58280933Sdteske	\ If `logo' is defined, execute it
59280933Sdteske	s" logo" sfind ( -- xt|0 bool ) if
60280933Sdteske		logoX @ logoY @ rot execute
61258269Sdteske	else
62280933Sdteske		\ Not defined; try-include desired logo file
63280933Sdteske		drop ( xt = 0 ) \ cruft
64280933Sdteske		s" loader_logo" getenv dup -1 = over 0= or if
65280933Sdteske			dup 0= if 2drop else drop then \ getenv result unused
66280933Sdteske			loader_color? if
67280933Sdteske				s" try-include /boot/logo-orb.4th"
68280933Sdteske			else
69280933Sdteske				s" try-include /boot/logo-orbbw.4th"
70280933Sdteske			then
71115410Sscottl		else
72280933Sdteske			2drop ( c-addr/u -- ) \ getenv result unused
73280933Sdteske			s" try-include /boot/logo-${loader_logo}.4th"
74115410Sscottl		then
75280933Sdteske		evaluate
76280933Sdteske		1 spaces
77280933Sdteske
78280933Sdteske		\ Execute `logo' if defined now
79280933Sdteske		s" logo" sfind if
80280933Sdteske			logoX @ logoY @ rot execute
81280933Sdteske		else drop then
82115410Sscottl	then
83115410Sscottl;
84115410Sscottl
85280937Sdteskealso support-functions
86280937Sdteske
87222417Sjulian: beastie-start ( -- ) \ starts the menu
88280923Sdteske	s" beastie_disable" getenv dup -1 <> if
89116175Sscottl		s" YES" compare-insensitive 0= if
90257650Sdteske			any_conf_read? if
91277215Sroyger				load_xen_throw
92257650Sdteske				load_kernel
93257650Sdteske				load_modules
94257650Sdteske			then
95257650Sdteske			exit \ to autoboot (default)
96116175Sscottl		then
97280923Sdteske	else drop then
98222417Sjulian
99280923Sdteske	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;
109257650Sdteske
110280937Sdteskeonly forth definitions
111