home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!waikato.ac.nz!canterbury.ac.nz!lincoln.ac.nz!wronz.org.nz!mentink
- Newsgroups: comp.lang.forth
- Subject: Re: e-forth has no DOES> !!!
- Message-ID: <1993Jan6.110721.90@wronz.org.nz>
- From: mentink@wronz.org.nz
- Date: 6 Jan 93 11:07:21 +1300
- Lines: 66
-
-
-
- Julian Noble writes,
-
- >Has anyone added DOES> to e-forth? I presume that with study I could
- >do it, but if someone else already has, I would rather not waste the
- >time. This is a time-critical question, as I am trying to put together
- >a Forth diskette for beginners, to be given away free at the Forth-
- >coming ACM meeting in Indiana. If Borland can give away large boxes of
- >C++ for free, why can't we do Forth?
-
- Hi,
-
- I have added the word DOES> to my eforth some time-ago, you have to also
- modify CREATE to make it work. The source is ::
-
- ;************** CREATE .. DOES> definer words **************************
-
- ; CREATE ( -- ; <string> )
- ; Compile a new dict entry without allocating code space.
- ; Modified with NOP for DOES> word use.
-
- %COLON 6,'CREATE',CREAT
- DC HEADER,COMPI,NOP
- DC COMPI,DOVAR,EXIT
-
- ; does> ( -- )
- ; Low level DOES> word.
-
- %COLON 5,'does>',DOEST
- DC LAST,AT,NAMET,DUPP
- DC DOLIT,BRAN,SWAP,DOLIT,4,PLUS,STORE,DUPP
- DC HERE,SWAP,DOLIT,6,PLUS,STORE
- DC COMPI,DOLIT,DOLIT,8,PLUS,COMMA
- DC COMPI,BRAN,EXIT
-
- ; DOES> ( -- )
- ; High level DOES> word. Executes at compile time
-
- %COLON IMEDD+5,'DOES>',DOES
- DC DOLIT,DOEST,COMMA
- DC DOLIT,DOLIT,COMMA
- DC HERE,DOLIT,6,PLUS,COMMA
- DC DOLIT,COMMA,COMMA
- DC DOLIT,EXIT,COMMA,EXIT
-
- ;**************************************************************************
-
- >By the way, does anyone know why they use FOR...NEXT rather than DO...LOOP
- >in e-forth? Is this what ANSI is leading us to?
-
- As far as I can tell FOR..NEXT is slightly faster than a DO..LOOP construct.
-
- I hope this helps ....
- Regards
-
- Bernie Mentink
- Christchurch
- New Zealand
-
- email: mentink@wronz.org.nz
-
- ---------- People reveal more by their questions than by their answers ---
-
-
-