home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / forth / 3773 < prev    next >
Encoding:
Text File  |  1993-01-06  |  2.1 KB  |  75 lines

  1. Path: sparky!uunet!wupost!waikato.ac.nz!canterbury.ac.nz!lincoln.ac.nz!wronz.org.nz!mentink
  2. Newsgroups: comp.lang.forth
  3. Subject: Re: e-forth has no DOES> !!!
  4. Message-ID: <1993Jan6.110721.90@wronz.org.nz>
  5. From: mentink@wronz.org.nz
  6. Date: 6 Jan 93 11:07:21 +1300
  7. Lines: 66
  8.  
  9.  
  10.  
  11. Julian Noble writes,
  12.  
  13. >Has anyone added DOES> to e-forth? I presume that with study I could
  14. >do it, but if someone else already has, I would rather not waste the
  15. >time. This is a time-critical question, as I am trying to put together
  16. >a Forth diskette for beginners, to be given away free at the Forth-
  17. >coming ACM meeting in Indiana. If Borland can give away large boxes of
  18. >C++ for free, why can't we do Forth?
  19.  
  20. Hi,
  21.  
  22. I have added the word DOES> to my eforth some time-ago, you have to also
  23. modify CREATE to make it work. The source is ::
  24.  
  25.   ;************** CREATE .. DOES> definer words **************************
  26.  
  27. ;   CREATE    ( -- ; <string> )
  28. ;        Compile a new dict entry without allocating code space.
  29. ;        Modified with NOP for DOES> word use.
  30.  
  31.         %COLON    6,'CREATE',CREAT
  32.         DC    HEADER,COMPI,NOP
  33.         DC    COMPI,DOVAR,EXIT
  34.         
  35. ;   does>  ( -- )
  36. ;       Low level DOES> word.
  37.  
  38.         %COLON    5,'does>',DOEST
  39.         DC    LAST,AT,NAMET,DUPP
  40.         DC    DOLIT,BRAN,SWAP,DOLIT,4,PLUS,STORE,DUPP
  41.         DC    HERE,SWAP,DOLIT,6,PLUS,STORE
  42.         DC    COMPI,DOLIT,DOLIT,8,PLUS,COMMA
  43.         DC    COMPI,BRAN,EXIT 
  44.  
  45. ;   DOES>  ( -- )
  46. ;       High level DOES> word. Executes at compile time
  47.  
  48.         %COLON    IMEDD+5,'DOES>',DOES
  49.         DC    DOLIT,DOEST,COMMA
  50.         DC    DOLIT,DOLIT,COMMA
  51.         DC    HERE,DOLIT,6,PLUS,COMMA
  52.         DC    DOLIT,COMMA,COMMA
  53.         DC    DOLIT,EXIT,COMMA,EXIT
  54.  
  55.   ;**************************************************************************
  56.  
  57. >By the way, does anyone know why they use FOR...NEXT rather than DO...LOOP
  58. >in e-forth? Is this what ANSI is leading us to?
  59.  
  60. As far as I can tell FOR..NEXT is slightly faster than a DO..LOOP construct.
  61.  
  62. I hope this helps ....
  63. Regards
  64.  
  65. Bernie Mentink
  66. Christchurch
  67. New Zealand
  68.  
  69. email: mentink@wronz.org.nz
  70.  
  71. ---------- People reveal more by their questions than by their answers ---
  72.  
  73.  
  74. 
  75.