shiftdot515

bootmenu.of3

Apr 12th, 2020
480
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 3.04 KB | None | 0 0
  1. \ openfirmware forth boot menu
  2. \ boot bootmenu.of
  3.  
  4. input-device input
  5. output-device output
  6.  
  7. \ stolen from quit
  8. \ stdout @ 0= if
  9. \   false to _normal-boot install-console
  10. \  then
  11. true to use-console? \ false to ignore-output? \ stdout-dump \ sign-on state
  12. \ off abort"-str off clearlocals false to xoff? false to xoff-filter?
  13.  
  14. decimal
  15.  
  16. : defaultkey ( secs defkey -- key | defaultkey )
  17.  swap     ( secs defkey -- defkey secs )
  18.  1000 *   ( secs defkey -- defkey inms )
  19.  get-msecs + ( secs defkey inms -- defkey maxms )
  20.  begin      (  defkey maxms --  )
  21.   key?      (  defkey maxms -- flag)
  22.   0<>
  23.   if           (  defkey maxms flag -- defkey maxms )
  24.      2drop     (  defkey maxms -- )
  25.      key       (   --  key  )
  26.      true      (  key -- key true )
  27.   else         (  defkey maxms flag -- defkey maxms )
  28.      dup       (  defkey maxms -- defkey maxms maxms )
  29.      get-msecs (  defkey maxms maxms -- defkey maxms maxms ms )
  30.      <         (  defkey maxms maxms ms --  defkey maxms flag )
  31.      if           ( defkey maxms flag -- defkey maxms )
  32.        drop       ( defkey maxms -- defkey )
  33.        true       ( defkey -- defkey true )
  34.      else         (  defkey maxms flag -- defkey maxms )
  35.         false     (  defkey maxms -- defkey maxms )
  36.      then
  37.   then
  38.  until
  39. ;
  40.  
  41. : testleave
  42.   100 0 do  
  43.          i 20
  44.          = ?leave
  45.          i . cr
  46.          loop
  47. ;
  48.  
  49. reset-screen
  50. 12 emit erase-screen
  51. blink-screen
  52. \ invert-screen
  53. \ menutop
  54. cr cr cr 10 spaces  
  55. 15 0 do 176 emit loop .(  Boot Menu ) 15 0 do 176 emit loop cr
  56. \ menutop  
  57. 10 spaces .( # q  : Quit ) cr
  58. 10 spaces .( # n  : /Netbsd ) cr
  59. 10 spaces .( # o  : /netbsd.old ) cr
  60. 10 spaces .( # m  : mac-boot ) cr
  61. 10 spaces .( # t  : telnet ) cr
  62. 10 spaces .( # s  : shut-down ) cr
  63. 10 spaces .( # r  : Reset-OF ) cr
  64. \  menu bottom
  65. 10 spaces 41 0 do 176 emit loop cr
  66.  
  67. 12 ascii m defaultkey
  68. invert-screen
  69. case
  70.    ascii n of  s" boot hd:,\ofwboot.xcf hd:9,/netbsd" eval  endof
  71.    ascii o of  s" boot hd:,\ofwboot.xcf hd:9,/netbsd.old" eval  endof
  72.    ascii t of  s" enet:telnet,192.168.199.188 " io quit endof
  73.    ascii s of  shut-down  endof
  74.    ascii m of  mac-boot endof
  75.    ascii q of  quit endof
  76.    ascii r of  
  77.              \ setenv default-router-ip 192.168.199.177
  78.              \ setenv boot-command boot hd:,\bootmenu.of
  79.              \  ^^^ nowork
  80.               s" setenv default-router-ip 192.168.199.177" eval
  81.               s" setenv boot-command boot hd:,\bootmenu.of" eval
  82.               clear
  83.               reset-all
  84.             endof
  85. endcase
  86. \ delete here and below since I"m adding these remarks on pastebin, presently.
  87. \ this represents I believe the better version of menu that one doesn't have to press
  88. \ a key it will timeout than bootmenu.of  does which is also like that
  89. \ both should work  but you know of course that I haven't tested this recently
  90. \ this one I challenged msyelf a little more bc I was still
  91. \ strong with the FORTH lololol
  92. \ but it was more like Dune 'cause'like
  93. \ I don't say it like that tho.
Add Comment
Please, Sign In to add comment