xref: /freebsd/share/examples/bootforth/menu.4th (revision 2aebedc3ad9e722b272254e6dd3a12e399595e57)
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\ $Id$
5
6: title
7	f_single
8	60 11 10 4 box
9	29 4 at-xy 15 fg 7 bg
10	." Welcome to BootFORTH!"
11	me
12;
13
14: menu
15	2 fg
16	20 7 at-xy
17	." 1.  Start FreeBSD /kernel."
18	20 8 at-xy
19	." 2.  Interact with BootFORTH."
20	20 9 at-xy
21	." 3.  Reboot."
22	me
23;
24
25: prompt
26	14 fg
27	20 11 at-xy
28	." Enter your option (1,2,3): "
29	key
30	dup emit
31	me
32;
33
34: help_text
35	10 18 at-xy ." * Choose 1 if you just want to run FreeBSD."
36	10 19 at-xy ." * Choose 2 if you want to use bootloader facilities."
37	12 20 at-xy ." See '?' for available commands, and 'words' for"
38	12 21 at-xy ." complete list of Forth words."
39	10 22 at-xy ." * Choose 3 in order to warm boot your machine."
40;
41
42: main_menu
43	begin 1 while
44		clear
45		f_double
46		79 23 1 1 box
47		title
48		menu
49		help_text
50		prompt
51		cr cr cr
52		dup 49 = if
53			drop
54			1 25 at-xy cr
55			." Loading kernel. Please wait..." cr
56			boot
57		then
58		dup 50 = if
59			drop
60			1 25 at-xy cr
61			exit
62		then
63		dup 51 = if
64			drop
65			1 25 at-xy cr
66			reboot
67		then
68		20 12 at-xy
69		." Key " emit ."  is not a valid option!"
70		20 13 at-xy
71		." Press any key to continue..."
72		key drop
73	repeat
74;
75