xref: /freebsd/share/examples/bootforth/menuconf.4th (revision 26a58599a09a6181e0f5abe624021865a0c23186)
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... :-/
43a91f98cSDaniel C. Sobral
53a91f98cSDaniel C. Sobral: title
63a91f98cSDaniel C. Sobral	f_single
73a91f98cSDaniel C. Sobral	60 11 10 4 box
83a91f98cSDaniel C. Sobral	29 4 at-xy 15 fg 7 bg
93a91f98cSDaniel C. Sobral	." Welcome to BootFORTH!"
103a91f98cSDaniel C. Sobral	me
113a91f98cSDaniel C. Sobral;
123a91f98cSDaniel C. Sobral
133a91f98cSDaniel C. Sobral: menu
143a91f98cSDaniel C. Sobral	2 fg
153a91f98cSDaniel C. Sobral	20 7 at-xy
1601d33617SDaniel C. Sobral	." 1.  Start FreeBSD with /boot/stable.conf."
173a91f98cSDaniel C. Sobral        20 8 at-xy
1801d33617SDaniel C. Sobral        ." 2.  Start FreeBSD with /boot/current.conf."
193a91f98cSDaniel C. Sobral	20 9 at-xy
2001d33617SDaniel C. Sobral	." 3.  Start FreeBSD with standard configuration. "
213a91f98cSDaniel C. Sobral	20 10 at-xy
223a91f98cSDaniel C. Sobral	." 4.  Reboot."
233a91f98cSDaniel C. Sobral	me
243a91f98cSDaniel C. Sobral;
253a91f98cSDaniel C. Sobral
263a91f98cSDaniel C. Sobral: tkey	( d -- flag | char )
273a91f98cSDaniel C. Sobral	seconds +
283a91f98cSDaniel C. Sobral	begin 1 while
293a91f98cSDaniel C. Sobral	    dup seconds u< if
303a91f98cSDaniel C. Sobral		drop
313a91f98cSDaniel C. Sobral		-1
323a91f98cSDaniel C. Sobral		exit
333a91f98cSDaniel C. Sobral	    then
343a91f98cSDaniel C. Sobral	    key? if
353a91f98cSDaniel C. Sobral		drop
363a91f98cSDaniel C. Sobral		key
373a91f98cSDaniel C. Sobral		exit
383a91f98cSDaniel C. Sobral	    then
393a91f98cSDaniel C. Sobral	repeat
403a91f98cSDaniel C. Sobral;
413a91f98cSDaniel C. Sobral
423a91f98cSDaniel C. Sobral: prompt
433a91f98cSDaniel C. Sobral	14 fg
443a91f98cSDaniel C. Sobral	20 12 at-xy
453a91f98cSDaniel C. Sobral	." Enter your option (1,2,3,4): "
463a91f98cSDaniel C. Sobral	10 tkey
473a91f98cSDaniel C. Sobral	dup 32 = if
483a91f98cSDaniel C. Sobral	    drop key
493a91f98cSDaniel C. Sobral	then
503a91f98cSDaniel C. Sobral	dup 0< if
513a91f98cSDaniel C. Sobral	    drop 51
523a91f98cSDaniel C. Sobral	then
533a91f98cSDaniel C. Sobral	dup emit
543a91f98cSDaniel C. Sobral	me
553a91f98cSDaniel C. Sobral;
563a91f98cSDaniel C. Sobral
573a91f98cSDaniel C. Sobral: help_text
583a91f98cSDaniel C. Sobral        10 18 at-xy ." * Choose 1 or 2 to run special configuration file."
593a91f98cSDaniel C. Sobral	10 19 at-xy ." * Choose 3 to proceed with standard bootstrapping."
603a91f98cSDaniel C. Sobral	12 20 at-xy ." See '?' for available commands, and 'words' for"
613a91f98cSDaniel C. Sobral	12 21 at-xy ." complete list of Forth words."
623a91f98cSDaniel C. Sobral	10 22 at-xy ." * Choose 4 in order to warm boot your machine."
633a91f98cSDaniel C. Sobral;
643a91f98cSDaniel C. Sobral
653a91f98cSDaniel C. Sobral: (reboot) 0 reboot ;
663a91f98cSDaniel C. Sobral
673a91f98cSDaniel C. Sobral: main_menu
683a91f98cSDaniel C. Sobral	begin 1 while
693a91f98cSDaniel C. Sobral		clear
703a91f98cSDaniel C. Sobral		f_double
713a91f98cSDaniel C. Sobral		79 23 1 1 box
723a91f98cSDaniel C. Sobral		title
733a91f98cSDaniel C. Sobral		menu
743a91f98cSDaniel C. Sobral		help_text
753a91f98cSDaniel C. Sobral		prompt
763a91f98cSDaniel C. Sobral		cr cr cr
773a91f98cSDaniel C. Sobral		dup 49 = if
783a91f98cSDaniel C. Sobral			drop
793a91f98cSDaniel C. Sobral			1 25 at-xy cr
803a91f98cSDaniel C. Sobral			." Loading /boot/stable.conf. Please wait..." cr
813a91f98cSDaniel C. Sobral			s" /boot/stable.conf" read-conf
828ac94f51SDaniel C. Sobral			0 boot-conf exit
833a91f98cSDaniel C. Sobral		then
843a91f98cSDaniel C. Sobral		dup 50 = if
853a91f98cSDaniel C. Sobral			drop
863a91f98cSDaniel C. Sobral			1 25 at-xy cr
873a91f98cSDaniel C. Sobral			." Loading /boot/current.conf. Please wait..." cr
883a91f98cSDaniel C. Sobral			s" /boot/current.conf" read-conf
898ac94f51SDaniel C. Sobral			0 boot-conf exit
903a91f98cSDaniel C. Sobral		then
913a91f98cSDaniel C. Sobral		dup 51 = if
923a91f98cSDaniel C. Sobral			drop
933a91f98cSDaniel C. Sobral			1 25 at-xy cr
943a91f98cSDaniel C. Sobral			." Proceeding with standard boot. Please wait..." cr
958ac94f51SDaniel C. Sobral			0 boot-conf exit
963a91f98cSDaniel C. Sobral		then
973a91f98cSDaniel C. Sobral		dup 52 = if
983a91f98cSDaniel C. Sobral			drop
993a91f98cSDaniel C. Sobral			1 25 at-xy cr
1003a91f98cSDaniel C. Sobral			['] (reboot) catch abort" Error rebooting"
1013a91f98cSDaniel C. Sobral		then
1023a91f98cSDaniel C. Sobral		20 12 at-xy
1033a91f98cSDaniel C. Sobral		." Key " emit ."  is not a valid option!"
1043a91f98cSDaniel C. Sobral		20 13 at-xy
1053a91f98cSDaniel C. Sobral		." Press any key to continue..."
1063a91f98cSDaniel C. Sobral		key drop
1073a91f98cSDaniel C. Sobral	repeat
1083a91f98cSDaniel C. Sobral;
1093a91f98cSDaniel C. Sobral
110