[net.lang.forth] SPECIAL FIGIL POSTING

UMFORTH@WEIZMANN.BITNET (11/05/85)

-------------------------------------------------------------------
From the moderator:
FIGIL is happy to forward this material sent to us from the
East Tennesee Local FIGer's.  This is the first mailing of a
series which you can expect to continue, as long as Richard's
patience and stength last!   Thanks Richard....
-------------------------------------------------------------------


Date:    Mon,  4-NOV-1985 13:06 EST
From: SECRIST%OAK.SAINET.MFENET@LLL-MFE.ARPA
Organization: Science Applications Int'l. Corp., Oak Ridge, Tenn.
Geographic-Location: 36 01' 42" N, 84 14' 14" W

Greetings  fellow  FIGILs.   I  am  president  of  the  East
Tennessee  FORTH  Interest  Group  and I thought that edited
versions of our newsletters would be of interest to the net.
Hence  these  postings.   I  will wait to see if y'all think
this is a good idea before continuing,  but  I  think  these
will  probably  be  a  worthwhile  contribution.   I have of
course edited out all of  our  chapter-specific  stuff,  and
things  that we receive hardcopy may not make it in unless I
feel type-happy.  But since the bulk of what we usually  run
is  online,  you  will  see  most  everything.  If I hear no
objections, I will catch you up on the  back  issues  at  my
leisure  until  you're  up  to  date,  and then post current
issues.
                               Richard C. Secrist, President
   East Tennessee FORTH Interest Group, Oak Ridge, Tenn. USA

-------------------------------------------------------------------------------
Excerpts from the ET-FIG News                            Posting #1 in a series
-------------------------------------------------------------------------------
Volume 1, Number 2  **  East Tennessee FORTH Interest Group  **  30-August-1984
-------------------------------------------------------------------------------

                 F O R T H    B O O T S T R A P    E D I T O R

                            by Norman E. Smith, CDP



     The presentation by Art DuRae at the August Forth meeting  brought  up  one
problem  most  people  have  when  bringing  up FIG-FORTH from one of the public
domain listings.  There is no editor built into Forth to begin with.

     There are several line editors that are functional enough for  the  average
user.   The  problem is that they are all several screens long; just too much to
enter in IMMEDIATE mode.  Hence we came up with the "Bootstrap  Editor"  to  get
around  this  problem when we were putting up FIG-FORTH on our VAX.  People have
asked me about this problem several times since our Forth group has begun, hence
the  following  discussion  documenting  the  design  and  use of our "Bootstrap
Editor".

     The first consideration was that the  Bootstrap  Editor  had  to  be  small
enough  to  easily  enter in IMMEDIATE mode during one session.  We were getting
FORTH up at lunch over a couple of months.  It was desirable for the  editor  to
be  generic enough to run with little or no changes under any FORTH.  (I did the
prototype on my Kaypro in MVP-FORTH.) The result easily fits in one standard  16
line  Forth screen.  It was intended as a one-time tool so efficency and ease of
use were of little concern.  What mattered was that it worked  and  was  usable.
Once  I  got  the  prototype  working,  I  made changes only to fix problems.  I
believe in the old saying, "If it ain't broke,  don't  fix  it".   The bootstrap
editor was used to enter the full FIG line editor into our system.  The FIG line
editor was then used to enter the rest of the source screens.


Using the Editor:
-----------------

     The editing functions that the Bootstrap Editor can

     perform include:

                     o  list the screen
                     o  add/replace a new line to the screen
                     o  blank the entire screen

     The editor assumes that the screens and full Forth exist and was  initially
entered  by typing it in immediate mode.  It was then used to type in the source
itself and save it to a screen so it could be used in other sessions.

     The first step in using the Bootstrap Editor is loading  the  Forth  words.
It is in screen 20 in our system.  Type:

                     20 LOAD

     to load the editor.

     After the editor is loaded, you follow the following general steps:

                      o  Set up the screen to be edited,
                      o  Edit the screen,
                      o  Save the results.

     You identify the screen to be edited with the word BOOTSTRAP.  It takes the
screen  number  from  the  stack,  causes the screen to be read into memory, and
marks it for update.   The  entie  screen  can  be  initialized  with  the  word
NULL_BLK.

     Editing the screen consists of adding or replacing lines of text.  The word
AD  adds and replaces lines in the screen.  The line number (0-15) is taken from
the stack, the contents of the reference line is printed  along  with  a  column
reference line, the new line of text is entered, and the line of text is movedto
the screen.  No error checking is done of the line number.  Lines can be only be
added/replaced.   No  search  or editing wihin a line is supported.  (Remember I
said a one-time, brute force tool.)

     The results are saved with the Fig-Forth  wor  FLUSH.   You  can  list  the
screen  being edited at any time with the word LST.  If you wish to edit another
screen, start wth the BOOTSTRAP word again.

     The following is a sample editing session.  The screen to be edited is 27.


 20 LOAD                                        ( LOAD BOOTSTRAP )
 27 BOOTSTRAP                                   ( INIT EDITOR FOR SCR 27 )
 0 AD                                           ( ADD/REPLACE LINE 0 )
 LINE 0                                         ( LINE NUM ECHOED )
 THIS WAS LINE 0 OF SCREEN 27
+----+----+----+----+----+----+----+----+----+  ( COLUMN REF )
 *** THIS IS THE NEW LINE 0 OF SCREEN 27        ( NEW TEXT )
 FLUSH                                          ( SAVE SCREEN TO DISK )


The example does not use LST which can be used at any time  other  than  in  the
middle of AD.


Bootstrap Word Reference:
-------------------------

     The Bootstrap Editor is made up of 2 variables, LN and BUFADR, and 9 words.
LN  is  the  line buffer.  BUFADR is the pointer to the start of a screen bufer.
The following is the Bootstrap Editor Forth Glossary:


AD             ( line --- )
     Add/replace  line  number on the stack with a  new  line  of
     text.  The text string is prompted for.

BOOTSTRAP      ( screen --- )
     Initialize  the Bootstrap Editor  to edit the screen  number
     on the stack.

COLS           ( --- )
     Prints a column reference line on the screen.

LN_NULL        ( --- )
     Sets the contents of the line buffer to nulls.

LST            ( --- )
     Lists te contents of the screen being edited on the screen.

OLD_LINE       ( line --- )
     Fetches the line number specified on te stack and prints it
     to the screen.

NULL_BLK       ( addr count --- )
     Sets  the memory block starting at addr forlength of  count
     to  nulls.   Used in the Bootstrap Editor to initialize the
     line buffer.

READ_LINE      ( --- )
     Reads  a line from the keyboard and places it in the buffer
     LN.

REPL           ( line --- )
     Replaces  the  line  number specified by the  stack  of  the
     current screen with the contents of LN.



Bootstrap Source for FIG-FORTH
------------------------------

  0 ( SCR#20 - FIG-FORTH BOOTSTRAP EDITOR              NES - 8/83 )
  1 0 VARIABLE LN 72 ALLOT
  2 0 VARIABLE BUFADR
  3 : BOOTSTRAP BLOCK UPDATE BUFADR ! ;
  4 : LST CR 16 0 DO BUFADR @ I 64 * + DUP
  5    64 + SWAP DO I C@ EMIT LOOP CR LOOP ;
  6 : READ_LINE CR LN DUP 72 32 FILL 64 EXPECT ;
  7 : REPL 64 * BUFADR @ + LN SWAP 64 CMOVE ;
  8 : NULL_BLK OVER + SWAP DO I C@ 0= IF 32 I C! ENDIF LOOP ;
  9 : LN_NULL LN 64 NULL_BLK ;
 10 : COLS CR
 11 ." ----+----+----+----+----+----+----+----+----+----+----+----+"
 12       ;
 13 : OLD_LINE CR  64 * BUFADR @ + DUP 64 + SWAP
 14     DO I C@ EMIT LOOP  ;
 15 : AD DUP ." LINE  " . DUP OLD_LINE COLS READ_LINE LN_NULL REPL ;




Summary
-------

     The Bootstrap Editor is a useful tool in  bringing  up  a  FIG-FORTH  FORTH
system  initially.   It is small enough that it can be keyed-in and used to save
its source code to a screen in one session.  This makes it possible to enter one
of the more complete, but much longer line editors.  It served its purpose well.
[nes]


   +---------------------< BULLETIN BOARDS OF NOTE >-----------------------+
   |                                                                       |
   |  FORTH INTEREST GROUP BBS (24 hours, 300 baud):         415/538-3580  |
   |  Jim Altman RCP/M Atlanta (200mb online, lotsa SIG-M):  404/627-7127  |
   |  RCP/M Frog Hollow, Vancouver, BC (Mac stuff on B4:):   604/937-0906  |
   |                                                                       |
   +-----------------------------------------------------------------------+


                      *   F O R T H    D E M E N T I A   *


             : SONG
               SIXPENCE !
               BEGIN RYE @ POCKET +! ?FULL END
               24 0 DO BLACKBIRD I + @ PIE +! LOOP
               BAKE BEGIN ?OPENED END
               SING DAINTY-DISH KING ! SURPRISE ;


          (by Ned Conklin, quoted from FORTH DIMENSIONS I/6, page 63)



                   HOW TO JOIN THE FORTH INTEREST GROUP (FIG)
   (This is not how to join this list, but a recognized Int'l User Group.)

     Several people have asked how to  join  the  Forth  Interest  Group  (FIG).
Although  we  are of course a local chapter of FIG, the memberships to the Int'l
FIG are separate and strongly encouraged.  Membership includes their  bi-monthly
magazine,  FORTH  DIMENSIONS,  that is well worth the membership price of $15.00
per year. [ Note: As of 11/1/85 it is now $20.00 -- rcs ]

     At present we have no dues in the local chapter, and are putting it off  as
long as possible.  ET-FIG does not do not handle FIG memberships, although we do
provide FIG membership forms (see above).  The steps to  join  FIG  are  simple.
Fill  out  and  mail  the  form along with a check or money order payable to the
FORTH INTEREST GROUP in the amount of $15.00 to the address listed, or  to  call
FIG  directly  at  415/962-8653  and  charge  your  membership  on  your Visa or
MasterCard.  [nes]

[ end posting #1 ]

------------------------------------------------------------------------
------------------------------------------------------------------------

 Excerpts from the ET-FIG News                           Posting #2 in a series

 -------------------------------------------------------------------------------
  Volume 1, Number 11  **  East Tennessee FORTH Interest Group  **  03-Jul-1985
 -------------------------------------------------------------------------------
                            Book Review of
                         POCKET GUIDE TO FORTH

                       By: Norman E. Smith, CDP

 The POCKET GUIDE TO FORTH is the second book ET-FIG News has reviewed
 by  Linda  Baker  and  Mitch  Derick  recently.   It  is published by
 Addison-Wesley as part of their "Pocket Guide" series  that  includes
 guides to Basic, Cobol, Pascal, Wordstar, and several more.

 POCKET GUIDE TO FORTH is essentially the descriptive paragraphs about
 most  Forth  words  from the FORTH ENCYCLOPEDIA.  The guide is useful
 information, especially for the beginning Forth user.  The book is  a
 quick  and  compact reference to most "generic" Forth words, although
 fig-forth is the model used.  No references are made  to  an  editor,
 operating  system interface, or anything that ties it to any specific
 implementation.

 My biggest complaint is not with the technical content, but with  the
 binding  of  the book !  The cover is apparently designed so the book
 can be set up like an easel.  The pages are spiral bound, which is  a
 good  idea  for  a  reference book, but instead of being bound like a
 book it's bound at the top (AWFUL!).  The pages are flipped over  the
 top  until  you  reach the end of the physical pages, which is really
 only half-way through.  Then you reverse the book and  flip  back  to
 the  front.   I  found  this  VERY awkard when trying to use it.  The
 POCKET GUIDE be much more usable if it were spiral bound on the  LEFT
 side  like  a normal book !  My second complaint is that it like most
 "pocket" guides, it will NOT fit in a shirt pocket.  It  is  however,
 about the right size to fit in your back pants pocket.

 The POCKET GUIDE TO  FORTH  is  a  good  general  reference  for  the
 beginning to intermediate Forth user in spite of its awkward binding.
 If it was bound on the side, I might  even  consider  buying  a  copy
 myself.   The  review  copy  was  generously  loaned to me by Richard
 Secrist.  Many thanks.  If you have any Forth books that we have  not
 reviewed  yet,  please loan them to me for a week or so.  I will then
 review for the benefit of the entire group.

 [nes]



 Close Encounters of the Forth Kind:

            * CHARLES MOORE PRESENTS FORTH ENGINE AT ORNL *
                         by Richard C. Secrist

 Charles Moore, who invented the high-level  language  FORTH  some  12
 years  ago,  has  just  completed work on the first single-chip Forth
 Engine.  Moore recently spoke on the new processor at the  invitation
 of  the  Oak  Ridge  National Laboratory, which intends to employ the
 device in robotics and artificial intelligence research.

 In a small,  stuffy,  institutional  green  auditorium,  Moore  stood
 before  a  group  of  over  60 engineers and recounted the history of
 Forth and how his "private, personal programming language" became the
 basis  for  an  advanced  microprocessor.   Moore was as I had always
 pictured him, a calm, intelligent, and  humorous  man  with  a  glint
 mischeif  in  his  eye.   Speaking  on the acceptance of Forth in the
 so-called real world, Moore described Forth as  "an  uphill  battle."
 Even  though  Moore  believes  that Forth is "objectively superior to
 what the alternatives are", Moore said that "objective measures don't
 mean  much  in  the  human world".  "Most people would prefer [Forth]
 didn't exist", Moore said, not  because  it  was  a  threat,  but  "a
 distraction".   Moore  thinks that this view of Forth is so prevalent
 that he was "surprised to see this many  people"  turn  out  for  the
 talk,  and was "skeptical" that anybody in a place like Oak Ridge had
 any interest in Forth.  But as Moore  spoke  in  cool  and  confident
 terms  about  his  new silicon baby, he "didn't care" if the world at
 large  could  not  appreciate  the  significance  of  Forth  and  his
 accomplishments.   After all, Moore may soon vindicate himself in the
 eyes of the world with the tangible profits earned by the first  chip
 which directly implements a high-level computer language in silicon.

 Over the last four years Moore and his collegues  have  created  what
 may  truly  be  a  landmark  in  microprocessor technology; the Novix
 NC4000  microprocessor.   The  instruction  set  of  this  innovative
 machine  has a direct correspondence to high-level FORTH words.  What
 this means in terms  of  performance  is  staggering:   a  programmer
 writing  code  in  high-level  Forth  is  essentially writing exteral
 microcode for the NC4000.  Thanks to the custom-tailored architecture
 of  the  device,  the chip can perform high-level operations in Forth
 faster than a 68000 can processs 68K assembly language.   This  means
 that  the  initial  release  of the CMOS NC4000 can realistically out
 perform the 68000 in a variety of applications.  The implications  of
 a similar device in gallium arsenide are awesome.

 The concept of a computer language-engine is not new.  The premise of
 such  machines  is  that  one  encodes the primatives of a high-level
 language into a machine's instruction set to  realize  a  substancial
 gain   in   execution   speed.    This   is  typically  done  through
 microprogramming, which allows an engineer to use a form of ultra low
 level  programming  to implement instructions that can be used by the
 target machine.  During  execution,  the  processor  decodes  machine
 instructions   and   subsequently  invokes  a  sequence  of  internal
 microcode instructions which actually control the silicon components.
 This was the approach undertaken a number of years ago by the Western
 Design Center when they created their ill-fated Pascal engine.  It is
 also  the  basis  for  Nikalus  Wirth's  recent  Modula-engine  named
 Lillith.

 In the NC4000, however, bit  patterns  within  each  opcode  directly
 control  the  processor's components in silicon, completely bypassing
 the microcode step.  As a result, each instruction can be executed in
 a   single   clock   cycle   realizing  a  considerable  increase  in
 performance.   Furthermore,  because  the   processor   permits   the
 simulatenous  addressing of multiple memory spaces (main memory, data
 and return stack memory, and internal address I/O  space),  a  single
 instruction  can  result  in  the  execution of multiple Forth words.
 This is because the NC4000 reserves  single  bit  fields  within  its
 16-bit  instruction  for often-executed functions such as return from
 subroutine, divide,  and  several  types  of  shift  operation.   The
 implication  is  that  a  jump to a subroutine and return is actually
 possible in one clock cycle.  This is an important optimization since
 suboutine  calls  are  the  essence  of  what  Forth  is  all  about.
 Together, these characteristics account for the NC4000's  ability  to
 surpass  the  performance  of many conventional microprocessors by as
 much as an order of magnitude.

 One of the most fascinating applications of the power of  the  NC4000
 is  the  programmable  I/O  configuration  created by design engineer
 Robert Murphy.  Each of the 16-lines on the bus port  of  the  NC4000
 are  fully  programmable, allowing them to be interfaced to a variety
 of chips and busses.  Moore said that this flexability  allowed  even
 high  speed devices to be directly interfaced to the processor with a
 bare minimum of hardware devices.  This  power  was  evident  on  the
 alpha-test  system  Moore brought with him; the lines from the floppy
 disk were bit-banged directly  from  the  processor  without  a  disk
 controller  or  even  a  single  I/O support chip !  Once even faster
 versions of this architecture are available one is presented with the
 fantastic concept of systems without I/O controllers.  The tremendous
 possibilities for software-defined controllers could change the  face
 of how computer systems are interfaced all together.  These abilities
 could also permit significant  developments  in  parallel  processing
 applications  in  the  defense and AI markets.  Moore even speculated
 that  it  would  be  possible  to  build  LISP  machines  with   this
 architecture that could leave Symbolics machines in the dust.

 At  the  present  time  the  chip  is  being  manufactured  in  small
 quantities  by  Novix, Inc., the research and development partnership
 that has funded the development to date.  Moore  says  that  at  this
 time IBM and other companies are "not yet aware" of the chip but that
 at this time Novix is talking "quite earnestly" with Apple Computer.

 The NC4000 is about to go into beta release.  For  more  information,
 contact John Golden, General Manager; Novix, Inc.; 10590 North Tantau
 Avenue; Cupertino, CA 95014; 415/996-9363.

 [rcs]


Word of the Month

         * STRING: A FORTH WORD TO INITIALIZE A STRING ARRAY *
                        by Norman E. Smith, CDP

 Awhile back, a fellow Forth addict called wanting to know if I had  a
 word  to  load  ASCII  strings into memory arrays.  Forth provides no
 built in words to  initialize  arrays.   I  did  not  have  an  array
 initialization.   I  have wanted to initialize arrays/strings on many
 occasions, but never got around to writing a word  to  do  it.   Like
 most  other  things in Forth, an array initialization word is easy to
 write.  Most Forth string  packages  include  some  word  to  do  the
 initialization.  None of the Forth's I was using included any kind of
 string handling package.  After discussing what was needed,  I  ended
 up writing STRING.  I have used it alot since then.

 STRING expects the destination address on the stack.  It uses WORD to
 pick  up the string from the input stream and the destination address
 to point to where to save  the  string.   The  '/'  is  used  as  the
 delimiter for the input string.  An illustration of how to use string
 is in order:

          TABLE-ADDRESS STRING /This is the string/

 'This is the string' would be saved at TABLE-ADDRESS.  Of course  any
 delimiter   could  be  used.   I  followed  the  common  practice  of
 delimiting a string with the slash character.  The following  is  the
 code for STRING:

          : STRING   ( addr --- )
              47 WORD               ( get next word from input stream )
              HERE DUP 1+ SWAP C@   ( get length & addr )
              SWAP ROT ROT          ( set up stack for the move )
              CMOVE ;               ( move it )

 The code is self explanatory with the comments.  A couple  of  simple
 extentions to STRING come to mind.  First, the string delimiter could
 be passed to STRING as an argument on the stack.  The secons  one  is
 checking  for  a maximum length of the input string.  Both extentions
 would  make  STRING  slightly  more  powerful  with  a   very   small
 performance   penality.    (The  difference  would  probably  not  be
 detactable.) However, as written STRING satisfies at least 90% of the
 cases that would use it, is very simple, and therefore, desirable.

 A more complete example of using STRING is:

          CREATE FILENAME 25 ALLOT

          FILENAME STRING /forth.dat/

 The first line sets up an array of 25 bytes to hold a filename.   The
 next  line initializes FILENAME to "forth.dat".  If both lines are in
 your source code, STRING has the affect of initializing the array  at
 compile  time.   STRING  also works fine from immediate mode.  If you
 don't already have some equivalent to STRING, I think you  will  find
 it as useful as I did.  [nes]


[ end posting #2 ]
Acknowledge-To:  <UMFORTH@WEIZMANN>

hrp@cray.UUCP (Hal Peterson) (11/12/85)

In the newsletter contained in the above posting, Richard Secrist
refers to the Novix NC4000 as:

>  ... the first  chip
>  which directly implements a high-level computer language in silicon.

Though I'm not certain, I believe a group at MIT developed a chip which
directly implemented SCHEME (yet another LISP dialect) in silicon, and
they did it in 1980, give or take a couple of years.  I know that Guy
Steele, currently of Tartan Labs, was in on the project, and I think
that Gerry Sussman, an MIT professor, was there too.  What I'm not
sure of is whether it was a direct or microcoded implementation.  Anybody
out there know?  Anybody care?
-- 
Hal Peterson / Cray Research / 1440 Northland Dr. / Mendota Hts, MN  55120
	UUCP:  ihnp4!cray!hrp		phone:  (612) 681-3085