Print this page
11581 'debug' loader option is a little obscure
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Rob Johnston <rob.johnston@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/boot/sys/boot/forth/menu.4th.man.txt
+++ new/usr/src/boot/sys/boot/forth/menu.4th.man.txt
1 1 () ()
2 2
3 3
4 4
5 5 Copyright (c) 2003 Scott Long <scottl@FreeBSD.org> Copyright (c) 2003
6 6 Aleksander Fafula <alex@fafula.com> Copyright (c) 2006-2015 Devin Teske
7 7 <dteske@FreeBSD.org> Copyright 2019 OmniOS Community Edition (OmniOSce)
8 8 Association. All rights reserved. Redistribution and use in source and
9 9 binary forms, with or without modification, are permitted provided that the
10 10 following conditions are met: 1. Redistributions of source code must retain
11 11 the above copyright notice, this list of conditions and the following
12 12 disclaimer. 2. Redistributions in binary form must reproduce the above
13 13 copyright notice, this list of conditions and the following disclaimer in
14 14 the documentation and/or other materials provided with the distribution.
15 15 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
16 16 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 17 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 18 DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
19 19 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 20 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 21 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 22 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 23 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 24 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 25
26 26 marker task-menu.4th
27 27
28 28 Frame drawing include /boot/forth/frames.4th
29 29
30 30 vocabulary menu-infrastructure vocabulary menu-namespace vocabulary menu-
31 31 command-helpers
32 32
33 33 only forth also menu-infrastructure definitions
34 34
35 35 f_double Set frames to double (see frames.4th). Replace with
36 36 f_single if you want single frames. 46 constant dot ASCII
37 37 definition of a period (in decimal)
38 38
39 39 5 constant menu_default_x default column position of timeout 10
40 40 constant menu_default_y default row position of timeout msg
41 41 4 constant menu_timeout_default_x default column position of timeout 23
42 42 constant menu_timeout_default_y default row position of timeout msg 10
43 43 constant menu_timeout_default default timeout (in seconds)
44 44
45 45 Customize the following values with care
46 46
47 47 1 constant menu_start Numerical prefix of first menu item dot constant
48 48 bullet Menu bullet (appears after numerical prefix)
49 49 5 constant menu_x Row position of the menu (from the top)
50 50 10 constant menu_y Column position of the menu (from left side)
51 51
52 52 Menu Appearance variable menuidx Menu item stack for number prefixes
53 53 variable menurow Menu item stack for positioning variable menubllt Menu
54 54 item bullet
55 55
56 56 Menu Positioning variable menuX Menu X offset (columns) variable menuY
57 57 Menu Y offset (rows)
58 58
59 59 Menu-item elements variable menurebootadded
60 60
61 61 Parsing of kernels into menu-items variable kernidx variable kernlen variable
62 62 kernmenuidx
63 63
64 64 Menu timer [count-down] variables variable menu_timeout_enabled timeout
65 65 state (internal use only) variable menu_time variable for tracking
66 66 the passage of time variable menu_timeout determined configurable
67 67 delay duration variable menu_timeout_x column position of timeout
68 68 message variable menu_timeout_y row position of timeout message
69 69
70 70 Containers for parsing kernels into menu-items create kerncapbuf 64 allot
71 71 create kerndefault 64 allot create kernelsbuf 256 allot
72 72
73 73 only forth also menu-namespace definitions
74 74
75 75 Menu-item key association/detection variable menukey1 variable menukey2
76 76 variable menukey3 variable menukey4 variable menukey5 variable menukey6
77 77 variable menukey7 variable menukey8 variable menureboot variable menuacpi
78 78 variable menuosconsole variable menuoptions variable menukernel
79 79
80 80 Menu initialization status variables variable init_state1 variable
81 81 init_state2 variable init_state3 variable init_state4 variable init_state5
82 82 variable init_state6 variable init_state7 variable init_state8
83 83
84 84 Boolean option status variables variable toggle_state1 variable toggle_state2
85 85 variable toggle_state3 variable toggle_state4 variable toggle_state5 variable
86 86 toggle_state6 variable toggle_state7 variable toggle_state8
87 87
88 88 Array option status variables variable cycle_state1 variable cycle_state2
89 89 variable cycle_state3 variable cycle_state4 variable cycle_state5 variable
90 90 cycle_state6 variable cycle_state7 variable cycle_state8
91 91
92 92 Containers for storing the initial caption text create init_text1 64 allot
93 93 create init_text2 64 allot create init_text3 64 allot create init_text4 64
94 94 allot create init_text5 64 allot create init_text6 64 allot create init_text7
95 95 64 allot create init_text8 64 allot
96 96
97 97 only forth definitions
98 98
99 99 : arch-i386? ( -- BOOL ) Returns TRUE (-1) on i386, FALSE (0) otherwise.
100 100 s" arch-i386" environment? dup if drop then ;
101 101
102 102 : acpipresent? ( -- flag ) Returns TRUE if ACPI is present, FALSE otherwise
103 103 s" hint.acpi.0.rsdp" getenv dup -1 = if drop false exit
104 104 then 2drop true ;
105 105
106 106 : acpienabled? ( -- flag ) Returns TRUE if ACPI is enabled, FALSE otherwise
107 107 s" hint.acpi.0.disabled" getenv dup -1 <> if s" 0" compare 0<>
108 108 if false exit then else drop then
109 109 true ;
110 110
111 111 : +c! ( N C-ADDR/U K -- C-ADDR/U ) 3 pick 3 pick ( n c-addr/u k -- n c-
112 112 addr/u k n c-addr ) rot + c! ( n c-addr/u k n c-addr -- n c-addr/u )
113 113 rot drop ( n c-addr/u -- c-addr/u ) ;
114 114
115 115 only forth also menu-namespace definitions
116 116
117 117 Forth variables : namespace ( C-ADDR/U N -- ) also menu-namespace +c!
118 118 evaluate previous ; : menukeyN ( N -- ADDR ) s" menukeyN" 7
119 119 namespace ; : init_stateN ( N -- ADDR ) s" init_stateN" 10 namespace ; :
120 120 toggle_stateN ( N -- ADDR ) s" toggle_stateN" 12 namespace ; : cycle_stateN
121 121 ( N -- ADDR ) s" cycle_stateN" 11 namespace ; : init_textN ( N -- C-ADDR
122 122 ) s" init_textN" 9 namespace ;
123 123
124 124 Environment variables : kernel[x] ( N -- C-ADDR/U ) s" kernel[x]"
125 125 7 +c! ; : menu_init[x] ( N -- C-ADDR/U ) s" menu_init[x]" 10 +c!
126 126 ; : menu_command[x] ( N -- C-ADDR/U ) s" menu_command[x]" 13 +c! ; :
127 127 menu_caption[x] ( N -- C-ADDR/U ) s" menu_caption[x]" 13 +c! ; :
128 128 ansi_caption[x] ( N -- C-ADDR/U ) s" ansi_caption[x]" 13 +c! ; :
129 129 menu_keycode[x] ( N -- C-ADDR/U ) s" menu_keycode[x]" 13 +c! ; :
130 130 toggled_text[x] ( N -- C-ADDR/U ) s" toggled_text[x]" 13 +c! ; :
131 131 toggled_ansi[x] ( N -- C-ADDR/U ) s" toggled_ansi[x]" 13 +c! ; :
132 132 menu_caption[x][y] ( N M -- C-ADDR/U ) s" menu_caption[x][y]" 16 +c! 13 +c! ;
133 133 : ansi_caption[x][y] ( N M -- C-ADDR/U ) s" ansi_caption[x][y]" 16 +c! 13 +c!
134 134 ;
135 135
136 136 also menu-infrastructure definitions
137 137
138 138 This function prints a menu item at menuX (row) and menuY (column), returns
139 139 the incremental decimal ASCII value associated with the menu item, and
140 140 increments the cursor position to the next row for the creation of the next
141 141 menu item. This function is called by the menu-create function. You need not
142 142 call it directly. : printmenuitem ( menu_item_str -- ascii_keycode )
143 143
144 144 loader_color? if [char] ^ escc! then
145 145
146 146 menurow dup @ 1+ swap ! ( increment menurow ) menuidx dup @ 1+ swap !
147 147 ( increment menuidx )
148 148
149 149 Calculate the menuitem row position menurow @ menuY @ +
150 150
151 151 Position the cursor at the menuitem position dup menuX @ swap at-xy
152 152
153 153 Print the value of menuidx loader_color? dup ( -- bool bool ) if
154 154 b then menuidx @ . if me then
155 155
156 156 Move the cursor forward 1 column dup menuX @ 1+ swap at-xy
157 157
158 158 menubllt @ emit Print the menu bullet using the emit function
159 159
160 160 Move the cursor to the 3rd column from the current position to
161 161 allow for a space between the numerical prefix and the text caption
162 162 menuX @ 3 + swap at-xy
163 163
164 164 Print the menu caption (we expect a string to be on the stack prior
165 165 to invoking this function) type
166 166
167 167 Here we will add the ASCII decimal of the numerical prefix to the
168 168 stack (decimal ASCII for `1' is 49) as a "return value" menuidx @ 48 + ;
169 169
170 170 : delim? ( C -- BOOL ) dup 32 = ( c -- c bool ) [sp] space
171 171 over 9 = or ( c bool -- c bool ) [ht] horizontal tab
172 172 over 10 = or ( c bool -- c bool ) [nl] newline over 13 = or
173 173 ( c bool -- c bool ) [cr] carriage return over [char] , =
174 174 or ( c bool -- c bool ) comma swap drop ( c bool -- bool )
175 175 return boolean ;
176 176
177 177 This function parses $kernels into variables that are used by the menu to
178 178 display which kernel to boot when the [overloaded] `boot' word is interpreted.
179 179 Used internally by menu-create, you need not (nor should you) call this
180 180 directly. : parse-kernels ( N -- ) kernidx kernidx ! ( n -- ) store
181 181 provided `x' value [char] 0 kernmenuidx ! initialize `y' value for
182 182 menu_caption[x][y]
183 183
184 184 Attempt to get a list of kernels, fall back to sensible default s"
185 185 kernels" getenv dup -1 = if drop ( cruft ) s" kernel
186 186 kernel.old" then ( -- c-addr/u )
187 187
188 188 Check to see if the user has altered $kernel by comparing it against
189 189 $kernel[N] where N is kernel_state (the actively displayed kernel).
190 190 s" kernel_state" evaluate @ 48 + s" kernel[N]" 7 +c! getenv dup -1
191 191 <> if s" kernel" getenv dup -1 = if drop ( cruft ) s"
192 192 " then 2swap 2over compare 0= if 2drop FALSE (
193 193 skip below conditional ) else User has changed $kernel
194 194 TRUE ( slurp in new value ) then else We haven't
195 195 yet parsed $kernels into $kernel[N] drop ( getenv cruft ) s"
196 196 kernel" getenv dup -1 = if drop ( cruft ) s" " then
197 197 TRUE ( slurp in initial value ) then ( c-addr/u -- c-addr/u c-
198 198 addr/u,-1 | 0 ) if slurp new value into kerndefault kerndefault
199 199 1+ 0 2swap strcat swap 1- c! then
200 200
201 201 Clear out existing parsed-kernels kernidx @ [char] 0 begin
202 202 dup kernel[x] unsetenv 2dup menu_caption[x][y] unsetenv
203 203 2dup ansi_caption[x][y] unsetenv 1+ dup [char] 8 > until
204 204 2drop
205 205
206 206 Step through the string until we find the end begin 0
207 207 kernlen ! initialize length of value
208 208
209 209 Skip leading whitespace and/or comma delimiters begin
210 210 dup 0<> if over c@ delim? ( c-addr/u -- c-
211 211 addr/u bool ) else false ( c-addr/u -- c-addr/u
212 212 bool ) then while 1- swap 1+ swap ( c-
213 213 addr/u -- c-addr'/u' ) repeat ( c-addr/u -- c-addr'/u' )
214 214
215 215 dup 0= if end of string while eating whitespace 2drop (
216 216 c-addr/u -- ) kernmenuidx @ [char] 0 <> if found at least one
217 217 exit all done then
218 218
219 219 No entries in $kernels; use $kernel instead s"
220 220 kernel" getenv dup -1 = if drop ( cruft ) s" "
221 221 then ( -- c-addr/u ) dup kernlen ! store entire
222 222 value length as kernlen else We're still within $kernels
223 223 parsing toward the end; find delimiter/end to determine kernlen
224 224 2dup ( c-addr/u -- c-addr/u c-addr/u ) begin dup 0<>
225 225 while over c@ delim? if drop 0 (
226 226 break ) found delimiter else
227 227 kernlen @ 1+ kernlen ! incrememnt
228 228 1- swap 1+ swap c-addr++ u--
229 229 then repeat 2drop ( c-addr/u
230 230 c-addr'/u' -- c-addr/u )
231 231
232 232 If this is the first entry, compare it to $kernel
233 233 If different, then insert $kernel beforehand
234 234 kernmenuidx @ [char] 0 = if over kernlen @
235 235 kerndefault count compare if kernelsbuf 0 kerndefault
236 236 count strcat s" ," strcat 2swap strcat
237 237 kerndefault count swap drop kernlen !
238 238 then then then ( c-
239 239 addr/u -- c-addr'/u' )
240 240
241 241 At this point, we should have something on the stack to store
242 242 as the next kernel menu option; start assembling variables
243 243
244 244 over kernlen @ ( c-addr/u -- c-addr/u c-addr/u2 )
245 245
246 246 Assign first to kernel[x] 2dup kernmenuidx @ kernel[x]
247 247 setenv
248 248
249 249 Assign second to menu_caption[x][y] kerncapbuf 0 s"
250 250 [K]ernel: " strcat 2over strcat kernidx @ kernmenuidx @
251 251 menu_caption[x][y] setenv
252 252
253 253 Assign third to ansi_caption[x][y] kerncapbuf 0 s"
254 254 @[1mK@[37mernel: " [char] @ escc! strcat kernmenuidx @ [char] 0 = if
255 255 s" default/@[32m" else s" @[34;1m"
256 256 then [char] @ escc! strcat 2over strcat s"
257 257 @[37m" [char] @ escc! strcat kernidx @ kernmenuidx @ ansi_caption[x][y]
258 258 setenv
259 259
260 260 2drop ( c-addr/u c-addr/u2 -- c-addr/u )
261 261
262 262 kernmenuidx @ 1+ dup kernmenuidx ! [char] 8 > if 2drop (
263 263 c-addr/u -- ) exit then
264 264
265 265 kernlen @ - swap kernlen @ + swap ( c-addr/u -- c-addr'/u' )
266 266 again ;
267 267
268 268 This function goes through the kernels that were discovered by the parse-
269 269 kernels function [above], adding " (# of #)" text to the end of each caption.
270 270 : tag-kernels ( -- ) kernidx @ ( -- x ) dup 0= if exit then [char] 0 s"
271 271 (Y of Z)" ( x -- x y c-addr/u ) kernmenuidx @ -rot 7 +c! Replace 'Z' with
272 272 number of kernels parsed begin 2 pick 1+ -rot 2 +c! Replace 'Y'
273 273 with current ASCII num
274 274
275 275 2over menu_caption[x][y] getenv dup -1 <> if 2dup +
276 276 1- c@ [char] ) = if 2drop Already tagged
277 277 else kerncapbuf 0 2swap strcat
278 278 2over strcat 5 pick 5 pick
279 279 menu_caption[x][y] setenv then else
280 280 drop ( getenv cruft ) then
281 281
282 282 2over ansi_caption[x][y] getenv dup -1 <> if 2dup +
283 283 1- c@ [char] ) = if 2drop Already tagged
284 284 else kerncapbuf 0 2swap strcat
285 285 2over strcat 5 pick 5 pick
286 286 ansi_caption[x][y] setenv then else
287 287 drop ( getenv cruft ) then
288 288
289 289 rot 1+ dup [char] 8 > if -rot 2drop TRUE ( break )
↓ open down ↓ |
289 lines elided |
↑ open up ↑ |
290 290 else -rot FALSE then until 2drop (
291 291 x y -- ) ;
292 292
293 293 Illumos kernel acpi-user-options has following values: default: 0 -
294 294 system will enable acpi based on bios date on: 1 - acpi is set on
295 295 off: 2 - acpi is set off madt: 4 - use only MADT legacy: 8 -
296 296 use legacy mode
297 297
298 298 : acpi-captions ( N -- )
299 299 first entry
300 - dup s" [A]CPI.... default" rot 48 menu_caption[x][y] setenv
301 - dup s" ^[1mA^[mCPI.... ^[32;7mdefault^[m" rot 48 ansi_caption[x][y] setenv
300 + dup s" [A]CPI.............. default" rot 48 menu_caption[x][y] setenv
301 + dup s" ^[1mA^[mCPI.............. ^[32;7mdefault^[m" rot 48
302 +ansi_caption[x][y] setenv
302 303
303 - dup s" [A]CPI........ On" rot 49 menu_caption[x][y] setenv
304 - dup s" ^[1mA^[mCPI........ ^[34;1mOn^[m" rot 49 ansi_caption[x][y] setenv
304 + dup s" [A]CPI.............. On" rot 49 menu_caption[x][y] setenv
305 + dup s" ^[1mA^[mCPI.............. ^[34;1mOn^[m" rot 49 ansi_caption[x][y]
306 +setenv
305 307
306 - dup s" [A]CPI........ Off" rot 50 menu_caption[x][y] setenv
307 - dup s" ^[1mA^[mCPI........ ^[34;1mOff^[m" rot 50 ansi_caption[x][y] setenv
308 + dup s" [A]CPI.............. Off" rot 50 menu_caption[x][y] setenv
309 + dup s" ^[1mA^[mCPI.............. ^[34;1mOff^[m" rot 50 ansi_caption[x][y]
310 +setenv
308 311
309 - dup s" [A]CPI....... MADT" rot 51 menu_caption[x][y] setenv
310 - dup s" ^[1mA^[mCPI....... ^[34;1mMADT^[m" rot 51 ansi_caption[x][y] setenv
312 + dup s" [A]CPI.............. MADT" rot 51 menu_caption[x][y] setenv
313 + dup s" ^[1mA^[mCPI.............. ^[34;1mMADT^[m" rot 51 ansi_caption[x][y]
314 +setenv
311 315
312 - dup s" [A]CPI..... Legacy" rot 52 menu_caption[x][y] setenv
313 - s" ^[1mA^[mCPI..... ^[34;1mLegacy^[m" rot 52 ansi_caption[x][y] setenv ;
316 + dup s" [A]CPI.............. Legacy" rot 52 menu_caption[x][y] setenv
317 + s" ^[1mA^[mCPI.............. ^[34;1mLegacy^[m" rot 52 ansi_caption[x][y]
318 +setenv ;
314 319
315 320 Illumos console has following values: text, ttya, ttyb, ttyc, ttyd
316 321
317 322 : osconsole-captions ( N -- )
318 323 first entry
319 - dup s" Os[C]onsole.. text" rot 48 menu_caption[x][y] setenv
320 - dup s" Os^[1mC^[monsole.. ^[32;7mtext^[m" rot 48 ansi_caption[x][y] setenv
324 + dup s" Os[C]onsole............ text" rot 48 menu_caption[x][y] setenv
325 + dup s" Os^[1mC^[monsole............ ^[32;7mtext^[m" rot 48
326 +ansi_caption[x][y] setenv
321 327
322 - dup s" Os[C]onsole.. ttya" rot 49 menu_caption[x][y] setenv
323 - dup s" Os^[1mC^[monsole.. ^[34;1mttya^[m" rot 49 ansi_caption[x][y] setenv
328 + dup s" Os[C]onsole............ ttya" rot 49 menu_caption[x][y] setenv
329 + dup s" Os^[1mC^[monsole............ ^[34;1mttya^[m" rot 49
330 +ansi_caption[x][y] setenv
324 331
325 - dup s" Os[C]onsole.. ttyb" rot 50 menu_caption[x][y] setenv
326 - dup s" Os^[1mC^[monsole.. ^[34;1mttyb^[m" rot 50 ansi_caption[x][y] setenv
332 + dup s" Os[C]onsole............ ttyb" rot 50 menu_caption[x][y] setenv
333 + dup s" Os^[1mC^[monsole............ ^[34;1mttyb^[m" rot 50
334 +ansi_caption[x][y] setenv
327 335
328 - dup s" Os[C]onsole.. ttyc" rot 51 menu_caption[x][y] setenv
329 - dup s" Os^[1mC^[monsole.. ^[34;1mttyc^[m" rot 51 ansi_caption[x][y] setenv
336 + dup s" Os[C]onsole............ ttyc" rot 51 menu_caption[x][y] setenv
337 + dup s" Os^[1mC^[monsole............ ^[34;1mttyc^[m" rot 51
338 +ansi_caption[x][y] setenv
330 339
331 - dup s" Os[C]onsole.. ttyd" rot 52 menu_caption[x][y] setenv
332 - s" Os^[1mC^[monsole.. ^[34;1mttyd^[m" rot 52 ansi_caption[x][y] setenv ;
340 + dup s" Os[C]onsole............ ttyd" rot 52 menu_caption[x][y] setenv
341 + s" Os^[1mC^[monsole............ ^[34;1mttyd^[m" rot 52 ansi_caption[x][y]
342 +setenv ;
333 343
334 344 This function creates the list of menu items. This function is called by the
335 345 menu-display function. You need not call it directly. : menu-create ( -- )
336 346
337 347 Print the frame caption at (x,y) s" loader_menu_title" getenv dup -1 =
338 348 if drop s" Welcome to illumos" then TRUE ( use default alignment
339 349 ) s" loader_menu_title_align" getenv dup -1 <> if 2dup s" left"
340 350 compare-insensitive 0= if ( 1 ) 2drop ( c-addr/u ) drop ( bool )
341 351 menuX @ menuY @ 1- FALSE ( don't use default
342 352 alignment ) else ( 1 ) 2dup s" right" compare-insensitive 0= if ( 2 )
343 353 2drop ( c-addr/u ) drop ( bool ) menuX @ 42 + 4 -
344 354 over - menuY @ 1- FALSE ( don't use default alignment )
345 355 else ( 2 ) 2drop ( c-addr/u ) then ( 1 ) then else
346 356 drop ( getenv cruft ) then if ( use default center
347 357 alignement? ) menuX @ 19 + over 2 / - menuY @ 1- then at-xy
348 358 type
349 359
350 360 If $menu_init is set, evaluate it (allowing for whole menus to be
351 361 constructed dynamically -- as this function could conceivably set
352 362 the remaining environment variables to construct the menu entirely).
353 363 s" menu_init" getenv dup -1 <> if evaluate else
354 364 drop then
355 365
356 366 Print our menu options with respective key/variable associations.
357 367 `printmenuitem' ends by adding the decimal ASCII value for the
358 368 numerical prefix to the stack. We store the value left on the stack to
359 369 the key binding variable for later testing against a character captured by
360 370 the `getkey' function.
361 371
362 372 Note that any menu item beyond 9 will have a numerical prefix on the
363 373 screen consisting of the first digit (ie. 1 for the tenth menu item)
364 374 and the key required to activate that menu item will be the decimal
365 375 ASCII of 48 plus the menu item (ie. 58 for the tenth item, aka. `:')
366 376 which is misleading and not desirable. Thus, we do not allow
367 377 more than 8 configurable items on the menu (with "Reboot" as the optional
368 378 ninth and highest numbered item).
369 379
370 380 Initialize the OsConsole option status. 0 menuosconsole !
371 381 s" menu_osconsole" getenv -1 <> if c@ dup 48 > over 57 < and if
372 382 ( '1' <= c1 <= '8' ) dup menuosconsole ! dup
373 383 osconsole-captions
374 384
375 385 s" init_osconsole" evaluate
376 386
377 387 Get the current cycle state (entry to use) s"
378 388 osconsole_state" evaluate @ 48 + ( n -- n y )
379 389
380 390 Set the current non-ANSI caption 2dup swap dup ( n
381 391 y -- n y y n n ) s" set menu_caption[x]=$menu_caption[x][y]"
382 392 17 +c! 34 +c! 37 +c! evaluate ( n y y n n c-
383 393 addr/u -- n y )
384 394
385 395 Set the current ANSI caption 2dup swap dup ( n
386 396 y -- n y y n n ) s" set ansi_caption[x]=$ansi_caption[x][y]"
387 397 17 +c! 34 +c! 37 +c! evaluate ( n y y n n c-
388 398 addr/u -- n y )
389 399
390 400 Initialize cycle state from stored value 48 - ( n
391 401 y -- n k ) s" init_cyclestate" evaluate ( n k -- n )
392 402
393 403 Set $os_console s" activate_osconsole" evaluate (
394 404 n -- n ) then drop then
395 405
396 406 Initialize the ACPI option status. 0 menuacpi ! s"
397 407 menu_acpi" getenv -1 <> if c@ dup 48 > over 57 < and if ( '1' <= c1 <=
398 408 '8' ) dup menuacpi ! dup acpi-captions
399 409
400 410 s" init_acpi" evaluate
401 411
402 412 Get the current cycle state (entry to use) s"
403 413 acpi_state" evaluate @ 48 + ( n -- n y )
404 414
405 415 Set the current non-ANSI caption 2dup swap dup ( n
406 416 y -- n y y n n ) s" set menu_caption[x]=$menu_caption[x][y]"
407 417 17 +c! 34 +c! 37 +c! evaluate ( n y y n n c-
408 418 addr/u -- n y )
409 419
410 420 Set the current ANSI caption 2dup swap dup ( n
411 421 y -- n y y n n ) s" set ansi_caption[x]=$ansi_caption[x][y]"
412 422 17 +c! 34 +c! 37 +c! evaluate ( n y y n n c-
413 423 addr/u -- n y )
414 424
415 425 Initialize cycle state from stored value 48 - ( n
416 426 y -- n k ) s" init_cyclestate" evaluate ( n k -- n )
417 427
418 428 Set $acpi-user-options s" activate_acpi" evaluate (
419 429 n -- n ) then drop then
420 430
421 431 Initialize kernel captions after parsing $kernels 0
422 432 menukernel ! s" menu_kernel" getenv -1 <> if c@ dup 48 > over 57 <
423 433 and if ( '1' <= c1 <= '8' ) dup menukernel ! dup
424 434 parse-kernels tag-kernels
425 435
426 436 Get the current cycle state (entry to use) s"
427 437 kernel_state" evaluate @ 48 + ( n -- n y )
428 438
429 439 If state is invalid, reset dup kernmenuidx @ 1- >
430 440 if drop [char] 0 ( n y -- n 48 ) 0 s"
431 441 kernel_state" evaluate ! over s" init_kernel" evaluate
432 442 drop then
433 443
434 444 Set the current non-ANSI caption 2dup swap dup ( n
435 445 y -- n y y n n ) s" set menu_caption[x]=$menu_caption[x][y]"
436 446 17 +c! 34 +c! 37 +c! evaluate ( n y y n n c-
437 447 addr/u -- n y )
438 448
439 449 Set the current ANSI caption 2dup swap dup ( n
440 450 y -- n y y n n ) s" set ansi_caption[x]=$ansi_caption[x][y]"
441 451 17 +c! 34 +c! 37 +c! evaluate ( n y y n n c-
442 452 addr/u -- n y )
443 453
444 454 Initialize cycle state from stored value 48 - ( n
445 455 y -- n k ) s" init_cyclestate" evaluate ( n k -- n )
446 456
447 457 Set $kernel to $kernel[y] s" activate_kernel"
448 458 evaluate ( n -- n ) then drop then
449 459
450 460 Initialize the menu_options visual separator. 0 menuoptions
451 461 ! s" menu_options" getenv -1 <> if c@ dup 48 > over 57 < and if (
452 462 '1' <= c1 <= '8' ) menuoptions ! else
453 463 drop then then
454 464
455 465 Initialize "Reboot" menu state variable (prevents double-entry)
456 466 false menurebootadded !
457 467
458 468 menu_start 1- menuidx ! Initialize the starting index for the
459 469 menu 0 menurow ! Initialize the starting position for the menu
460 470
461 471 49 Iterator start (loop range 49 to 56; ASCII '1' to '8') begin
462 472 If the "Options:" separator, print it. dup menuoptions @
463 473 = if Optionally add a reboot option to the menu s"
464 474 menu_reboot" getenv -1 <> if drop s"
465 475 Reboot" printmenuitem menureboot ! true menurebootadded !
466 476 then
467 477
468 478 menuX @ menurow @ 2 + menurow !
469 479 menurow @ menuY @ + at-xy s"
470 480 menu_optionstext" getenv dup -1 <> if type
471 481 else drop ." Options:" then
472 482 then
473 483
474 484 make sure we have not already initialized this item dup
475 485 init_stateN dup @ 0= if 1 swap !
476 486
477 487 If this menuitem has an initializer, run it dup
478 488 menu_init[x] getenv dup -1 <> if evaluate
479 489 else drop then
480 490 else drop then
481 491
482 492 dup loader_color? if ansi_caption[x]
483 493 else menu_caption[x] then
484 494
485 495 dup -1 <> if test for environment variable
486 496 getenv dup -1 <> if printmenuitem ( c-
487 497 addr/u -- n ) dup menukeyN ! else
488 498 drop then else
489 499 drop then
490 500
491 501 1+ dup 56 > add 1 to iterator, continue if less than 57 until
492 502 drop iterator
493 503
494 504 Optionally add a reboot option to the menu menurebootadded @ true <> if
495 505 s" menu_reboot" getenv -1 <> if drop no need for
496 506 the value s" Reboot" menu caption (required by printmenuitem)
497 507
498 508 printmenuitem menureboot ! else
499 509 0 menureboot ! then then ;
500 510
501 511 Takes a single integer on the stack and updates the timeout display. The
502 512 integer must be between 0 and 9 (we will only update a single digit in the
503 513 source message). : menu-timeout-update ( N -- )
504 514
505 515 Enforce minimum/maximum dup 9 > if drop 9 then dup 0 < if drop 0
506 516 then
507 517
508 518 s" Autoboot in N seconds. [Space] to pause" ( n -- n c-addr/u )
509 519
510 520 2 pick 0> if rot 48 + -rot ( n c-addr/u -- n' c-addr/u ) convert
511 521 to ASCII 12 +c! ( n' c-addr/u -- c-addr/u ) replace 'N' above
512 522
513 523 menu_timeout_x @ menu_timeout_y @ at-xy position cursor
514 524 type ( c-addr/u -- ) print message else
515 525 menu_timeout_x @ menu_timeout_y @ at-xy position cursor
516 526 spaces ( n c-addr/u -- n c-addr ) erase message 2drop ( n c-
517 527 addr -- ) then
518 528
519 529 at-bl ;
520 530
521 531 This function blocks program flow (loops forever) until a key is pressed.
522 532 The key that was pressed is added to the top of the stack in the form of its
523 533 decimal ASCII representation. This function is called by the menu-display
524 534 function. You need not call it directly. note, the esc sequences will be
525 535 dropped, this needs to be changed if menu is built based on arrow keys. :
526 536 getkey ( -- ascii_keycode )
527 537
528 538 begin loop forever
529 539
530 540 menu_timeout_enabled @ 1 = if ( -- )
531 541 seconds ( get current time: -- N ) dup menu_time
532 542 @ <> if ( has time elapsed?: N N N -- N )
533 543
534 544 At least 1 second has elapsed since last loop
535 545 so we will decrement our "timeout" (really a
536 546 counter, insuring that we do not proceed too
537 547 fast) and update our timeout display.
538 548
539 549 menu_time ! ( update time record: N -- )
540 550 menu_timeout @ ( "time" remaining: -- N )
541 551 dup 0> if ( greater than 0?: N N 0 -- N )
542 552 1- ( decrement counter: N -- N )
543 553 dup menu_timeout ! (
544 554 re-assign: N N Addr -- N ) then ( -- N )
545 555
546 556 dup 0= swap 0< or if ( N <= 0?: N N -- )
547 557 halt the timer 0
548 558 menu_timeout ! ( 0 Addr -- ) 0 menu_timeout_enabled ! ( 0
549 559 Addr -- ) then
550 560
551 561 update the timer display ( N -- )
552 562 menu_timeout @ menu-timeout-update
553 563
554 564 menu_timeout @ 0= if We've
555 565 reached the end of the timeout (user did not cancel
556 566 by pressing ANY key)
557 567
558 568 s" menu_timeout_command" getenv dup
559 569 -1 = if drop clean-up
560 570 else evaluate
561 571 then then
562 572
563 573 else ( -- N ) No [detectable] time has elapsed
564 574 (in seconds) drop ( N -- ) then (
565 575 -- ) then
566 576
567 577 key? if Was a key pressed? (see loader(8))
568 578
569 579 An actual key was pressed (if the timeout is running,
570 580 kill it regardless of which key was pressed)
571 581 menu_timeout @ 0<> if 0 menu_timeout !
572 582 0 menu_timeout_enabled !
573 583
574 584 clear screen of timeout message 0 menu-
575 585 timeout-update then
576 586
577 587 get the key that was pressed and exit (if we
578 588 get a non-zero ASCII code) key dup 0<> if
579 589 dup 0x1b = if key? if ( is it
580 590 sequence? ) drop
581 591 begin key?
582 592 while key drop
583 593 repeat else
584 594 exit then
585 595 else exit
586 596 then else drop
587 597 then then 50 ms sleep for 50 milliseconds
588 598 (see loader(8))
589 599
590 600 again ;
591 601
592 602 : menu-erase ( -- ) Erases menu and resets positioning variable to position
593 603 1.
594 604
595 605 Clear the screen area associated with the interactive menu menuX @
596 606 menuY @ 2dup at-xy 38 spaces 1+ 2dup at-xy 38 spaces 1+ 2dup at-xy 38
597 607 spaces 1+ 2dup at-xy 38 spaces 1+ 2dup at-xy 38 spaces 1+ 2dup at-
598 608 xy 38 spaces 1+ 2dup at-xy 38 spaces 1+ 2dup at-xy 38 spaces 1+
599 609 2dup at-xy 38 spaces 1+ 2dup at-xy 38 spaces 1+ 2dup at-xy 38
600 610 spaces 1+ 2dup at-xy 38 spaces 2drop
601 611
602 612 Reset the starting index and position for the menu menu_start 1-
603 613 menuidx ! 0 menurow ! ;
604 614
605 615 only forth also menu-infrastructure also menu-namespace also menu-command-
606 616 helpers definitions
607 617
608 618 : toggle_menuitem ( N -- N ) toggles caption text and internal menuitem state
609 619
610 620 ASCII numeral equal to user-selected menu item must be on the stack.
611 621 We do not modify the stack, so the ASCII numeral is left on top.
612 622
613 623 dup init_textN c@ 0= if NOTE: no need to check toggle_stateN since
614 624 the first time we are called, we will populate init_textN. Further, we
615 625 don't need to test whether menu_caption[x] (ansi_caption[x] when
616 626 loader_color?=1) is available since we would not have been
617 627 called if the caption was NULL.
618 628
619 629 base name of environment variable dup ( n -- n n ) key
620 630 pressed loader_color? if ansi_caption[x] else
621 631 menu_caption[x] then getenv dup -1 <> if
622 632
623 633 2 pick ( n c-addr/u -- n c-addr/u n ) init_textN (
624 634 n c-addr/u n -- n c-addr/u c-addr )
625 635
626 636 now we have the buffer c-addr on top ( followed
627 637 by c-addr/u of current caption )
628 638
629 639 Copy the current caption into our buffer 2dup c!
630 640 -rot store strlen at first byte begin rot 1+
631 641 bring alt addr to top and increment -rot -rot bring buffer
632 642 addr to top 2dup c@ swap c! copy current character
633 643 1+ increment buffer addr rot 1-
634 644 bring buffer len to top and decrement dup 0= exit loop if
635 645 buffer len is zero until 2drop buffer len/addr
636 646 drop alt addr
637 647
638 648 else drop then then
639 649
640 650 Now we are certain to have init_textN populated with the initial
641 651 value of menu_caption[x] (ansi_caption[x] with loader_color enabled).
642 652 We can now use init_textN as the untoggled caption and
643 653 toggled_text[x] (toggled_ansi[x] with loader_color enabled) as the
644 654 toggled caption and store the appropriate value into menu_caption[x]
645 655 (again, ansi_caption[x] with loader_color enabled). Last, we'll
646 656 negate the toggled state so that we reverse the flow on subsequent
647 657 calls.
648 658
649 659 dup toggle_stateN @ 0= if state is OFF, toggle to ON
650 660
651 661 dup ( n -- n n ) key pressed loader_color? if
652 662 toggled_ansi[x] else toggled_text[x]
653 663 then getenv dup -1 <> if Assign toggled
654 664 text to menu caption 2 pick ( n c-addr/u -- n c-addr/u n ) key
655 665 pressed loader_color? if ansi_caption[x]
656 666 else menu_caption[x] then
657 667 setenv else No toggled text, keep the
658 668 same caption drop ( n -1 -- n ) getenv cruft then
659 669
660 670 true new value of toggle state var (to be stored later) else
661 671 state is ON, toggle to OFF
662 672
663 673 dup init_textN count ( n -- n c-addr/u )
664 674
665 675 Assign init_textN text to menu caption 2 pick ( n c-
666 676 addr/u -- n c-addr/u n ) key pressed loader_color? if
667 677 ansi_caption[x] else menu_caption[x]
668 678 then setenv
669 679
670 680 false new value of toggle state var (to be stored below) then
671 681
672 682 now we'll store the new toggle state (on top of stack) over
673 683 toggle_stateN ! ;
674 684
675 685 : cycle_menuitem ( N -- N ) cycles through array of choices for a menuitem
676 686
677 687 ASCII numeral equal to user-selected menu item must be on the stack.
678 688 We do not modify the stack, so the ASCII numeral is left on top.
679 689
680 690 dup cycle_stateN dup @ 1+ get value and increment
681 691
682 692 Before assigning the (incremented) value back to the pointer, let's
683 693 test for the existence of this particular array element. If the element
684 694 exists, we'll store index value and move on. Otherwise, we'll loop
685 695 around to zero and store that.
686 696
687 697 dup 48 + ( n addr k -- n addr k k' ) duplicate array index
688 698 and convert to ASCII numeral
689 699
690 700 3 pick swap ( n addr k k' -- n addr k n k' ) (n,k') as (x,y)
691 701 loader_color? if ansi_caption[x][y] else
692 702 menu_caption[x][y] then ( n addr k n k' -- n addr k c-addr/u )
693 703
694 704 Now test for the existence of our incremented array index in the
695 705 form of $menu_caption[x][y] ($ansi_caption[x][y] with loader_color
696 706 enabled) as set in loader.rc(5), et. al.
697 707
698 708 getenv dup -1 = if No caption set for this array index. Loop back
699 709 to zero.
700 710
701 711 drop ( n addr k -1 -- n addr k ) getenv cruft drop 0 ( n
702 712 addr k -- n addr 0 ) new value to store later
703 713
704 714 2 pick [char] 0 ( n addr 0 -- n addr 0 n 48 ) (n,48) as (x,y)
705 715 loader_color? if ansi_caption[x][y] else
706 716 menu_caption[x][y] then ( n addr 0 n 48 -- n
707 717 addr 0 c-addr/u ) getenv dup -1 = if Highly unlikely to
708 718 occur, but to ensure things move along smoothly, allocate a
709 719 temporary NULL string drop ( cruft ) s" " then
710 720 then
711 721
712 722 At this point, we should have the following on the stack (in order,
713 723 from bottom to top): n - Ascii numeral representing
714 724 the menu choice (inherited) addr - address of our internal
715 725 cycle_stateN variable k - zero-based number we intend to store
716 726 to the above c-addr/u - string value we intend to store to
717 727 menu_caption[x] (or ansi_caption[x] with loader_color
718 728 enabled) Let's perform what we need to with the above.
719 729
720 730 Assign array value text to menu caption 4 pick ( n addr k c-addr/u
721 731 -- n addr k c-addr/u n ) loader_color? if ansi_caption[x]
722 732 else menu_caption[x] then setenv
723 733
724 734 swap ! ( n addr k -- n ) update array state variable ;
725 735
726 736 only forth definitions also menu-infrastructure
727 737
728 738 Erase and redraw the menu. Useful if you change a caption and want to update
729 739 the menu to reflect the new value. : menu-redraw ( -- ) menu-erase
730 740 menu-create ;
731 741
732 742 This function initializes the menu. Call this from your `loader.rc' file
733 743 before calling any other menu-related functions. : menu-init ( -- )
734 744 menu_start 1- menuidx ! Initialize the starting index for the
735 745 menu 0 menurow ! Initialize the starting position for the menu
736 746
737 747 Assign configuration values s" loader_menu_y" getenv dup -1 = if
738 748 drop no custom row position menu_default_y else
739 749 make sure custom position is a number ?number 0= if
740 750 menu_default_y or use default then then
741 751 menuY ! s" loader_menu_x" getenv dup -1 = if drop no custom
742 752 column position menu_default_x else make sure custom
743 753 position is a number ?number 0= if menu_default_x or use
744 754 default then then menuX !
745 755
746 756 Interpret a custom frame type for the menu TRUE ( draw a box? default
747 757 yes, but might be altered below ) s" loader_menu_frame" getenv dup -1 = if (
748 758 1 ) drop no custom frame type else ( 1 ) 2dup s" single" compare-
749 759 insensitive 0= if ( 2 ) f_single ( see frames.4th ) else ( 2 ) 2dup
750 760 s" double" compare-insensitive 0= if ( 3 ) f_double ( see frames.4th )
751 761 else ( 3 ) s" none" compare-insensitive 0= if ( 4 ) drop FALSE
752 762 don't draw a box ( 4 ) then ( 3 ) then ( 2 ) then ( 1 ) then if
753 763 42 13 menuX @ 3 - menuY @ 1- box Draw frame (w,h,x,y) then
754 764
755 765 at-bl ;
756 766
757 767 also menu-namespace
758 768
759 769 Main function. Call this from your `loader.rc' file. : menu-display ( -- )
760 770
761 771 0 menu_timeout_enabled ! start with automatic timeout disabled
762 772
763 773 check indication that automatic execution after delay is requested s"
764 774 menu_timeout_command" getenv -1 <> if ( Addr C -1 -- | Addr ) drop (
765 775 just testing existence right now: Addr -- )
766 776
767 777 initialize state variables seconds menu_time ! ( store the
768 778 time we started ) 1 menu_timeout_enabled ! ( enable automatic timeout )
769 779
770 780 read custom time-duration (if set) s" autoboot_delay"
771 781 getenv dup -1 = if drop no custom duration (remove dup'd bunk -1)
772 782 menu_timeout_default use default setting else
773 783 2dup ?number 0= if ( if not a number ) disable
774 784 timeout if "NO", else use default s" NO" compare-insensitive
775 785 0= if 0 menu_timeout_enabled !
776 786 0 ( assigned to menu_timeout below )
777 787 else menu_timeout_default
778 788 then else -rot 2drop
779 789
780 790 boot immediately if less than zero dup
781 791 0< if drop menu-create
782 792 at-bl 0 boot
783 793 then then then
784 794 menu_timeout ! ( store value on stack from above )
785 795
786 796 menu_timeout_enabled @ 1 = if read custom column
787 797 position (if set) s" loader_menu_timeout_x" getenv dup -1 = if
788 798 drop no custom column position
789 799 menu_timeout_default_x use default setting
790 800 else make sure custom position is a number
791 801 ?number 0= if menu_timeout_default_x
792 802 or use default then then
793 803 menu_timeout_x ! ( store value on stack from above )
794 804
795 805 read custom row position (if set) s"
796 806 loader_menu_timeout_y" getenv dup -1 = if drop no custom
797 807 row position menu_timeout_default_y use default setting
798 808 else make sure custom position is a number
799 809 ?number 0= if menu_timeout_default_y
800 810 or use default then then
801 811 menu_timeout_y ! ( store value on stack from above )
802 812 then then
803 813
804 814 menu-create
805 815
806 816 begin Loop forever
807 817
808 818 at-bl getkey Block here, waiting for a key to be
809 819 pressed
810 820
811 821 dup -1 = if drop exit Caught abort (abnormal return)
812 822 then
813 823
814 824 Boot if the user pressed Enter/Ctrl-M (13) or Ctrl-
815 825 Enter/Ctrl-J (10) dup over 13 = swap 10 = or if drop (
816 826 no longer needed ) s" boot" evaluate exit ( pedantic;
817 827 never reached ) then
818 828
819 829 dup menureboot @ = if 0 reboot then
820 830
821 831 Evaluate the decimal ASCII value against known menu item
822 832 key associations and act accordingly
823 833
824 834 49 Iterator start (loop range 49 to 56; ASCII '1' to '8')
825 835 begin dup menukeyN @ rot tuck = if
826 836
827 837 Adjust for missing ACPI menuitem on non-i386
828 838 arch-i386? true <> menuacpi @ 0<> and if
829 839 menuacpi @ over 2dup < -rot = or
830 840 over 58 < and if ( key >=
831 841 menuacpi && key < 58: N -- N ) 1+
832 842 then then
833 843
834 844 Test for the environment variable dup
835 845 menu_command[x] getenv dup -1 <> if
836 846 Execute the stored procedure
837 847 evaluate
838 848
839 849 We expect there to be a non-zero
840 850 value left on the stack after
841 851 executing the stored procedure.
842 852 If so, continue to run, else exit.
843 853
844 854 0= if drop key pressed
845 855 drop loop iterator
846 856 exit else
847 857 swap need iterator on top
848 858 then then
849 859
850 860 Re-adjust for missing ACPI menuitem
851 861 arch-i386? true <> menuacpi @ 0<> and if
852 862 swap menuacpi @ 1+ over 2dup
853 863 < -rot = or over 59 < and if
854 864 1- then
855 865 swap then else
856 866 swap need iterator on top then
857 867
858 868 Check for menu keycode shortcut(s)
859 869 dup menu_keycode[x] getenv dup -1
860 870 = if drop else ?number
861 871 0<> if rot tuck = if swap
862 872 dup menu_command[x]
863 873 getenv dup -1 <> if
864 874 evaluate 0=
865 875 if 2drop
866 876 exit
867 877 then else
868 878 drop then
869 879 else swap
870 880 then then then
871 881
872 882 1+ dup 56 > increment iterator
873 883 continue if less than 57 until
874 884 drop loop iterator drop key pressed
875 885
876 886 again Non-operational key was pressed; repeat ;
877 887
878 888 This function unsets all the possible environment variables associated with
879 889 creating the interactive menu. : menu-unset ( -- )
880 890
881 891 49 Iterator start (loop range 49 to 56; ASCII '1' to '8') begin
882 892 dup menu_init[x] unsetenv menu initializer dup
883 893 menu_command[x] unsetenv menu command dup menu_caption[x] unsetenv
884 894 menu caption dup ansi_caption[x] unsetenv ANSI caption dup
885 895 menu_keycode[x] unsetenv menu keycode dup toggled_text[x] unsetenv
886 896 toggle_menuitem caption dup toggled_ansi[x] unsetenv
887 897 toggle_menuitem ANSI caption
888 898
889 899 48 Iterator start (inner range 48 to 57; ASCII '0' to '9')
890 900 begin cycle_menuitem caption and ANSI caption
891 901 2dup menu_caption[x][y] unsetenv 2dup
892 902 ansi_caption[x][y] unsetenv 1+ dup 57 > until
893 903 drop inner iterator
894 904
895 905 0 over menukeyN ! used by menu-create, menu-display
896 906 0 over init_stateN ! used by menu-create 0 over
897 907 toggle_stateN ! used by toggle_menuitem 0 over init_textN c!
898 908 used by toggle_menuitem 0 over cycle_stateN ! used by
899 909 cycle_menuitem
900 910
901 911 1+ dup 56 > increment, continue if less than 57 until
902 912 drop iterator
903 913
904 914 s" menu_timeout_command" unsetenv menu timeout command s"
905 915 menu_reboot" unsetenv Reboot menu option flag s" menu_acpi"
906 916 unsetenv ACPI menu option flag s" menu_osconsole" unsetenv
907 917 osconsole menu option flag s" menu_kernel" unsetenv Kernel
908 918 menu option flag s" menu_options" unsetenv Options separator flag
909 919 s" menu_optionstext" unsetenv separator display text s" menu_init"
910 920 unsetenv menu initializer
911 921
912 922 0 menureboot ! 0 menuacpi ! 0 menuosconsole ! 0 menuoptions ! ;
913 923
914 924 only forth definitions also menu-infrastructure
915 925
916 926 This function both unsets menu variables and visually erases the menu area
917 927 in-preparation for another menu. : menu-clear ( -- ) menu-unset menu-
918 928 erase ;
919 929
920 930 bullet menubllt !
921 931
922 932 also menu-namespace
923 933
924 934 Initialize our menu initialization state variables 0 init_state1 ! 0
925 935 init_state2 ! 0 init_state3 ! 0 init_state4 ! 0 init_state5 ! 0
926 936 init_state6 ! 0 init_state7 ! 0 init_state8 !
927 937
928 938 Initialize our boolean state variables 0 toggle_state1 ! 0 toggle_state2 !
929 939 0 toggle_state3 ! 0 toggle_state4 ! 0 toggle_state5 ! 0 toggle_state6 ! 0
930 940 toggle_state7 ! 0 toggle_state8 !
931 941
932 942 Initialize our array state variables 0 cycle_state1 ! 0 cycle_state2 ! 0
933 943 cycle_state3 ! 0 cycle_state4 ! 0 cycle_state5 ! 0 cycle_state6 ! 0
934 944 cycle_state7 ! 0 cycle_state8 !
935 945
936 946 Initialize string containers 0 init_text1 c! 0 init_text2 c! 0 init_text3
937 947 c! 0 init_text4 c! 0 init_text5 c! 0 init_text6 c! 0 init_text7 c! 0
938 948 init_text8 c!
939 949
940 950 only forth definitions
941 951
942 952
943 953
944 954 August 28, 2019 ()
↓ open down ↓ |
602 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX