aboutsummaryrefslogtreecommitdiff
path: root/forth/forth/help.fs
diff options
context:
space:
mode:
Diffstat (limited to 'forth/forth/help.fs')
-rw-r--r--forth/forth/help.fs68
1 files changed, 68 insertions, 0 deletions
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
+;
+