beastie.4th revision 115410
1115410Sscottl\ Copyright (c) 2003 Scott Long <scottl@freebsd.org> 2115410Sscottl\ All rights reserved. 3115410Sscottl\ 4115410Sscottl\ Redistribution and use in source and binary forms, with or without 5115410Sscottl\ modification, are permitted provided that the following conditions 6115410Sscottl\ are met: 7115410Sscottl\ 1. Redistributions of source code must retain the above copyright 8115410Sscottl\ notice, this list of conditions and the following disclaimer. 9115410Sscottl\ 2. Redistributions in binary form must reproduce the above copyright 10115410Sscottl\ notice, this list of conditions and the following disclaimer in the 11115410Sscottl\ documentation and/or other materials provided with the distribution. 12115410Sscottl\ 13115410Sscottl\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14115410Sscottl\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15115410Sscottl\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16115410Sscottl\ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17115410Sscottl\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18115410Sscottl\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19115410Sscottl\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20115410Sscottl\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21115410Sscottl\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22115410Sscottl\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23115410Sscottl\ SUCH DAMAGE. 24115410Sscottl\ 25115410Sscottl\ $FreeBSD: head/sys/boot/forth/beastie.4th 115410 2003-05-30 09:29:24Z scottl $ 26115410Sscottl 27115410Sscottlmarker task-beastie.4th 28115410Sscottl 29115410Sscottlinclude /boot/screen.4th 30115410Sscottlinclude /boot/frames.4th 31115410Sscottl 32115410Sscottlhide 33115410Sscottl 34115410Sscottlvariable menuidx 35115410Sscottlvariable menubllt 36115410Sscottlvariable menuX 37115410Sscottlvariable menuY 38115410Sscottlvariable promptwidth 39115410Sscottl 40115410Sscottlvariable bootkey 41115410Sscottlvariable bootacpikey 42115410Sscottlvariable bootsafekey 43115410Sscottlvariable bootverbosekey 44115410Sscottlvariable bootsinglekey 45115410Sscottlvariable escapekey 46115410Sscottlvariable rebootkey 47115410Sscottl 48115410Sscottl46 constant dot 49115410Sscottl 50115410Sscottl\ The BSD Daemon. He is 19 rows high and 34 columns wide 51115410Sscottl: print-beastie ( x y -- ) 52115410Sscottl 2dup at-xy ." , ," 1+ 53115410Sscottl 2dup at-xy ." /( )`" 1+ 54115410Sscottl 2dup at-xy ." \\ \\___ / |" 1+ 55115410Sscottl 2dup at-xy ." /- _ `-/ '" 1+ 56115410Sscottl 2dup at-xy ." (/\\/ \\ \\ /\\" 1+ 57115410Sscottl 2dup at-xy ." / / | ` \\" 1+ 58115410Sscottl 2dup at-xy ." O O ) / |" 1+ 59115410Sscottl 2dup at-xy ." `-^--'`< '" 1+ 60115410Sscottl 2dup at-xy ." (_.) _ ) /" 1+ 61115410Sscottl 2dup at-xy ." `.___/` /" 1+ 62115410Sscottl 2dup at-xy ." `-----' /" 1+ 63115410Sscottl 2dup at-xy ." <----. __ / __ \\" 1+ 64115410Sscottl 2dup at-xy ." <----|====O)))==) \\) /====" 1+ 65115410Sscottl 2dup at-xy ." <----' `--' `.__,' \\" 1+ 66115410Sscottl 2dup at-xy ." | |" 1+ 67115410Sscottl 2dup at-xy ." \\ / /\\" 1+ 68115410Sscottl 2dup at-xy ." ______( (_ / \\______/" 1+ 69115410Sscottl 2dup at-xy ." ,' ,-----' |" 1+ 70115410Sscottl at-xy ." `--{__________)" 71115410Sscottl; 72115410Sscottl 73115410Sscottl: acpienabled? ( -- flag ) 74115410Sscottl s" acpi_load" getenv 75115410Sscottl dup -1 = if 76115410Sscottl drop false exit 77115410Sscottl then 78115410Sscottl s" YES" compare-insensitive 0<> if 79115410Sscottl false exit 80115410Sscottl then 81115410Sscottl s" hint.acpi.0.disabled" getenv 82115410Sscottl dup -1 <> if 83115410Sscottl s" 0" compare 0<> if 84115410Sscottl false exit 85115410Sscottl then 86115410Sscottl then 87115410Sscottl true 88115410Sscottl; 89115410Sscottl 90115410Sscottl: printmenuitem ( -- n ) 91115410Sscottl menuidx @ 92115410Sscottl 1+ dup 93115410Sscottl menuidx ! 94115410Sscottl menuY @ + dup menuX @ swap at-xy 95115410Sscottl menuidx @ . 96115410Sscottl menuX @ 1+ swap at-xy 97115410Sscottl menubllt @ emit 98115410Sscottl menuidx @ 48 + 99115410Sscottl; 100115410Sscottl 101115410Sscottl: beastie-menu ( -- ) 102115410Sscottl 0 menuidx ! 103115410Sscottl dot menubllt ! 104115410Sscottl 8 menuY ! 105115410Sscottl 5 menuX ! 106115410Sscottl clear 107115410Sscottl 46 4 print-beastie 108115410Sscottl 42 20 2 2 box 109115410Sscottl 13 6 at-xy ." Welcome to FreeBSD!" 110115410Sscottl printmenuitem ." Boot FreeBSD [default]" bootkey ! 111115410Sscottl s" arch-i386" environment? if 112115410Sscottl printmenuitem ." Boot FreeBSD with ACPI " bootacpikey ! 113115410Sscottl acpienabled? if 114115410Sscottl ." disabled" 115115410Sscottl else 116115410Sscottl ." enabled" 117115410Sscottl then 118115410Sscottl else 119115410Sscottl -2 bootacpikey ! 120115410Sscottl then 121115410Sscottl printmenuitem ." Boot FreeBSD in Safe Mode" bootsafekey ! 122115410Sscottl printmenuitem ." Boot FreeBSD in single user mode" bootsinglekey ! 123115410Sscottl printmenuitem ." Boot FreeBSD with verbose logging" bootverbosekey ! 124115410Sscottl printmenuitem ." Escape to loader prompt" escapekey ! 125115410Sscottl printmenuitem ." Reboot" rebootkey ! 126115410Sscottl menuX @ 20 at-xy 127115410Sscottl ." Select option, [Enter] for default" 128115410Sscottl menuX @ 21 at-xy 129115410Sscottl s" or [Space] to pause timer " dup 2 - promptwidth ! 130115410Sscottl type 131115410Sscottl; 132115410Sscottl 133115410Sscottl: tkey 134115410Sscottl dup 135115410Sscottl seconds + 136115410Sscottl begin 1 while 137115410Sscottl over 0<> if 138115410Sscottl dup seconds u< if 139115410Sscottl drop 140115410Sscottl -1 141115410Sscottl exit 142115410Sscottl then 143115410Sscottl menuX @ promptwidth @ + 21 at-xy dup seconds - . 144115410Sscottl then 145115410Sscottl key? if 146115410Sscottl drop 147115410Sscottl key 148115410Sscottl exit 149115410Sscottl then 150115410Sscottl 50 ms 151115410Sscottl repeat 152115410Sscottl; 153115410Sscottl 154115410Sscottlset-current 155115410Sscottl 156115410Sscottl: beastie-start 157115410Sscottl beastie-menu 158115410Sscottl s" autoboot_delay" getenv 159115410Sscottl dup -1 = if 160115410Sscottl drop 161115410Sscottl 10 162115410Sscottl else 163115410Sscottl 0 0 2swap >number drop drop drop 164115410Sscottl then 165115410Sscottl begin true while 166115410Sscottl dup tkey 167115410Sscottl 0 25 at-xy 168115410Sscottl dup 32 = if nip 0 swap then 169115410Sscottl dup -1 = if s" boot" evaluate then 170115410Sscottl dup 13 = if s" boot" evaluate then 171115410Sscottl dup bootkey @ = if s" boot" evaluate then 172115410Sscottl dup bootacpikey @ = if 173115410Sscottl acpienabled? if 174115410Sscottl s" acpi_load" unsetenv 175115410Sscottl s" 1" s" hint.acpi.0.disabled" setenv 176115410Sscottl else 177115410Sscottl s" YES" s" acpi_load" setenv 178115410Sscottl s" 0" s" hint.acpi.0.disabled" setenv 179115410Sscottl then 180115410Sscottl s" boot" evaluate 181115410Sscottl then 182115410Sscottl dup bootsafekey @ = if 183115410Sscottl s" arch-i386" environment? if 184115410Sscottl s" acpi_load" unsetenv 185115410Sscottl s" 1" s" hint.acpi.0.disabled" setenv 186115410Sscottl then 187115410Sscottl s" 0" s" hw.ata.ata_dma" setenv 188115410Sscottl s" 0" s" hw.ata.atapi_dma" setenv 189115410Sscottl s" 0" s" hw.ata.wc" setenv 190115410Sscottl s" 0" s" hw.eisa_slots" setenv 191115410Sscottl s" boot" evaluate 192115410Sscottl then 193115410Sscottl dup bootverbosekey @ = if 194115410Sscottl s" YES" s" boot_verbose" setenv 195115410Sscottl s" boot" evaluate 196115410Sscottl then 197115410Sscottl dup bootsinglekey @ = if 198115410Sscottl s" YES" s" boot_single" setenv 199115410Sscottl s" boot" evaluate 200115410Sscottl then 201115410Sscottl dup escapekey @ = if 2drop exit then 202115410Sscottl rebootkey @ = if s" reboot" evaluate then 203115410Sscottl repeat 204115410Sscottl; 205115410Sscottl 206115410Sscottlprevious 207