1\ Simple greeting screen, presenting basic options. 2\ XXX This is far too trivial - I don't have time now to think 3\ XXX about something more fancy... :-/ 4 5: title 6 f_single 7 60 11 10 4 box 8 29 4 at-xy 15 fg 7 bg 9 ." Welcome to BootFORTH!" 10 me 11; 12 13: menu 14 2 fg 15 20 7 at-xy 16 ." 1. Start FreeBSD /kernel." 17 20 8 at-xy 18 ." 2. Interact with BootFORTH." 19 20 9 at-xy 20 ." 3. Reboot." 21 me 22; 23 24: tkey ( d -- flag | char ) 25 seconds + 26 begin 1 while 27 dup seconds u< if 28 drop 29 -1 30 exit 31 then 32 key? if 33 drop 34 key 35 exit 36 then 37 repeat 38; 39 40: prompt 41 14 fg 42 20 11 at-xy 43 ." Enter your option (1,2,3): " 44 10 tkey 45 dup 32 = if 46 drop key 47 then 48 dup 0< if 49 drop 49 50 then 51 dup emit 52 me 53; 54 55: help_text 56 10 18 at-xy ." * Choose 1 if you just want to run FreeBSD." 57 10 19 at-xy ." * Choose 2 if you want to use bootloader facilities." 58 12 20 at-xy ." See '?' for available commands, and 'words' for" 59 12 21 at-xy ." complete list of Forth words." 60 10 22 at-xy ." * Choose 3 in order to warm boot your machine." 61; 62 63: (boot) 0 boot ; 64: (reboot) 0 reboot ; 65 66: main_menu 67 begin 1 while 68 clear 69 f_double 70 79 23 1 1 box 71 title 72 menu 73 help_text 74 prompt 75 cr cr cr 76 dup 49 = if 77 drop 78 1 25 at-xy cr 79 ." Loading kernel. Please wait..." cr 80 ['] (boot) catch abort" Error booting" 81 then 82 dup 50 = if 83 drop 84 1 25 at-xy cr 85 exit 86 then 87 dup 51 = if 88 drop 89 1 25 at-xy cr 90 ['] (reboot) catch abort" Error rebooting" 91 then 92 20 12 at-xy 93 ." Key " emit ." is not a valid option!" 94 20 13 at-xy 95 ." Press any key to continue..." 96 key drop 97 repeat 98; 99