diff options
author | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-21 00:55:32 +0000 |
---|---|---|
committer | cvs2svn <cvs2svn@FreeBSD.org> | 1999-01-21 00:55:32 +0000 |
commit | 76b5366091f76c9bc73570149ef5055648fc2c39 (patch) | |
tree | 590d020e0f2a5bea6e09d66d951a674443b21d67 /share/examples/bootforth | |
parent | 4b4d01da6f07f7754ff6a6e4f5223e9f0984d1a6 (diff) |
Notes
Diffstat (limited to 'share/examples/bootforth')
-rw-r--r-- | share/examples/bootforth/README | 22 | ||||
-rw-r--r-- | share/examples/bootforth/boot.4th | 22 | ||||
-rw-r--r-- | share/examples/bootforth/frames.4th | 90 | ||||
-rw-r--r-- | share/examples/bootforth/menu.4th | 96 | ||||
-rw-r--r-- | share/examples/bootforth/screen.4th | 36 |
5 files changed, 0 insertions, 266 deletions
diff --git a/share/examples/bootforth/README b/share/examples/bootforth/README deleted file mode 100644 index d86251bcf512..000000000000 --- a/share/examples/bootforth/README +++ /dev/null @@ -1,22 +0,0 @@ -Here you can find some simple examples how to use BootFORTH (part of the -new bootloader) together with terminal emulation code (available when -compiling /sys/boot/i386/libi386 with -DTERM_EMU). - -Normally, you can place the files in /boot as they are here, and they will be -automatically loaded by /boot/loader. - -The files are: - -boot.4th example of file which is always loaded by /boot/loader, if - present in /boot/ -screen.4th helpful words for screen manipulation. -frames.4th basic frame drawing primitives. Requires screen.4th. -menu.4th example of simple startup menu. - -You're encouraged to add more features to these files - I'm not a Forth -hacker, unfortunately... - -Andrzej Bialecki -<abial@freebsd.org> - -$Id$ diff --git a/share/examples/bootforth/boot.4th b/share/examples/bootforth/boot.4th deleted file mode 100644 index 467e968f962a..000000000000 --- a/share/examples/bootforth/boot.4th +++ /dev/null @@ -1,22 +0,0 @@ -\ Example of the file which is automatically loaded by /boot/loader -\ on startup. -\ $Id$ - -\ Load the screen manipulation words - -cr .( Loading Forth extensions:) - -cr .( - screen.4th...) -s" /boot/screen.4th" fopen dup fload fclose - -\ Load frame support -cr .( - frames.4th...) -s" /boot/frames.4th" fopen dup fload fclose - -\ Load our little menu -cr .( - menu.4th...) -s" /boot/menu.4th" fopen dup fload fclose - -\ Show it -cr -main_menu diff --git a/share/examples/bootforth/frames.4th b/share/examples/bootforth/frames.4th deleted file mode 100644 index 9895a74466be..000000000000 --- a/share/examples/bootforth/frames.4th +++ /dev/null @@ -1,90 +0,0 @@ -\ Words implementing frame drawing -\ XXX Filled boxes are left as an exercise for the reader... ;-/ -\ $Id$ - -marker task-frames.4th - -variable h_el -variable v_el -variable lt_el -variable lb_el -variable rt_el -variable rb_el -variable fill - -\ Single frames -196 constant sh_el -179 constant sv_el -218 constant slt_el -192 constant slb_el -191 constant srt_el -217 constant srb_el -\ Double frames -205 constant dh_el -186 constant dv_el -201 constant dlt_el -200 constant dlb_el -187 constant drt_el -188 constant drb_el -\ Fillings -0 constant fill_none -32 constant fill_blank -176 constant fill_dark -177 constant fill_med -178 constant fill_bright - - -: hline ( len x y -- ) \ Draw horizontal single line - at-xy \ move cursor - 0 do - h_el @ emit - loop -; - -: f_single ( -- ) \ set frames to single - sh_el h_el ! - sv_el v_el ! - slt_el lt_el ! - slb_el lb_el ! - srt_el rt_el ! - srb_el rb_el ! -; - -: f_double ( -- ) \ set frames to double - dh_el h_el ! - dv_el v_el ! - dlt_el lt_el ! - dlb_el lb_el ! - drt_el rt_el ! - drb_el rb_el ! -; - -: vline ( len x y -- ) \ Draw vertical single line - 2dup 4 pick - 0 do - at-xy - v_el @ emit - 1+ - 2dup - loop - 2drop 2drop drop -; - -: box ( w h x y -- ) \ Draw a box - 2dup 1+ 4 pick 1- -rot - vline \ Draw left vert line - 2dup 1+ swap 5 pick + swap 4 pick 1- -rot - vline \ Draw right vert line - 2dup swap 1+ swap 5 pick 1- -rot - hline \ Draw top horiz line - 2dup swap 1+ swap 4 pick + 5 pick 1- -rot - hline \ Draw bottom horiz line - 2dup at-xy lt_el @ emit \ Draw left-top corner - 2dup 4 pick + at-xy lb_el @ emit \ Draw left bottom corner - 2dup swap 5 pick + swap at-xy rt_el @ emit \ Draw right top corner - 2 pick + swap 3 pick + swap at-xy rb_el @ emit - 2drop -; - -f_single -fill_none fill ! diff --git a/share/examples/bootforth/menu.4th b/share/examples/bootforth/menu.4th deleted file mode 100644 index 06493c53f14b..000000000000 --- a/share/examples/bootforth/menu.4th +++ /dev/null @@ -1,96 +0,0 @@ -\ Simple greeting screen, presenting basic options. -\ XXX This is far too trivial - I don't have time now to think -\ XXX about something more fancy... :-/ -\ $Id: menu.4th,v 1.1 1998/12/22 12:15:45 abial Exp $ - -: title - f_single - 60 11 10 4 box - 29 4 at-xy 15 fg 7 bg - ." Welcome to BootFORTH!" - me -; - -: menu - 2 fg - 20 7 at-xy - ." 1. Start FreeBSD /kernel." - 20 8 at-xy - ." 2. Interact with BootFORTH." - 20 9 at-xy - ." 3. Reboot." - me -; - -: tkey ( d -- flag | char ) - seconds + - begin 1 while - dup seconds u< if - drop - -1 - exit - then - key? if - drop - key - exit - then - repeat -; - -: prompt - 14 fg - 20 11 at-xy - ." Enter your option (1,2,3): " - 10 tkey - dup 32 = if - drop key - then - dup 0< if - drop 49 - then - dup emit - me -; - -: help_text - 10 18 at-xy ." * Choose 1 if you just want to run FreeBSD." - 10 19 at-xy ." * Choose 2 if you want to use bootloader facilities." - 12 20 at-xy ." See '?' for available commands, and 'words' for" - 12 21 at-xy ." complete list of Forth words." - 10 22 at-xy ." * Choose 3 in order to warm boot your machine." -; - -: main_menu - begin 1 while - clear - f_double - 79 23 1 1 box - title - menu - help_text - prompt - cr cr cr - dup 49 = if - drop - 1 25 at-xy cr - ." Loading kernel. Please wait..." cr - boot - then - dup 50 = if - drop - 1 25 at-xy cr - exit - then - dup 51 = if - drop - 1 25 at-xy cr - reboot - then - 20 12 at-xy - ." Key " emit ." is not a valid option!" - 20 13 at-xy - ." Press any key to continue..." - key drop - repeat -; diff --git a/share/examples/bootforth/screen.4th b/share/examples/bootforth/screen.4th deleted file mode 100644 index 4b0a01e7c982..000000000000 --- a/share/examples/bootforth/screen.4th +++ /dev/null @@ -1,36 +0,0 @@ -\ Screen manipulation related words. -\ $Id$ - -marker task-screen.4th - -: escc ( -- ) \ emit Esc-[ - 91 27 emit emit -; - -: ho ( -- ) \ Home cursor - escc 72 emit \ Esc-[H -; - -: cld ( -- ) \ Clear from current position to end of display - escc 74 emit \ Esc-[J -; - -: clear ( -- ) \ clear screen - ho cld -; - -: at-xy ( x y -- ) \ move cursor to x rows, y cols (1-based coords) - escc .# 59 emit .# 72 emit \ Esc-[%d;%dH -; - -: fg ( x -- ) \ Set foreground color - escc 3 .# .# 109 emit \ Esc-[3%dm -; - -: bg ( x -- ) \ Set background color - escc 4 .# .# 109 emit \ Esc-[4%dm -; - -: me ( -- ) \ Mode end (clear attributes) - escc 109 emit -; |