File:  [ELWIX - Embedded LightWeight unIX -] / elwix / config / boot / Attic / beastie.4th
Revision 1.2.6.1: download - view: text, annotated - select for diffs - revision graph
Sun Jan 27 22:15:08 2013 UTC (11 years, 5 months ago) by misho
Branches: elwix1_7
Diff to: branchpoint 1.2: preferred, unified
patch freebsd forth part of boot

    1: \ Copyright (c) 2003 Scott Long <scottl@freebsd.org>
    2: \ Copyright (c) 2003 Aleksander Fafula <alex@fafula.com>
    3: \ Copyright (c) 2006-2011 Devin Teske <devinteske@hotmail.com>
    4: \ All rights reserved.
    5: \ 
    6: \ Redistribution and use in source and binary forms, with or without
    7: \ modification, are permitted provided that the following conditions
    8: \ are met:
    9: \ 1. Redistributions of source code must retain the above copyright
   10: \    notice, this list of conditions and the following disclaimer.
   11: \ 2. Redistributions in binary form must reproduce the above copyright
   12: \    notice, this list of conditions and the following disclaimer in the
   13: \    documentation and/or other materials provided with the distribution.
   14: \ 
   15: \ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   16: \ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   17: \ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   18: \ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   19: \ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   20: \ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   21: \ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   22: \ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   23: \ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   24: \ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   25: \ SUCH DAMAGE.
   26: \ 
   27: \ $FreeBSD: src/sys/boot/forth/beastie.4th,v 1.21 2012/11/17 01:51:16 svnexp Exp $
   28: 
   29: marker task-beastie.4th
   30: 
   31: include /boot/delay.4th
   32: 
   33: variable logoX
   34: variable logoY
   35: 
   36: \ Initialize logo placement to defaults
   37: 46 logoX !
   38: 4  logoY !
   39: 
   40: : beastie-logo ( x y -- ) \ color BSD mascot (19 rows x 34 columns)
   41: 
   42: 2dup at-xy ."               ,        ," 1+
   43: 2dup at-xy ."              /(        )`" 1+
   44: 2dup at-xy ."              \ \___   / |" 1+
   45: 2dup at-xy ."              /- _  `-/  '" 1+
   46: 2dup at-xy ."             (/\/ \ \   /\" 1+
   47: 2dup at-xy ."             / /   | `    \" 1+
   48: 2dup at-xy ."             O O   ) /    |" 1+
   49: 2dup at-xy ."             `-^--'`<     '" 1+
   50: 2dup at-xy ."            (_.)  _  )   /" 1+
   51: 2dup at-xy ."             `.___/`    /" 1+
   52: 2dup at-xy ."               `-----' /" 1+
   53: 2dup at-xy ."  <----.     __ / __   \" 1+
   54: 2dup at-xy ."  <----|====O)))==) \) /====|" 1+
   55: 2dup at-xy ."  <----'    `--' `.__,' \" 1+
   56: 2dup at-xy ."               |        |" 1+
   57: 2dup at-xy ."                \       /       /\" 1+
   58: 2dup at-xy ."           ______( (_  / \______/" 1+
   59: 2dup at-xy ."         ,'  ,-----'   |" 1+
   60:      at-xy ."         `--{__________)"
   61: 
   62: 	\ Put the cursor back at the bottom
   63: 	0 25 at-xy
   64: ;
   65: 
   66: : beastiebw-logo ( x y -- ) \ B/W BSD mascot (19 rows x 34 columns)
   67: 
   68: 	2dup at-xy ."               ,        ," 1+
   69: 	2dup at-xy ."              /(        )`" 1+
   70: 	2dup at-xy ."              \ \___   / |" 1+
   71: 	2dup at-xy ."              /- _  `-/  '" 1+
   72: 	2dup at-xy ."             (/\/ \ \   /\" 1+
   73: 	2dup at-xy ."             / /   | `    \" 1+
   74: 	2dup at-xy ."             O O   ) /    |" 1+
   75: 	2dup at-xy ."             `-^--'`<     '" 1+
   76: 	2dup at-xy ."            (_.)  _  )   /" 1+
   77: 	2dup at-xy ."             `.___/`    /" 1+
   78: 	2dup at-xy ."               `-----' /" 1+
   79: 	2dup at-xy ."  <----.     __ / __   \" 1+
   80: 	2dup at-xy ."  <----|====O)))==) \) /====|" 1+
   81: 	2dup at-xy ."  <----'    `--' `.__,' \" 1+
   82: 	2dup at-xy ."               |        |" 1+
   83: 	2dup at-xy ."                \       /       /\" 1+
   84: 	2dup at-xy ."           ______( (_  / \______/" 1+
   85: 	2dup at-xy ."         ,'  ,-----'   |" 1+
   86: 	     at-xy ."         `--{__________)"
   87: 
   88: 	\ Put the cursor back at the bottom
   89: 	0 25 at-xy
   90: ;
   91: 
   92: : fbsdbw-logo ( x y -- ) \ "FreeBSD" logo in B/W (13 rows x 21 columns)
   93: 
   94: 	\ We used to use the beastie himself as our default... until the
   95: 	\ eventual complaint derided his reign of the advanced boot-menu.
   96: 	\ 
   97: 	\ This is the replacement of beastie to satiate the haters of our
   98: 	\ beloved helper-daemon (ready to track down and spear bugs with
   99: 	\ his trident and sporty sneakers; see above).
  100: 	\ 
  101: 	\ Since we merely just changed the default and not the default-
  102: 	\ location, below is an adjustment to the passed-in coordinates,
  103: 	\ forever influenced by the proper location of beastie himself
  104: 	\ kept as the default loader_logo_x/loader_logo_y values.
  105: 	\ 
  106: 	5 + swap 6 + swap
  107: 
  108: 	2dup at-xy ."  ______" 1+
  109: 	2dup at-xy ." |  ____| __ ___  ___ " 1+
  110: 	2dup at-xy ." | |__ | '__/ _ \/ _ \" 1+
  111: 	2dup at-xy ." |  __|| | |  __/  __/" 1+
  112: 	2dup at-xy ." | |   | | |    |    |" 1+
  113: 	2dup at-xy ." |_|   |_|  \___|\___|" 1+
  114: 	2dup at-xy ."  ____   _____ _____" 1+
  115: 	2dup at-xy ." |  _ \ / ____|  __ \" 1+
  116: 	2dup at-xy ." | |_) | (___ | |  | |" 1+
  117: 	2dup at-xy ." |  _ < \___ \| |  | |" 1+
  118: 	2dup at-xy ." | |_) |____) | |__| |" 1+
  119: 	2dup at-xy ." |     |      |      |" 1+
  120: 	     at-xy ." |____/|_____/|_____/"
  121: 
  122: 	\ Put the cursor back at the bottom
  123: 	0 25 at-xy
  124: ;
  125: 
  126: : orb-logo ( x y -- ) \ color Orb mascot (15 rows x 30 columns)
  127: 
  128: 	3 + \ beastie adjustment (see `fbsdbw-logo' comments above)
  129: 
  130: 	2dup at-xy ."  ```                        `" 1+
  131: 	2dup at-xy ." s` `.....---.......--.```   -/" 1+
  132: 	2dup at-xy ." +o   .--`         /y:`      +." 1+
  133: 	2dup at-xy ."  yo`:.            :o      `+-" 1+
  134: 	2dup at-xy ."   y/               -/`   -o/" 1+
  135: 	2dup at-xy ."  .-                  ::/sy+:." 1+
  136: 	2dup at-xy ."  /                     `--  /" 1+
  137: 	2dup at-xy ." `:                          :`" 1+
  138: 	2dup at-xy ." `:                          :`" 1+
  139: 	2dup at-xy ."  /                          /" 1+
  140: 	2dup at-xy ."  .-                        -." 1+
  141: 	2dup at-xy ."   --                      -." 1+
  142: 	2dup at-xy ."    `:`                  `:`" 1+
  143: 	2dup at-xy ."      .--             `--." 1+
  144: 	     at-xy ."         .---.....----."
  145: 
  146:  	\ Put the cursor back at the bottom
  147:  	0 25 at-xy
  148: ;
  149: 
  150: : orbbw-logo ( x y -- ) \ B/W Orb mascot (15 rows x 32 columns)
  151: 
  152: 	3 + \ beastie adjustment (see `fbsdbw-logo' comments above)
  153: 
  154: 	2dup at-xy ."  ```                        `" 1+
  155: 	2dup at-xy ." s` `.....---.......--.```   -/" 1+
  156: 	2dup at-xy ." +o   .--`         /y:`      +." 1+
  157: 	2dup at-xy ."  yo`:.            :o      `+-" 1+
  158: 	2dup at-xy ."   y/               -/`   -o/" 1+
  159: 	2dup at-xy ."  .-                  ::/sy+:." 1+
  160: 	2dup at-xy ."  /                     `--  /" 1+
  161: 	2dup at-xy ." `:                          :`" 1+
  162: 	2dup at-xy ." `:                          :`" 1+
  163: 	2dup at-xy ."  /                          /" 1+
  164: 	2dup at-xy ."  .-                        -." 1+
  165: 	2dup at-xy ."   --                      -." 1+
  166: 	2dup at-xy ."    `:`                  `:`" 1+
  167: 	2dup at-xy ."      .--             `--." 1+
  168: 	     at-xy ."         .---.....----."
  169: 
  170:  	\ Put the cursor back at the bottom
  171:  	0 25 at-xy
  172: ;
  173: 
  174: : elwixbw-logo ( x y -- ) \ B/W ELWIX mascot (15 rows x 32 columns)
  175: 
  176: 	2dup at-xy ."           .l:  .k              " 1+
  177: 	2dup at-xy ."             .k:0              ." 1+
  178: 	2dup at-xy ."              :WK            ,dc" 1+
  179: 	2dup at-xy ." .            oWWK        .ld,  " 1+
  180: 	2dup at-xy ." :`           cWWW,     .xo.    " 1+
  181: 	2dup at-xy ." ':::.        OWWWW.  ,Od.      " 1+
  182: 	2dup at-xy ."    .,lodc`   KWWWWO:0o         " 1+
  183: 	2dup at-xy ."         .:oxxXWWWWWc           " 1+
  184: 	2dup at-xy ."             .xWWWWWoc.         " 1+
  185: 	2dup at-xy ."           :xx:.WWWW. ,cc`      " 1+
  186: 	2dup at-xy ."        `dx:    :WWM.    .cc:   " 1+
  187: 	2dup at-xy ."      ld:        .d;         o: " 1+
  188: 	2dup at-xy ."     d`                       `x" 1+
  189: 	2dup at-xy ."    cl                          " 1+
  190: 	     at-xy ."  * Embedded LightWeight unIX * "
  191: 
  192: 	\ Put the cursor back at the bottom
  193: 	0 25 at-xy
  194: ;
  195: 
  196: \ This function draws any number of beastie logos at (loader_logo_x,
  197: \ loader_logo_y) if defined, else (46,4) (to the right of the menu). To choose
  198: \ your beastie, set the variable `loader_logo' to the respective logo name.
  199: \ 
  200: \ Currently available:
  201: \ 
  202: \ 	NAME        DESCRIPTION
  203: \ 	beastie     Color ``Helper Daemon'' mascot (19 rows x 34 columns)
  204: \ 	beastiebw   B/W ``Helper Daemon'' mascot (19 rows x 34 columns)
  205: \ 	fbsdbw      "FreeBSD" logo in B/W (13 rows x 21 columns)
  206: \ 	orb         Color ``Orb'' mascot (15 rows x 30 columns)
  207: \ 	orbbw       B/W ``Orb'' mascot (15 rows x 32 columns) (default)
  208: \ 	elwixbw     B/W ``ELWIX'' mascot (19 rows x 34 columns)
  209: \ 
  210: \ NOTE: Setting `loader_logo' to an undefined value (such as "none") will
  211: \       prevent beastie from being drawn.
  212: \ 
  213: : draw-beastie ( -- ) \ at (loader_logo_x,loader_logo_y), else (46,4)
  214: 
  215: 	s" loader_logo_x" getenv dup -1 <> if
  216: 		?number 1 = if logoX ! then
  217: 	else
  218: 		drop
  219: 	then
  220: 	s" loader_logo_y" getenv dup -1 <> if
  221: 		?number 1 = if logoY ! then
  222: 	else
  223: 		drop
  224: 	then
  225: 
  226: 	s" loader_logo" getenv dup -1 = if
  227: 		logoX @ logoY @
  228: 		loader_color? if
  229: 			elwixbw-logo
  230: 		else
  231: 			elwixbw-logo
  232: 		then
  233: 		drop exit
  234: 	then
  235: 
  236: 	2dup s" beastie" compare-insensitive 0= if
  237: 		logoX @ logoY @ beastie-logo
  238: 		2drop exit
  239: 	then
  240: 	2dup s" beastiebw" compare-insensitive 0= if
  241: 		logoX @ logoY @ beastiebw-logo
  242: 		2drop exit
  243: 	then
  244: 	2dup s" fbsdbw" compare-insensitive 0= if
  245: 		logoX @ logoY @ fbsdbw-logo
  246: 		2drop exit
  247: 	then
  248: 	2dup s" orb" compare-insensitive 0= if
  249: 		logoX @ logoY @ orb-logo
  250: 		2drop exit
  251: 	then
  252: 	2dup s" orbbw" compare-insensitive 0= if
  253: 		logoX @ logoY @ orbbw-logo
  254: 		2drop exit
  255: 	then
  256: 	2dup s" elwixbw" compare-insensitive 0= if
  257: 		logoX @ logoY @ elwixbw-logo
  258: 		2drop exit
  259: 	then
  260: 
  261: 	2drop
  262: ;
  263: 
  264: : clear-beastie ( -- ) \ clears beastie from the screen
  265: 	logoX @ logoY @
  266: 	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
  267: 	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
  268: 	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
  269: 	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
  270: 	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
  271: 	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
  272: 	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
  273: 	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
  274: 	2dup at-xy 34 spaces 1+		2dup at-xy 34 spaces 1+
  275: 	2dup at-xy 34 spaces		2drop
  276: 
  277: 	\ Put the cursor back at the bottom
  278: 	0 25 at-xy
  279: ;
  280: 
  281: : beastie-start ( -- ) \ starts the menu
  282: 	s" beastie_disable" getenv
  283: 	dup -1 <> if
  284: 		s" YES" compare-insensitive 0= if
  285: 			exit
  286: 		then
  287: 	else
  288: 		drop
  289: 	then
  290: 
  291: 	s" loader_delay" getenv
  292: 	-1 = if
  293: 		s" include /boot/menu.rc" evaluate
  294: 	else
  295: 		drop
  296: 		." Loading Menu (Ctrl-C to Abort)" cr
  297: 		s" set delay_command='include /boot/menu.rc'" evaluate
  298: 		s" set delay_showdots" evaluate
  299: 		delay_execute
  300: 	then
  301: ;

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>