xref: /freebsd/share/examples/bootforth/menuconf.4th (revision 8ac94f5119b6c534c7aedbbaea80d44a6e07227e)
13a91f98cSDaniel C. Sobral\ Simple greeting screen, presenting basic options.
23a91f98cSDaniel C. Sobral\ XXX This is far too trivial - I don't have time now to think
33a91f98cSDaniel C. Sobral\ XXX about something more fancy... :-/
47f3dea24SPeter Wemm\ $FreeBSD$
53a91f98cSDaniel C. Sobral
63a91f98cSDaniel C. Sobral: title
73a91f98cSDaniel C. Sobral	f_single
83a91f98cSDaniel C. Sobral	60 11 10 4 box
93a91f98cSDaniel C. Sobral	29 4 at-xy 15 fg 7 bg
103a91f98cSDaniel C. Sobral	." Welcome to BootFORTH!"
113a91f98cSDaniel C. Sobral	me
123a91f98cSDaniel C. Sobral;
133a91f98cSDaniel C. Sobral
143a91f98cSDaniel C. Sobral: menu
153a91f98cSDaniel C. Sobral	2 fg
163a91f98cSDaniel C. Sobral	20 7 at-xy
1701d33617SDaniel C. Sobral	." 1.  Start FreeBSD with /boot/stable.conf."
183a91f98cSDaniel C. Sobral        20 8 at-xy
1901d33617SDaniel C. Sobral        ." 2.  Start FreeBSD with /boot/current.conf."
203a91f98cSDaniel C. Sobral	20 9 at-xy
2101d33617SDaniel C. Sobral	." 3.  Start FreeBSD with standard configuration. "
223a91f98cSDaniel C. Sobral	20 10 at-xy
233a91f98cSDaniel C. Sobral	." 4.  Reboot."
243a91f98cSDaniel C. Sobral	me
253a91f98cSDaniel C. Sobral;
263a91f98cSDaniel C. Sobral
273a91f98cSDaniel C. Sobral: tkey	( d -- flag | char )
283a91f98cSDaniel C. Sobral	seconds +
293a91f98cSDaniel C. Sobral	begin 1 while
303a91f98cSDaniel C. Sobral	    dup seconds u< if
313a91f98cSDaniel C. Sobral		drop
323a91f98cSDaniel C. Sobral		-1
333a91f98cSDaniel C. Sobral		exit
343a91f98cSDaniel C. Sobral	    then
353a91f98cSDaniel C. Sobral	    key? if
363a91f98cSDaniel C. Sobral		drop
373a91f98cSDaniel C. Sobral		key
383a91f98cSDaniel C. Sobral		exit
393a91f98cSDaniel C. Sobral	    then
403a91f98cSDaniel C. Sobral	repeat
413a91f98cSDaniel C. Sobral;
423a91f98cSDaniel C. Sobral
433a91f98cSDaniel C. Sobral: prompt
443a91f98cSDaniel C. Sobral	14 fg
453a91f98cSDaniel C. Sobral	20 12 at-xy
463a91f98cSDaniel C. Sobral	." Enter your option (1,2,3,4): "
473a91f98cSDaniel C. Sobral	10 tkey
483a91f98cSDaniel C. Sobral	dup 32 = if
493a91f98cSDaniel C. Sobral	    drop key
503a91f98cSDaniel C. Sobral	then
513a91f98cSDaniel C. Sobral	dup 0< if
523a91f98cSDaniel C. Sobral	    drop 51
533a91f98cSDaniel C. Sobral	then
543a91f98cSDaniel C. Sobral	dup emit
553a91f98cSDaniel C. Sobral	me
563a91f98cSDaniel C. Sobral;
573a91f98cSDaniel C. Sobral
583a91f98cSDaniel C. Sobral: help_text
593a91f98cSDaniel C. Sobral        10 18 at-xy ." * Choose 1 or 2 to run special configuration file."
603a91f98cSDaniel C. Sobral	10 19 at-xy ." * Choose 3 to proceed with standard bootstrapping."
613a91f98cSDaniel C. Sobral	12 20 at-xy ." See '?' for available commands, and 'words' for"
623a91f98cSDaniel C. Sobral	12 21 at-xy ." complete list of Forth words."
633a91f98cSDaniel C. Sobral	10 22 at-xy ." * Choose 4 in order to warm boot your machine."
643a91f98cSDaniel C. Sobral;
653a91f98cSDaniel C. Sobral
663a91f98cSDaniel C. Sobral: (reboot) 0 reboot ;
673a91f98cSDaniel C. Sobral
683a91f98cSDaniel C. Sobral: main_menu
693a91f98cSDaniel C. Sobral	begin 1 while
703a91f98cSDaniel C. Sobral		clear
713a91f98cSDaniel C. Sobral		f_double
723a91f98cSDaniel C. Sobral		79 23 1 1 box
733a91f98cSDaniel C. Sobral		title
743a91f98cSDaniel C. Sobral		menu
753a91f98cSDaniel C. Sobral		help_text
763a91f98cSDaniel C. Sobral		prompt
773a91f98cSDaniel C. Sobral		cr cr cr
783a91f98cSDaniel C. Sobral		dup 49 = if
793a91f98cSDaniel C. Sobral			drop
803a91f98cSDaniel C. Sobral			1 25 at-xy cr
813a91f98cSDaniel C. Sobral			." Loading /boot/stable.conf. Please wait..." cr
823a91f98cSDaniel C. Sobral			s" /boot/stable.conf" read-conf
838ac94f51SDaniel C. Sobral			0 boot-conf exit
843a91f98cSDaniel C. Sobral		then
853a91f98cSDaniel C. Sobral		dup 50 = if
863a91f98cSDaniel C. Sobral			drop
873a91f98cSDaniel C. Sobral			1 25 at-xy cr
883a91f98cSDaniel C. Sobral			." Loading /boot/current.conf. Please wait..." cr
893a91f98cSDaniel C. Sobral			s" /boot/current.conf" read-conf
908ac94f51SDaniel C. Sobral			0 boot-conf exit
913a91f98cSDaniel C. Sobral		then
923a91f98cSDaniel C. Sobral		dup 51 = if
933a91f98cSDaniel C. Sobral			drop
943a91f98cSDaniel C. Sobral			1 25 at-xy cr
953a91f98cSDaniel C. Sobral			." Proceeding with standard boot. Please wait..." cr
968ac94f51SDaniel C. Sobral			0 boot-conf exit
973a91f98cSDaniel C. Sobral		then
983a91f98cSDaniel C. Sobral		dup 52 = if
993a91f98cSDaniel C. Sobral			drop
1003a91f98cSDaniel C. Sobral			1 25 at-xy cr
1013a91f98cSDaniel C. Sobral			['] (reboot) catch abort" Error rebooting"
1023a91f98cSDaniel C. Sobral		then
1033a91f98cSDaniel C. Sobral		20 12 at-xy
1043a91f98cSDaniel C. Sobral		." Key " emit ."  is not a valid option!"
1053a91f98cSDaniel C. Sobral		20 13 at-xy
1063a91f98cSDaniel C. Sobral		." Press any key to continue..."
1073a91f98cSDaniel C. Sobral		key drop
1083a91f98cSDaniel C. Sobral	repeat
1093a91f98cSDaniel C. Sobral;
1103a91f98cSDaniel C. Sobral
111