Annotation of elwix/config/boot/beastie.4th, revision 1.4

1.2       misho       1: \ Copyright (c) 2003 Scott Long <scottl@freebsd.org>
                      2: \ Copyright (c) 2003 Aleksander Fafula <alex@fafula.com>
1.4     ! misho       3: \ Copyright (c) 2006-2013 Devin Teske <dteske@FreeBSD.org>
1.2       misho       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: \ 
1.4     ! misho      27: \ $FreeBSD: head/sys/boot/forth/beastie.4th 265028 2014-04-27 22:18:33Z dteske $
        !            28: \
        !            29: \ $Id: beastie.4th,v 1.3.12.6 2014/07/01 19:36:35 misho Exp $
1.2       misho      30: 
                     31: marker task-beastie.4th
                     32: 
1.4     ! misho      33: only forth definitions also support-functions
1.2       misho      34: 
                     35: variable logoX
                     36: variable logoY
                     37: 
                     38: \ Initialize logo placement to defaults
                     39: 46 logoX !
                     40: 4  logoY !
                     41: 
                     42: : beastie-logo ( x y -- ) \ color BSD mascot (19 rows x 34 columns)
                     43: 
                     44: 2dup at-xy ."               ,        ," 1+
                     45: 2dup at-xy ."              /(        )`" 1+
                     46: 2dup at-xy ."              \ \___   / |" 1+
                     47: 2dup at-xy ."              /- _  `-/  '" 1+
                     48: 2dup at-xy ."             (/\/ \ \   /\" 1+
                     49: 2dup at-xy ."             / /   | `    \" 1+
                     50: 2dup at-xy ."             O O   ) /    |" 1+
                     51: 2dup at-xy ."             `-^--'`<     '" 1+
                     52: 2dup at-xy ."            (_.)  _  )   /" 1+
                     53: 2dup at-xy ."             `.___/`    /" 1+
                     54: 2dup at-xy ."               `-----' /" 1+
                     55: 2dup at-xy ."  <----.     __ / __   \" 1+
                     56: 2dup at-xy ."  <----|====O)))==) \) /====|" 1+
                     57: 2dup at-xy ."  <----'    `--' `.__,' \" 1+
                     58: 2dup at-xy ."               |        |" 1+
                     59: 2dup at-xy ."                \       /       /\" 1+
                     60: 2dup at-xy ."           ______( (_  / \______/" 1+
                     61: 2dup at-xy ."         ,'  ,-----'   |" 1+
                     62:      at-xy ."         `--{__________)"
                     63: 
                     64:        \ Put the cursor back at the bottom
                     65:        0 25 at-xy
                     66: ;
                     67: 
                     68: : beastiebw-logo ( x y -- ) \ B/W BSD mascot (19 rows x 34 columns)
                     69: 
                     70:        2dup at-xy ."               ,        ," 1+
                     71:        2dup at-xy ."              /(        )`" 1+
                     72:        2dup at-xy ."              \ \___   / |" 1+
                     73:        2dup at-xy ."              /- _  `-/  '" 1+
                     74:        2dup at-xy ."             (/\/ \ \   /\" 1+
                     75:        2dup at-xy ."             / /   | `    \" 1+
                     76:        2dup at-xy ."             O O   ) /    |" 1+
                     77:        2dup at-xy ."             `-^--'`<     '" 1+
                     78:        2dup at-xy ."            (_.)  _  )   /" 1+
                     79:        2dup at-xy ."             `.___/`    /" 1+
                     80:        2dup at-xy ."               `-----' /" 1+
                     81:        2dup at-xy ."  <----.     __ / __   \" 1+
                     82:        2dup at-xy ."  <----|====O)))==) \) /====|" 1+
                     83:        2dup at-xy ."  <----'    `--' `.__,' \" 1+
                     84:        2dup at-xy ."               |        |" 1+
                     85:        2dup at-xy ."                \       /       /\" 1+
                     86:        2dup at-xy ."           ______( (_  / \______/" 1+
                     87:        2dup at-xy ."         ,'  ,-----'   |" 1+
                     88:             at-xy ."         `--{__________)"
                     89: 
                     90:        \ Put the cursor back at the bottom
                     91:        0 25 at-xy
                     92: ;
                     93: 
                     94: : fbsdbw-logo ( x y -- ) \ "FreeBSD" logo in B/W (13 rows x 21 columns)
                     95: 
                     96:        \ We used to use the beastie himself as our default... until the
                     97:        \ eventual complaint derided his reign of the advanced boot-menu.
                     98:        \ 
                     99:        \ This is the replacement of beastie to satiate the haters of our
                    100:        \ beloved helper-daemon (ready to track down and spear bugs with
                    101:        \ his trident and sporty sneakers; see above).
                    102:        \ 
                    103:        \ Since we merely just changed the default and not the default-
                    104:        \ location, below is an adjustment to the passed-in coordinates,
                    105:        \ forever influenced by the proper location of beastie himself
                    106:        \ kept as the default loader_logo_x/loader_logo_y values.
                    107:        \ 
                    108:        5 + swap 6 + swap
                    109: 
                    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:        2dup at-xy ." | |_) |____) | |__| |" 1+
                    121:        2dup at-xy ." |     |      |      |" 1+
                    122:             at-xy ." |____/|_____/|_____/"
                    123: 
                    124:        \ Put the cursor back at the bottom
                    125:        0 25 at-xy
                    126: ;
                    127: 
                    128: : orb-logo ( x y -- ) \ color Orb mascot (15 rows x 30 columns)
                    129: 
                    130:        3 + \ beastie adjustment (see `fbsdbw-logo' comments above)
                    131: 
                    132:        2dup at-xy ."  ```                        `" 1+
                    133:        2dup at-xy ." s` `.....---.......--.```   -/" 1+
                    134:        2dup at-xy ." +o   .--`         /y:`      +." 1+
                    135:        2dup at-xy ."  yo`:.            :o      `+-" 1+
                    136:        2dup at-xy ."   y/               -/`   -o/" 1+
                    137:        2dup at-xy ."  .-                  ::/sy+:." 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:        2dup at-xy ."    `:`                  `:`" 1+
                    145:        2dup at-xy ."      .--             `--." 1+
                    146:             at-xy ."         .---.....----."
                    147: 
                    148:        \ Put the cursor back at the bottom
                    149:        0 25 at-xy
                    150: ;
                    151: 
                    152: : orbbw-logo ( x y -- ) \ B/W Orb mascot (15 rows x 32 columns)
                    153: 
                    154:        3 + \ beastie adjustment (see `fbsdbw-logo' comments above)
                    155: 
                    156:        2dup at-xy ."  ```                        `" 1+
                    157:        2dup at-xy ." s` `.....---.......--.```   -/" 1+
                    158:        2dup at-xy ." +o   .--`         /y:`      +." 1+
                    159:        2dup at-xy ."  yo`:.            :o      `+-" 1+
                    160:        2dup at-xy ."   y/               -/`   -o/" 1+
                    161:        2dup at-xy ."  .-                  ::/sy+:." 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:        2dup at-xy ."    `:`                  `:`" 1+
                    169:        2dup at-xy ."      .--             `--." 1+
                    170:             at-xy ."         .---.....----."
                    171: 
                    172:        \ Put the cursor back at the bottom
                    173:        0 25 at-xy
                    174: ;
                    175: 
                    176: : elwixbw-logo ( x y -- ) \ B/W ELWIX mascot (15 rows x 32 columns)
                    177: 
1.4     ! misho     178:        3 + \ elwix adjustment (see `fbsdbw-logo' comments above)
        !           179: 
1.2       misho     180:        2dup at-xy ."           .l:  .k              " 1+
                    181:        2dup at-xy ."             .k:0              ." 1+
                    182:        2dup at-xy ."              :WK            ,dc" 1+
                    183:        2dup at-xy ." .            oWWK        .ld,  " 1+
                    184:        2dup at-xy ." :`           cWWW,     .xo.    " 1+
                    185:        2dup at-xy ." ':::.        OWWWW.  ,Od.      " 1+
                    186:        2dup at-xy ."    .,lodc`   KWWWWO:0o         " 1+
                    187:        2dup at-xy ."         .:oxxXWWWWWc           " 1+
                    188:        2dup at-xy ."             .xWWWWWoc.         " 1+
                    189:        2dup at-xy ."           :xx:.WWWW. ,cc`      " 1+
                    190:        2dup at-xy ."        `dx:    :WWM.    .cc:   " 1+
                    191:        2dup at-xy ."      ld:        .d;         o: " 1+
                    192:        2dup at-xy ."     d`                       `x" 1+
                    193:        2dup at-xy ."    cl                          " 1+
                    194:             at-xy ."  * Embedded LightWeight unIX * "
                    195: 
                    196:        \ Put the cursor back at the bottom
                    197:        0 25 at-xy
                    198: ;
                    199: 
                    200: \ This function draws any number of beastie logos at (loader_logo_x,
                    201: \ loader_logo_y) if defined, else (46,4) (to the right of the menu). To choose
                    202: \ your beastie, set the variable `loader_logo' to the respective logo name.
                    203: \ 
                    204: \ Currently available:
                    205: \ 
                    206: \      NAME        DESCRIPTION
                    207: \      beastie     Color ``Helper Daemon'' mascot (19 rows x 34 columns)
                    208: \      beastiebw   B/W ``Helper Daemon'' mascot (19 rows x 34 columns)
                    209: \      fbsdbw      "FreeBSD" logo in B/W (13 rows x 21 columns)
1.4     ! misho     210: \      orb         Color ``Orb'' mascot (15 rows x 30 columns) (2nd default)
        !           211: \      orbbw       B/W ``Orb'' mascot (15 rows x 32 columns)
        !           212: \      tribute     Color ``Tribute'' (must fit 19 rows x 34 columns) (default)
        !           213: \      tributebw   B/W ``Tribute'' (must fit 19 rows x 34 columns)
1.2       misho     214: \      elwixbw     B/W ``ELWIX'' mascot (19 rows x 34 columns)
                    215: \ 
                    216: \ NOTE: Setting `loader_logo' to an undefined value (such as "none") will
                    217: \       prevent beastie from being drawn.
                    218: \ 
                    219: : draw-beastie ( -- ) \ at (loader_logo_x,loader_logo_y), else (46,4)
                    220: 
                    221:        s" loader_logo_x" getenv dup -1 <> if
                    222:                ?number 1 = if logoX ! then
                    223:        else
                    224:                drop
                    225:        then
                    226:        s" loader_logo_y" getenv dup -1 <> if
                    227:                ?number 1 = if logoY ! then
                    228:        else
                    229:                drop
                    230:        then
                    231: 
1.4     ! misho     232:        s" loader_logo" getenv dup -1 <> if
        !           233:                dup 5 + allocate if ENOMEM throw then
        !           234:                0 2swap strcat s" -logo" strcat
        !           235:                over -rot ( a-addr/u -- a-addr a-addr/u )
        !           236:                sfind     ( a-addr a-addr/u -- a-addr xt bool )
        !           237:                rot       ( a-addr xt bool -- xt bool a-addr )
        !           238:                free      ( xt bool a-addr -- xt bool ior )
        !           239:                if EFREE throw then
        !           240:        else
        !           241:                0 ( cruft -- cruft bool ) \ load the default below
        !           242:        then
        !           243:        0= if
        !           244:                drop ( cruft -- )
1.2       misho     245:                loader_color? if
1.4     ! misho     246:                        ['] elwixbw-logo
1.2       misho     247:                else
1.4     ! misho     248:                        ['] elwixbw-logo
1.2       misho     249:                then
                    250:        then
1.4     ! misho     251:        logoX @ logoY @ rot execute
1.2       misho     252: ;
                    253: 
                    254: : clear-beastie ( -- ) \ clears beastie from the screen
                    255:        logoX @ logoY @
                    256:        2dup at-xy 34 spaces 1+         2dup at-xy 34 spaces 1+
                    257:        2dup at-xy 34 spaces 1+         2dup at-xy 34 spaces 1+
                    258:        2dup at-xy 34 spaces 1+         2dup at-xy 34 spaces 1+
                    259:        2dup at-xy 34 spaces 1+         2dup at-xy 34 spaces 1+
                    260:        2dup at-xy 34 spaces 1+         2dup at-xy 34 spaces 1+
                    261:        2dup at-xy 34 spaces 1+         2dup at-xy 34 spaces 1+
                    262:        2dup at-xy 34 spaces 1+         2dup at-xy 34 spaces 1+
                    263:        2dup at-xy 34 spaces 1+         2dup at-xy 34 spaces 1+
                    264:        2dup at-xy 34 spaces 1+         2dup at-xy 34 spaces 1+
                    265:        2dup at-xy 34 spaces            2drop
                    266: 
                    267:        \ Put the cursor back at the bottom
                    268:        0 25 at-xy
                    269: ;
                    270: 
                    271: : beastie-start ( -- ) \ starts the menu
1.4     ! misho     272:        s" console" getenv dup -1 <> if
        !           273:                s" efi" 2swap contains? if
        !           274:                        s" set beastie_disable=YES" evaluate
        !           275:                then
        !           276:        else drop then
1.2       misho     277:        s" beastie_disable" getenv
                    278:        dup -1 <> if
                    279:                s" YES" compare-insensitive 0= if
1.4     ! misho     280:                        any_conf_read? if
        !           281:                                load_kernel
        !           282:                                load_modules
        !           283:                        then
        !           284:                        exit \ to autoboot (default)
1.2       misho     285:                then
                    286:        else
                    287:                drop
                    288:        then
                    289: 
                    290:        s" loader_delay" getenv
                    291:        -1 = if
                    292:                s" include /boot/menu.rc" evaluate
                    293:        else
                    294:                drop
                    295:                ." Loading Menu (Ctrl-C to Abort)" cr
                    296:                s" set delay_command='include /boot/menu.rc'" evaluate
                    297:                s" set delay_showdots" evaluate
                    298:                delay_execute
                    299:        then
                    300: ;
1.4     ! misho     301: 
        !           302: only forth also

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