aboutsummaryrefslogtreecommitdiff
path: root/forth/forth/help.fs
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-09-29 01:02:00 +0200
committerDimitri Sokolyuk <demon@dim13.org>2018-09-29 01:02:00 +0200
commit79cabd5b1c8bcd9f50dc49e77776e713a57dff48 (patch)
tree6eb73857e9c174610839291cf05a02d77fc82b8c /forth/forth/help.fs
parent247df3bb9d4c89d4e5ff18dcc23ba1c9532f28c0 (diff)
parent110a6411bae421260476eacf6173897c1d1f4b8a (diff)
Merge branch 'master' of dim13.org:elegoo
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
+;
+