[Midnightbsd-cvs] src [10218] trunk/sys/boot/forth: separate into multiple files
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sat Jun 2 10:38:38 EDT 2018
Revision: 10218
http://svnweb.midnightbsd.org/src/?rev=10218
Author: laffer1
Date: 2018-06-02 10:38:37 -0400 (Sat, 02 Jun 2018)
Log Message:
-----------
separate into multiple files
Modified Paths:
--------------
trunk/sys/boot/forth/beastie.4th
trunk/sys/boot/forth/brand.4th
Modified: trunk/sys/boot/forth/beastie.4th
===================================================================
--- trunk/sys/boot/forth/beastie.4th 2018-06-02 14:37:13 UTC (rev 10217)
+++ trunk/sys/boot/forth/beastie.4th 2018-06-02 14:38:37 UTC (rev 10218)
@@ -1,6 +1,6 @@
-\ Copyright (c) 2003 Scott Long <scottl at freebsd.org>
+\ Copyright (c) 2003 Scott Long <scottl at FreeBSD.org>
\ Copyright (c) 2003 Aleksander Fafula <alex at fafula.com>
-\ Copyright (c) 2006-2013 Devin Teske <dteske at FreeBSD.org>
+\ Copyright (c) 2006-2015 Devin Teske <dteske at FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -23,12 +23,13 @@
\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
\ SUCH DAMAGE.
-\
-\ $MidnightBSD$
+\
+\ $MidnightBSD$
+\ $FreeBSD: stable/10/sys/boot/forth/beastie.4th 294446 2016-01-20 16:59:37Z emaste $
marker task-beastie.4th
-only forth definitions also support-functions
+only forth definitions
variable logoX
variable logoY
@@ -37,297 +38,66 @@
46 logoX !
4 logoY !
-: beastie-logo ( x y -- ) \ color BSD mascot (19 rows x 34 columns)
-
-2dup at-xy ." [31m, ," 1+
-2dup at-xy ." /( )`" 1+
-2dup at-xy ." \ \___ / |" 1+
-2dup at-xy ." /- [37m_[31m `-/ '" 1+
-2dup at-xy ." ([37m/\/ \[31m \ /\" 1+
-2dup at-xy ." [37m/ / |[31m ` \" 1+
-2dup at-xy ." [34mO O [37m) [31m/ |" 1+
-2dup at-xy ." [37m`-^--'[31m`< '" 1+
-2dup at-xy ." (_.) _ ) /" 1+
-2dup at-xy ." `.___/` /" 1+
-2dup at-xy ." `-----' /" 1+
-2dup at-xy ." [33m<----.[31m __ / __ \" 1+
-2dup at-xy ." [33m<----|====[31mO)))[33m==[31m) \) /[33m====|" 1+
-2dup at-xy ." [33m<----'[31m `--' `.__,' \" 1+
-2dup at-xy ." | |" 1+
-2dup at-xy ." \ / /\" 1+
-2dup at-xy ." [36m______[31m( (_ / \______/" 1+
-2dup at-xy ." [36m,' ,-----' |" 1+
- at-xy ." `--{__________)[37m"
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
-: beastiebw-logo ( x y -- ) \ B/W BSD mascot (19 rows x 34 columns)
-
- 2dup at-xy ." , ," 1+
- 2dup at-xy ." /( )`" 1+
- 2dup at-xy ." \ \___ / |" 1+
- 2dup at-xy ." /- _ `-/ '" 1+
- 2dup at-xy ." (/\/ \ \ /\" 1+
- 2dup at-xy ." / / | ` \" 1+
- 2dup at-xy ." O O ) / |" 1+
- 2dup at-xy ." `-^--'`< '" 1+
- 2dup at-xy ." (_.) _ ) /" 1+
- 2dup at-xy ." `.___/` /" 1+
- 2dup at-xy ." `-----' /" 1+
- 2dup at-xy ." <----. __ / __ \" 1+
- 2dup at-xy ." <----|====O)))==) \) /====|" 1+
- 2dup at-xy ." <----' `--' `.__,' \" 1+
- 2dup at-xy ." | |" 1+
- 2dup at-xy ." \ / /\" 1+
- 2dup at-xy ." ______( (_ / \______/" 1+
- 2dup at-xy ." ,' ,-----' |" 1+
- at-xy ." `--{__________)"
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
-: mbsdbw-logo ( x y -- ) \ "MidnightBSD" logo in B/W (13 rows x 21 columns)
-
- \ We used to use the beastie himself as our default... until the
- \ eventual complaint derided his reign of the advanced boot-menu.
- \
- \ This is the replacement of beastie to satiate the haters of our
- \ beloved helper-daemon (ready to track down and spear bugs with
- \ his trident and sporty sneakers; see above).
- \
- \ Since we merely just changed the default and not the default-
- \ location, below is an adjustment to the passed-in coordinates,
- \ forever influenced by the proper location of beastie himself
- \ kept as the default loader_logo_x/loader_logo_y values.
- \
- 5 + swap 6 + swap
-
- 2dup at-xy ." " 1+
- 2dup at-xy ." " 1+
- 2dup at-xy ." " 1+
- 2dup at-xy ." " 1+
- 2dup at-xy ." " 1+
- 2dup at-xy ." Midnight " 1+
- 2dup at-xy ." ____ _____ _____" 1+
- 2dup at-xy ." | _ \ / ____| __ \" 1+
- 2dup at-xy ." | |_) | (___ | | | |" 1+
- 2dup at-xy ." | _ < \___ \| | | |" 1+
- 2dup at-xy ." | |_) |____) | |__| |" 1+
- 2dup at-xy ." | | | |" 1+
- at-xy ." |____/|_____/|_____/"
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
-: tribute-art ( x y -- ) \ see tribute[bw]-logo
-
- \ Disable the brand art (we're going to use that space)
- s" set loader_brand=none" evaluate
-
- \ Blank out the frame of the menu and move the title to left
- s" set loader_menu_title=" evaluate
- s" set loader_menu_frame=none" evaluate
-
- \ Move the menu to the center of the screen
- s" set loader_menu_x=26" evaluate
- s" set loader_menu_y=12" evaluate
- s" set loader_menu_timeout_x=21" evaluate
- s" set loader_menu_timeout_y=24" evaluate
-
- 2 - swap 39 - swap \ top-left (see `mbsdbw-logo' comments above)
-
- 2dup at-xy 11 spaces ." ,d b." 1+
- 2dup at-xy ." ,d88] [88b." 1+
- 2dup at-xy ." ,d888P" 34 emit ." ,d88b. " 34 emit ." Y888b." 1+
- 2dup at-xy ." , <888P" 34 emit ." ,dP" 34 emit ." ,db." 34 emit
- ." Yb. " 34 emit ." Y888> ," 1+
- 2dup at-xy ." <88b.~ ,d888 " 34 emit ." YP" 34 emit
- ." 888b. ~,d88>" 1+
- 2dup at-xy ." ," 34 emit ." Y888888P" 34 emit ." ,db.,db." 34 emit
- ." Y888888P" 34 emit ." ," 1+
- 2dup at-xy ." <88b." 34 emit ." YP" 34 emit ." _ " 34 emit
- ." YP" 34 emit 34 emit ." YP" 34 emit ." _ " 34 emit
- ." YP" 34 emit ." ,d88>" 1+
- 2dup at-xy ." " 34 emit ." Y88b.,dP Yb.,d88P" 34 emit 1+
- at-xy ." " 34 emit ." YP" 34 emit ." " 34 emit
- ." YP" 34 emit ." "
-;
-
-: tribute-text ( x y -- ) \ see tribute[bw]-logo
-
- swap 2 - swap \ beastie adjustment (see `mbsdbw-logo' comments above)
-
- 2dup at-xy ." CEO Workstation" 1+
- 1+
- 2dup at-xy ." Nakatomi Socrates MidnightBSD 0.9" 1+
- 2dup at-xy ." Z-Level Central Core" 1+
- 1+
- at-xy ." Preliminary Clearance Approved."
-;
-
-: tribute-logo ( x y -- ) \ color Socrates tribute (16 rows x 32 columns)
-
- \ Produce the tribute art in bright green
- 2dup at-xy ." [32;1m" 2dup tribute-art ." [37m"
-
- \ Produce the tribute text in regular green
- 2dup at-xy ." [32m" 2dup tribute-text ." [37m"
-
- \ Distinguish the ``Midnight'' in tribute-text
- 2 + swap 16 + swap at-xy ." Midnight"
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
-: tributebw-logo ( x y -- ) \ Socrates tribute (16 rows x 32 columns)
-
- \ Produce the tribute art and text
- 2dup tribute-art tribute-text
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
-: orb-logo ( x y -- ) \ color Orb mascot (15 rows x 30 columns)
-
- 3 + \ beastie adjustment (see `mbsdbw-logo' comments above)
-
- 2dup at-xy ." [31m``` [31;1m`[31m" 1+
- 2dup at-xy ." s` `.....---...[31;1m....--.``` -/[31m" 1+
- 2dup at-xy ." +o .--` [31;1m/y:` +.[31m" 1+
- 2dup at-xy ." yo`:. [31;1m:o `+-[31m" 1+
- 2dup at-xy ." y/ [31;1m-/` -o/[31m" 1+
- 2dup at-xy ." .- [31;1m::/sy+:.[31m" 1+
- 2dup at-xy ." / [31;1m`-- /[31m" 1+
- 2dup at-xy ." `: [31;1m:`[31m" 1+
- 2dup at-xy ." `: [31;1m:`[31m" 1+
- 2dup at-xy ." / [31;1m/[31m" 1+
- 2dup at-xy ." .- [31;1m-.[31m" 1+
- 2dup at-xy ." -- [31;1m-.[31m" 1+
- 2dup at-xy ." `:` [31;1m`:`" 1+
- 2dup at-xy ." [31;1m.-- `--." 1+
- at-xy ." .---.....----.[37m"
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
-: orbbw-logo ( x y -- ) \ B/W Orb mascot (15 rows x 32 columns)
-
- 3 + \ beastie adjustment (see `mbsdbw-logo' comments above)
-
- 2dup at-xy ." ;00#. " 1+
- 2dup at-xy ." 00. :0' " 1+
- 2dup at-xy ." 0 `0 :0 " 1+
- 2dup at-xy ." 0 #0 .0 " 1+
- 2dup at-xy ." 0 #0` +. " 1+
- 2dup at-xy ." 0 00 0 " 1+
- 2dup at-xy ." I #00 0 " 1+
- 2dup at-xy ." 0 000 + : " 1+
- 2dup at-xy ." 0 000 #0 : " 1+
- 2dup at-xy ." # 000' : #00 + " 1+
- 2dup at-xy ." .::000 .000# 0 " 1+
- 2dup at-xy ." 0 0000 000 0 " 1+
- 2dup at-xy ." ':`0000000,: 0 " 1+
- 2dup at-xy ." 0. 0000000 #: " 1+
- 2dup at-xy ." 0+ :+: 0: " 1+
- at-xy ." .00::+00 "
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
\ This function draws any number of beastie logos at (loader_logo_x,
\ loader_logo_y) if defined, else (46,4) (to the right of the menu). To choose
\ your beastie, set the variable `loader_logo' to the respective logo name.
\
-\ Currently available:
+\ NOTE: Each is defined as a logo function in /boot/logo-${loader_logo}.4th
+\ NOTE: If `/boot/logo-${loader_logo}.4th' does not exist or does not define
+\ a `logo' function, no beastie is drawn.
\
-\ NAME DESCRIPTION
-\ beastie Color ``Helper Daemon'' mascot (19 rows x 34 columns)
-\ beastiebw B/W ``Helper Daemon'' mascot (19 rows x 34 columns)
-\ mbsdbw "MidnightBSD" logo in B/W (13 rows x 21 columns)
-\ orb Color mascot (15 rows x 30 columns) (2nd default)
-\ orbbw B/W mascot (15 rows x 32 columns)
-\ tribute Color ``Tribute'' (must fit 19 rows x 34 columns) (default)
-\ tributebw B/W ``Tribute'' (must fit 19 rows x 34 columns)
-\
-\ NOTE: Setting `loader_logo' to an undefined value (such as "none") will
-\ prevent beastie from being drawn.
-\
: draw-beastie ( -- ) \ at (loader_logo_x,loader_logo_y), else (46,4)
s" loader_logo_x" getenv dup -1 <> if
?number 1 = if logoX ! then
- else
- drop
- then
+ else drop then
s" loader_logo_y" getenv dup -1 <> if
?number 1 = if logoY ! then
- else
- drop
- then
+ else drop then
- s" loader_logo" getenv dup -1 <> if
- dup 5 + allocate if ENOMEM throw then
- 0 2swap strcat s" -logo" strcat
- over -rot ( a-addr/u -- a-addr a-addr/u )
- sfind ( a-addr a-addr/u -- a-addr xt bool )
- rot ( a-addr xt bool -- xt bool a-addr )
- free ( xt bool a-addr -- xt bool ior )
- if EFREE throw then
+
+ \ If `logo' is defined, execute it
+ s" logo" sfind ( -- xt|0 bool ) if
+ logoX @ logoY @ rot execute
else
- 0 ( cruft -- cruft bool ) \ load the default below
- then
- 0= if
- drop ( cruft -- )
- loader_color? if
- ['] orb-logo
+ \ Not defined; try-include desired logo file
+ drop ( xt = 0 ) \ cruft
+ s" loader_logo" getenv dup -1 = over 0= or if
+ dup 0= if 2drop else drop then \ getenv result unused
+ loader_color? if
+ s" try-include /boot/logo-orb.4th"
+ else
+ s" try-include /boot/logo-orbbw.4th"
+ then
else
- ['] orbbw-logo
+ 2drop ( c-addr/u -- ) \ getenv result unused
+ s" try-include /boot/logo-${loader_logo}.4th"
then
+ evaluate
+ 1 spaces
+
+ \ Execute `logo' if defined now
+ s" logo" sfind if
+ logoX @ logoY @ rot execute
+ else drop then
then
- logoX @ logoY @ rot execute
;
-: clear-beastie ( -- ) \ clears beastie from the screen
- logoX @ logoY @
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 1+ 2dup at-xy 34 spaces 1+
- 2dup at-xy 34 spaces 2drop
+also support-functions
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
: beastie-start ( -- ) \ starts the menu
- s" beastie_disable" getenv
- dup -1 <> if
+ s" beastie_disable" getenv dup -1 <> if
s" YES" compare-insensitive 0= if
any_conf_read? if
+ load_xen_throw
load_kernel
load_modules
then
exit \ to autoboot (default)
then
- else
- drop
- then
+ else drop then
- s" loader_delay" getenv
- -1 = if
+ s" loader_delay" getenv -1 = if
s" include /boot/menu.rc" evaluate
else
drop
@@ -338,4 +108,4 @@
then
;
-only forth also
+only forth definitions
Modified: trunk/sys/boot/forth/brand.4th
===================================================================
--- trunk/sys/boot/forth/brand.4th 2018-06-02 14:37:13 UTC (rev 10217)
+++ trunk/sys/boot/forth/brand.4th 2018-06-02 14:38:37 UTC (rev 10218)
@@ -1,4 +1,4 @@
-\ Copyright (c) 2006-2011 Devin Teske <devinteske at hotmail.com>
+\ Copyright (c) 2006-2015 Devin Teske <dteske at FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -21,8 +21,9 @@
\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
\ SUCH DAMAGE.
-\
-\ $MidnightBSD$
+\
+\ $MidnightBSD$
+\ $FreeBSD: stable/10/sys/boot/forth/brand.4th 281843 2015-04-22 01:08:40Z dteske $
marker task-brand.4th
@@ -29,63 +30,46 @@
variable brandX
variable brandY
-\ Initialize logo placement
+\ Initialize brand placement to defaults
2 brandX !
1 brandY !
-: mbsd-logo ( x y -- ) \ "MidnightBSD" [wide] logo in B/W (7 rows x 42 columns)
-
- 2dup at-xy ." ____ _____ _____ " 1+
- 2dup at-xy ." | _ \ / ____| __ \ " 1+
- 2dup at-xy ." | |_) | (___ | | | |" 1+
- 2dup at-xy ." M i d n i g h t | _ < \___ \| | | |" 1+
- 2dup at-xy ." | |_) |____) | |__| |" 1+
- 2dup at-xy ." | | | |" 1+
- at-xy ." |____/|_____/|_____/ "
-
- \ Put the cursor back at the bottom
- 0 25 at-xy
-;
-
-\ This function draws any number of company logos at (loader_brand_x,
-\ loader_brand_y) if defined, or (2,1) (top-left) if not defined. To choose
-\ your logo, set the variable `loader_brand' to the respective logo name.
+\ This function draws any number of company brands at (loader_brand_x,
+\ loader_brand_y) if defined, or (2,1) (top-left). To choose your brand, set
+\ the variable `loader_brand' to the respective brand name.
\
-\ Currently available:
-\
-\ NAME DESCRIPTION
-\ mbsd MidnightBSD logo
+\ NOTE: Each is defined as a brand function in /boot/brand-${loader_brand}.4th
+\ NOTE: If `/boot/brand-${loader_brand}.4th' does not exist or does not define
+\ a `brand' function, no brand is drawn.
\
-\ NOTE: Setting `loader_brand' to an undefined value (such as "none") will
-\ prevent any brand from being drawn.
-\
-: draw-brand ( -- )
+: draw-brand ( -- ) \ at (loader_brand_x,loader_brand_y), else (2,1)
s" loader_brand_x" getenv dup -1 <> if
- ?number 1 = if
- brandX !
- then
+ ?number 1 = if brandX ! then
+ else drop then
+ s" loader_brand_y" getenv dup -1 <> if
+ ?number 1 = if brandY ! then
+ else drop then
+
+ \ If `brand' is defined, execute it
+ s" brand" sfind ( -- xt|0 bool ) if
+ brandX @ brandY @ rot execute
else
- drop
- then
-
- s" loader_brand_y" getenv dup -1 <> if
- ?number 1 = if
- brandY !
+ \ Not defined; try-include desired brand file
+ drop ( xt = 0 ) \ cruft
+ s" loader_brand" getenv dup -1 = over 0= or if
+ dup 0= if 2drop else drop then \ getenv result unused
+ s" try-include /boot/brand-mbsd.4th"
+ else
+ 2drop ( c-addr/u -- ) \ getenv result unused
+ s" try-include /boot/brand-${loader_brand}.4th"
then
- else
- drop
- then
+ evaluate
+ 1 spaces
- s" loader_brand" getenv dup -1 = if
- brandX @ brandY @ mbsd-logo
- drop exit
+ \ Execute `brand' if defined now
+ s" brand" sfind if
+ brandX @ brandY @ rot execute
+ else drop then
then
-
- 2dup s" mbsd" compare-insensitive 0= if
- brandX @ brandY @ mbsd-logo
- 2drop exit
- then
-
- 2drop
;
More information about the Midnightbsd-cvs
mailing list