From 2f83a0bea9da444e3d70569eba3d6847ca02be03 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Fri, 21 Sep 2018 21:59:17 +0200 Subject: ... --- forth/forth/help.fs | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 forth/forth/help.fs (limited to 'forth/forth/help.fs') diff --git a/forth/forth/help.fs b/forth/forth/help.fs new file mode 100644 index 0000000..8128b6a --- /dev/null +++ b/forth/forth/help.fs @@ -0,0 +1,68 @@ +\ ******************************************************************* +\ * +\ Filename: help.txt * +\ Date: 03.03.2014 * +\ FF Version: 5.0 * +\ Copyright: Mikael Nordman * +\ Author: Mikael Nordman * +\ ******************************************************************* +\ FlashForth is licensed according to the GNU General Public License* +\ ******************************************************************* +-help +marker -help +ram hex + +$1b constant esc +$09 constant tab +$0d constant ret +$0a constant nl + +flash hi $32ff - constant ahelp \ Start of help text area +ram + +: h= ( caddr caddr1 u -- flag ) + swap !p>r + for + c@+ pc@ p+ - + if drop false rdrop r>p exit then + next + r>p drop true +; + + +: .help ( addr -- ) + cr + begin + c@+ dup emit ret = + until + cr drop +; +: help ( "name" -- ) + bl word \ addr + dup c@ 0= if words abort then + ahelp !p>r + begin + busy pause idle + @p over c@+ h= if @p .help r>p drop exit then + begin + pc@ ret = pc@ nl = or + p+ + pc@ ret <> pc@ nl <> and + and + until + pc@ [char] | = + until + r>p drop +; + +: loadhelp ( -- store help info ) + ahelp !p>r \ Help info stored here + begin + key + dup emit + dup pc! p+ + [char] | = + until + r>p +; + -- cgit v1.2.3