brand.4th revision 280923
1280923Sdteske\ Copyright (c) 2006-2015 Devin Teske <dteske@FreeBSD.org>
2222417Sjulian\ All rights reserved.
3222417Sjulian\ 
4222417Sjulian\ Redistribution and use in source and binary forms, with or without
5222417Sjulian\ modification, are permitted provided that the following conditions
6222417Sjulian\ are met:
7222417Sjulian\ 1. Redistributions of source code must retain the above copyright
8222417Sjulian\    notice, this list of conditions and the following disclaimer.
9222417Sjulian\ 2. Redistributions in binary form must reproduce the above copyright
10222417Sjulian\    notice, this list of conditions and the following disclaimer in the
11222417Sjulian\    documentation and/or other materials provided with the distribution.
12222417Sjulian\ 
13222417Sjulian\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14222417Sjulian\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15222417Sjulian\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16222417Sjulian\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17222417Sjulian\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18222417Sjulian\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19222417Sjulian\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20222417Sjulian\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21222417Sjulian\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22222417Sjulian\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23222417Sjulian\ SUCH DAMAGE.
24222417Sjulian\ 
25222417Sjulian\ $FreeBSD: head/sys/boot/forth/brand.4th 280923 2015-03-31 22:10:40Z dteske $
26222417Sjulian
27222417Sjulianmarker task-brand.4th
28222417Sjulian
29222417Sjulianvariable brandX
30222417Sjulianvariable brandY
31222417Sjulian
32222417Sjulian\ Initialize logo placement
33222417Sjulian2 brandX !
34222417Sjulian1 brandY !
35222417Sjulian
36278335Sdteske: fbsd-logo ( x y -- ) \ "FreeBSD" [wide] logo in B/W (7 rows x 42 columns)
37222417Sjulian
38222417Sjulian	2dup at-xy ."  ______               ____   _____ _____  " 1+
39222417Sjulian	2dup at-xy ." |  ____|             |  _ \ / ____|  __ \ " 1+
40222417Sjulian	2dup at-xy ." | |___ _ __ ___  ___ | |_) | (___ | |  | |" 1+
41222417Sjulian	2dup at-xy ." |  ___| '__/ _ \/ _ \|  _ < \___ \| |  | |" 1+
42222417Sjulian	2dup at-xy ." | |   | | |  __/  __/| |_) |____) | |__| |" 1+
43278335Sdteske	2dup at-xy ." | |   | | |    |    ||     |      |      |" 1+
44222417Sjulian	     at-xy ." |_|   |_|  \___|\___||____/|_____/|_____/ "
45222417Sjulian
46222417Sjulian	\ Put the cursor back at the bottom
47222417Sjulian	0 25 at-xy
48222417Sjulian;
49222417Sjulian
50222417Sjulian\ This function draws any number of company logos at (loader_brand_x,
51222417Sjulian\ loader_brand_y) if defined, or (2,1) (top-left) if not defined. To choose
52222417Sjulian\ your logo, set the variable `loader_brand' to the respective logo name.
53222417Sjulian\ 
54222417Sjulian\ Currently available:
55222417Sjulian\
56222417Sjulian\ 	NAME        DESCRIPTION
57222417Sjulian\ 	fbsd        FreeBSD logo
58222417Sjulian\ 
59266938Srodrigc\ NOTE: Setting `loader_brand' to the value of an existing function
60266938Srodrigc\       (such as "mycustom-brand") will cause that symbol to be executed.
61222417Sjulian\ NOTE: Setting `loader_brand' to an undefined value (such as "none") will
62222417Sjulian\       prevent any brand from being drawn.
63222417Sjulian\ 
64222417Sjulian: draw-brand ( -- )
65222417Sjulian
66222417Sjulian	s" loader_brand_x" getenv dup -1 <> if
67280923Sdteske		?number 1 = if brandX ! then
68280923Sdteske	else drop then
69222417Sjulian 	s" loader_brand_y" getenv dup -1 <> if
70280923Sdteske 		?number 1 = if brandY ! then
71280923Sdteske 	else drop then
72222417Sjulian
73222417Sjulian	s" loader_brand" getenv dup -1 = if
74222417Sjulian		brandX @ brandY @ fbsd-logo
75222417Sjulian		drop exit
76222417Sjulian	then
77222417Sjulian
78222417Sjulian	2dup s" fbsd" compare-insensitive 0= if
79222417Sjulian		brandX @ brandY @ fbsd-logo
80222417Sjulian		2drop exit
81222417Sjulian	then
82222417Sjulian
83266938Srodrigc        \ if it refers to a raw symbol then run that function
84266938Srodrigc        sfind if
85266938Srodrigc            brandX @ brandY @
86266938Srodrigc            2 roll
87266938Srodrigc            execute
88266938Srodrigc        else            
89266938Srodrigc            drop
90266938Srodrigc        then
91266938Srodrigc
92222417Sjulian	2drop
93222417Sjulian;
94