| 1 |
\ FORTH is identifed by a forth comment at first line |
| 2 |
\ |
| 3 |
\ terminal control stuff |
| 4 |
\ |
| 5 |
: TTY.CSI d# 27 EMIT ASCII [ EMIT ; |
| 6 |
: TTY.HOME TTY.CSI ASCII H EMIT ; |
| 7 |
: TTY.CLR_EOS TTY.CSI ASCII J EMIT ; |
| 8 |
: TTY.HOME_CLR TTY.HOME TTY.CLR_EOS ; |
| 9 |
\ |
| 10 |
\ boot menu stuff |
| 11 |
\ |
| 12 |
: my-max-boot-num 5 ; |
| 13 |
: my-boot-default 1 ; |
| 14 |
: my-boot-delay d# 300 ; \ unit = 100 ms |
| 15 |
: my-print-menu ( -- ) |
| 16 |
TTY.HOME_CLR |
| 17 |
." " cr |
| 18 |
." Welcome to Debian GNU/Linux ${DEBIAN_VERSION}!" cr |
| 19 |
." " cr |
| 20 |
." This is a Debian installation ${MEDIA_TYPE}," cr |
| 21 |
." built on ${BUILD_DATE}." cr |
| 22 |
." " cr |
| 23 |
." The default option is (1) 'install'. For maximum" cr |
| 24 |
." control, you can use the (2) 'expert' option." cr |
| 25 |
." " cr |
| 26 |
." ************************************" cr |
| 27 |
." If in doubt, just choose (1) 'install'" cr |
| 28 |
." ************************************" cr |
| 29 |
." " cr |
| 30 |
." 1: install" cr |
| 31 |
." 2: expert" cr |
| 32 |
." 3: rescue" cr |
| 33 |
." 4: auto" cr |
| 34 |
." 5: return to OF prompt" cr |
| 35 |
." " cr |
| 36 |
; |
| 37 |
: my-boot-case ( num -- ) |
| 38 |
." " cr |
| 39 |
case |
| 40 |
1 of " cd install/powerpc/vmlinuz-chrp.initrd ---" endof |
| 41 |
2 of " cd install/powerpc/vmlinuz-chrp.initrd priority=low ---" endof |
| 42 |
3 of " cd install/powerpc/vmlinuz-chrp.initrd rescue/enable=true ---" endof |
| 43 |
4 of " cd install/powerpc/vmlinuz-chrp.initrd auto=true priority=critical ---" endof |
| 44 |
5 of " none" endof |
| 45 |
endcase |
| 46 |
$boot |
| 47 |
; |
| 48 |
: my-input-num ( wait-period max-boot-num default-num -- boot-num ) |
| 49 |
1 \ loop-inc = 1 |
| 50 |
3 pick 0 do |
| 51 |
0d emit |
| 52 |
." press 1-" |
| 53 |
( wait-period max-boot-num default-num loop-inc ) |
| 54 |
2 pick ascii 0 + emit |
| 55 |
dup 1 = if |
| 56 |
." within " |
| 57 |
3 pick i - d# 10 / .d |
| 58 |
." seconds" |
| 59 |
then |
| 60 |
." (default: " |
| 61 |
over ascii 0 + emit |
| 62 |
." ) : " |
| 63 |
d# 100 ms |
| 64 |
key? if |
| 65 |
key |
| 66 |
( wait-period max-boot-num default-num loop-inc key ) |
| 67 |
dup 0d = if \ return pressed |
| 68 |
drop leave |
| 69 |
then |
| 70 |
|
| 71 |
ascii 0 - |
| 72 |
( wait-period max-boot-num default-num loop-inc num ) |
| 73 |
dup 1 5 pick |
| 74 |
( wait-period max-boot-num default-num loop-inc num num 1 max-boot-num ) |
| 75 |
between if |
| 76 |
rot drop swap leave |
| 77 |
then |
| 78 |
|
| 79 |
( wait-period max-boot-num default-num loop-inc num ) |
| 80 |
2drop 0 \ loop-inc = 0 |
| 81 |
then |
| 82 |
dup +loop |
| 83 |
drop |
| 84 |
( wait-period max-boot-num boot-num ) |
| 85 |
nip nip |
| 86 |
; |
| 87 |
|
| 88 |
|
| 89 |
my-print-menu |
| 90 |
my-boot-delay my-max-boot-num my-boot-default my-input-num |
| 91 |
my-boot-case |