[comp.lang.forth] Amiga Forth Newsletter V1, #1

thomson@utah-cs.UUCP (Richard A Thomson) (03/07/88)

This first one's a little long, but I thought I would at least post it so
that the other people in comp.lang.forth can see what we're doing.  I won't
post the following issues unless there is sufficient response from the net
to warrant doing so.  After all, I could always add people to the mailing
list.
						Rich Thomson
-----
Amiga FORTH Newsletter
Volume 1
Number 1
March 7th, 1988

Contents:
		Introduction
		JForth and Amiga Forth mailing List
		FStrings Package
		"Hello World!" Program
		Standard Amiga FORTH Prelude
		FIG -- The Forth Interest Group

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

Subject: Introduction
From: thomson@cs.utah.edu (Richard A Thomson)

    Hello,
	 I started this newsletter as a collection of names of people who
    would like to receive information about programming in FORTH on the
    Amiga.  Many people have responded (more than I expected!) and I will
    be summarizing who is on the list below.  Right now this list exists
    only as a mail alias for me, so the list is unfortunately one-way.  I
    will be broadcasting submissions back out to the list that are sent to
    me.  I will get this set up as a full-blown list when I find out how
    (I'm in the process, but any help is greatly appreciated).

	 Here is a list of the current membership with their comments (if
    any) that they sent me.  My comments on their comments (nested comments?)
    appear inside brackets [].

    e-mail		 			real life
    --------------------------------		------------------------
    thomson@cs.utah.edu				Richard A Thomson
	"I thought up this newsletter and I am programming in Multi-Forth
	for the advantages of rapid prototyping and development on a
	minimally configured Amiga."

    mccarrol@topaz.rutgers.edu			Mark C. Carroll
    ut-sally!harvard!applix!scott		Scott Evernden
	"Actively interested in FORTH for about 7 years."

    ut-sally!gatech!dcatla!mclek		Larry E. Kollar
	"I'd like to listen in until I have my system, at which point I may
	start trying to contribute."

    pmy@vivaldi.acc.virginia.edu		Pete Yadlowsky
    boulder!onecom!cadovax!kaz			Kerry Zimmerman
	"I don't know what a net mailing list is, but if it has to do with
	FORTH, I'm interested.  For good examples of FORTH, and specifically
	MULTI-FORTH check out the files on CompuServe's CSI forum (go forth).

	Are you familiar with the Forth Interest Group?  They put out a
	bi-monthly magazine called, "FORTH DIMENSIONS".  It usually has
	examples of forth code and forth techniques." [More on FIG below]

    fetrow@bones.ms.washington.edu		Dave Fetrow
    newton@oswego.oswego.edu			Eric Newton
	"I am working on a program for the Conway Game of Life.  I would
	really like to see some examples involving the manipulation of the

    yann@ai.toronto.edu				Yann le Cun
    leadsv!flournoy@Sun.COM			David Flournoy
	"I have JFORTH and like it.  As a beginner, any code is useful as
	a learning tool."

    jmlake%uicsrd.csrd.uiuc.edu%uxc.cso.uiuc.edu@uxc.cso.uiuc.edu
    						John Michael Lake
	"Please add me to the forth mailing list (Multi-forth, mvp forth,
	tiny forth on various machines)."

    tom%mills.Berkeley.EDU@jade.berkeley.edu	Tom Erbe
    richmond@cs.utah.edu			David Richmond
	"I ... would like to mention a couple of forth thoughts.  First,
	the expertise of forth on that bulletin board appears to me to
	be quite poor, some better places to see some interesting forth
	is to get involved with the forth interest group [FIG]; I have
	some applications if your interested ... Also the company I work
	for has a commercial product written by myself and Wade Olsenin
	[in] forth.  If you have any interest in seeing it let me know.
	[Please satiate my thirst for Forth!  This is exactly what this
	newsletter is about: seeing real-world examples of Forth. -- RT]
	( But I am missing some of the hardware to show it off).  Also
	if your real interested and serious in getting something going,
	I think we could pursue creating a forth interset group chapter
	locally.  [See last item for more info. about this --RT]
	    "I suspect the Orem [Utah] chapter of FIG is completely inactive.
	I personally have not yet joined FIG, but am planning on it as soon 
	as there is a good reason.  I have no access to an Amiga (But I
	would like to have one)."

    bennete@nyssa.cs.orst.edu			Erik John Bennett
	"I do not know very much about FORTH, but I want to learn.  I have
	MVP-Forth and an Amiga 2000 with 2 floppies."

    phil%mills.Berkeley.EDU@jade.berkeley.edu	Phil Burk
	Phil Burk is head honcho at Delta Research, the creators of JForth.
	His reply to the formation of the newsletter has been moved to
	its own article below.

    marcus@newton.physics.purdue.edu		Marcus D. Gabriel
	"I ... am using Multi-Forth by CSI.  I am a theoretical physicist, 
	specifically a relativist, and not a programmer.  My present
	research requires no need for programming, althought future
	projects will change this, and I thus would classify myself as
	a FORTH hobbyist."

    ut-sally!mcnc.org!sas!bts			Brian T. Schellenberger
	"I have had my Amiga for over a year and have not done any Forth
	programming in that time.  After using only C ... I've decided
	that I really want to go back to Forth."


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

From: phil%mills.Berkeley.EDU@jade.berkeley.edu (Phil Burk)
Subject: JForth and Amiga Forth Mailing List

Rich,

Yes please, put me on your mailing list.  If there is any
information you need for your newsletter, please let me know.
Delta Research has just undergone a reorganization so
you will probably be seeing a lot more activity around
JForth in the near future.

Our new address is:
	Delta Research
	P.O. Box 1051
	San Rafael, CA
	94915
	(415) 485-6867

The latest news about JForth is that we now have a working
target compiler.  We are currently in the testing stages
and will be releasing a new version sometime in the summer.
The target compiler takes a large JForth image and creates
a small target that has all unnecessary code and data removed.
Thus all name fields are gone, all uncalled words, like VLIST, etc.
A 100K application can end up as small as 10-20K depending on
how much fat there is.
This makes the development of CLI commands and other small
applications, as well as fairly small advanced applications
feasible.  Before, a CLI command like DIR would have been
about 70-80K. Now it should be less than 10K.
We are making target compilation available as a service
until we release the new version.  If a JForth
programmer has a finished application that they would
like to see crunched down, they can send it to us.
We will perform the target compilation and send the result back.
This will help us further test the target compiler.
This should should address the single major complaint about JForth,
that JForth applications are too big.
We have gotten very good feedback on almost all other aspects
of JForth so this will be a welcome addition.  

Regarding a common Amiga development environment, there may be some
problems.  We developed JForth because of what we saw as major
shortcomings in MultiForth.  The calling of library routines
by number instead of name, having to explicitly store parameters
in the registers, and the absence of a complete set of includes 
seemed unacceptable to us.  I believe that, in the meantime,
MultiForth has addressed some of these problems but we have
ended up with quite different interfaces to the Amiga
libraries.  JForth offers several features like calling by name,
automatic parameter storing in registers, all includes
which can be referenced using a 'C' like syntax without
knowledge of member size, ie. byte, word or long.
We consider these features, plus the 3-5 times faster execution,
to be the main reason to buy JForth over MultiForth.
If we offered these features to MultiForth users then we would
be doing a great service to our major competitor.
I hate to sound so "businessy" but the alternatives are to
add MultiForth-like features to JForth which would be a step
backwards, or to come up with a third completely different
interface which would complicate the issues even further.
I appreciate the advantages to the users to have a uniform
Amiga interface but that can be easily achieved if everyone bought
JForth :-) .

Many of the words in JForth and MultiForth are similar,
like INCLUDE ANEW WORDS and both conform to Forth '83
so porting between the two systems is not overly difficult.

I would like to continue to discuss this issue, however,
so please keep me posted on what's happening.  Please remember
that putting JForth include files and structure support
with MultiForth as public code would violate JForth's copyright.
I really hate being so negative about this but I hope that
you will understand that this area is where we distinguish our
product from the competition so we are naturally touchy about this.

Glad to hear that you are putting out a newsletter.  Keep an eye
out for UBZ.  The fellow from Georgia says he may be releasing a third
Forth for the Amiga sometime soon.
Call or email anytime,
Phil Burk

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

Date: Sat, 5 Mar 88 18:50:49 EST
From: marcus@newton.physics.purdue.edu (Marcus D. Gabriel)
Subject: FStrings Package

Rich Thomson
thomson@cs.utah.edu

Dear Sir:

  To give you an idea of some of my interests and present level, I have
done a little BBSing on the Easth Coast Forth Board (ECFB) (703-442-8695)
where I have taken George T. Hawkins' FSTRINGS package, FORTH 83 standard,
( See Martin Tracy's favorable write up of Hawkins' work in Dr. Dobb's
Journal, Dec 87) and extensively adopted it to Multi-Forth.  If the AFML
gets off the ground, I would enjoy submitting my adoptation of George
T. Hawkins' work.  I think it is well written code, because of George 
T. Hawkins, and I believe one can learn a great deal from it, I certainly
did.  Besides, this enthusiastic string package is just plain useful.

  In general, I am very interested in being able to share and discuss
source code and general ideas in FORTH, and of course, I am interested
in learning about this enjoyabe machine, the Amiga, through FORTH.

Marcus D. Gabriel
marcus@newton.physics.purdue.edu

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

Date: Sunday, March 7th 1988
From: Richard A Thomson (thomson@cs.utah.edu)
Subject: Re: FStrings Package

For those of you who have not seen Martin Tracy's review in Dr. Dobb's
Journal, FStrings is a full string package for Forth.  Unfortunately I
don't have the review with me, but Martin Tracy did recommend it highly.
Since Marcus Gabriel has already taken the trouble of porting it to
Multi-Forth (and as Phil Burk says 'porting between the two should be
easy' so JForth'ers shouldn't have any trouble), I suggest he post it
posthaste!  Being such a highly recommended package it would be a good
thing for all of us to peek at as well.

As an aside, Martin Tracy's Forth column in Dr. Dobb's Journal is one of
the few places aside from FIG where you can see Forth code published and
talked about.  Byte doesn't really carry much on it anymore (but then,
just what does Byte talk about these days besides IBM PC clones?) and the
other magazines keep at least one ten foot pole around to keep Forth away.

						Rich Thomson

PS: I did see mention of a Forth-based language for scientists called
    Asyst in _Research and Development_, Feb 88, pg. 100.  Asyst v1.56, by
    ASYST Software Technologies, Rochester, NY looks like your basic
    Forth interpreter with some special support for doing data analysis.
    
-------------------------------------------------------------------------

Date: Sunday, March 7th, 1988
Subject: "Hello World!" Program
From: Richard A Thomson (thomson@cs.utah.edu)

To start the source code examples, I'm posting the Multi-Forth equivalent
of the "Hello World!" program in the Intuition Manual (pg. 2-10, 2-11)
I haven't exactly used good Forth style (lots of small words).  You can
see this in my definition for the word OpenStuff, which initializes the
NewScreen structure, opens the screen, initializes the NewWindow structure,
and opens the window.  A better way to do this would be to have one word
to do each of those four tasks and then define OpenStuff as follows:

: OpenStuff
    InitMyScreen
    OpenMyScreen
	IF 
	    InitMyWindow
	    OpenMyWindow NOT
		IF
		    CloseMyScreen
		    QUIT
		THEN
	THEN
    ;

Where the words OpenMyWindow and OpenMyScreen return a non-zero value if
they are successful.  Note that they should already have saved the
pointers since I don't save them in OpenStuff.  This is exactly what the
routines OpenWindow and OpenScreen do in Multi-Forth.  They store the
returned pointer in the variables CurrentWindow and CurrentScreen,
respectively.  This is why I have used the words iOpenWindow and iOpenScreen
as I am saving the pointers myself to follow the example in the Intuition
manual more closely.

Another thing I noticed I could do was to replace the sequence
``" <string>" count type'' with ``." <string>"'' which does exactly the
same thing, but is a little more straight forward.  Enjoy.


\
\ Hello_World.f
\
\ A Multi-Forth "Hello World!" program similar to the C example on pages
\ 2-10 and 2-11 in the Intuition manual.
\
\ Rich Thomson
\ Sunday, March 7th, 1988
\

anew HELLO_WORLD_F

\ Create the structures we need to open a new screen with a window.

struct NewWindow MyWindow     \ Structure for window parameters
struct NewScreen MyScreen     \ Structure for screen parameters
create MyFont                 \ Text Attribute structure for screen's font.
   0" topaz.font" ,           \ +taName
   TOPAZ_EIGHTY w,            \ +taYSize
   FS_NORMAL c,               \ +taStyle
   FPF_ROMFONT c,             \ +taFlags

variable ScreenPointer        \ Pointer returned by OpenScreen goes here
variable WindowPointer        \ Pointer returned by OpenWindow goes here

: OpenStuff
   MyWindow MyScreen LOCALS| sp wp |    \ NewScreen, NewWindow pointers
   sp InitScreen              \ Initialize NewScreen structure to defaults
   0"  My Screen " sp +nsDefaultTitle ! \ set screen title
   MyFont sp +nsFont !        \ Use font described above
   sp iOpenScreen ?dup        \ Could we open the screen?
   if
      ScreenPointer !         \ Yes, save the pointer returned.
   else
      " Couldn't open screen!" count type cr quit  \ Argh!
   then
   wp InitWindow
   wp +nwFlags @ SMART_REFRESH | GIMMEZEROZERO | wp +nwFlags !
                              \ Or in smart refresh and zero-zero flags
   fCLOSEWINDOW wp +nwIDCMPFlags !  \ we want close events
   200 wp +nwWidth w!  100 wp +nwHeight w!   \ width & height
   0"  My Window " wp +nwTitle !    \ Title for our new window
   CUSTOMSCREEN wp +nwType w!       \ this window is on custom screen
   ScreenPointer @ wp +nwScreen !   \ Save pointer to the screen
   wp iOpenWindow ?dup        \ Can we open the window?
   if
      WindowPointer !         \ Save pointer to window
   else
      " Couldn't open window!" count type cr
      ScreenPointer @ CloseScreen quit \ close screen and die
   then
   ;

: HelloWorld ( x\y -- )       \ Writes "Hello world!" at (x,y) in window
   WindowPointer @ +wdRPort @ \ Get pointer to window's rastport
   LOCALS| rp y x |           \ First local gets top, last gets bottom arg.
   rp x y Move                \ Move to specified location
   rp 0" Hello world!" 12 Text      \ Write the text
   drop
   ;

: HelloMany                   \ Write ten "Hello world!" strings in window
   10 0 do
      I 1+ 10 * dup TOPAZ_EIGHTY + HelloWorld
   loop
   ;

: CloseStuff
   WindowPointer @ CloseWindow      \ Close window
   ScreenPointer @ CloseScreen      \ Close screen
   ;

: HelloWorld!
   OpenStuff
   HelloMany
   WindowPointer @ +wdUserPort @ +mpSigBit c@ \ Get signal bit
   1 swap scale eWait drop     \ Wait for close event
   CloseStuff
   ;

HelloWorld!                         \ Say hello to the world

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

Date: Sunday, March 7th, 1988
From: Richard A Thomson (thomson@cs.utah.edu)
Subject: Standard Amiga Forth Prelude

Martin Tracy in his Forth Column in Dr. Dobb's Journal has cooked up the
notion of a "standard prelude" that is loaded before your program to
handle the various idiosyncracies of different Forth implementations
in order to make code more portable.

I threw out the idea of creating a Standard Amiga Forth Prelude so that
there wouldn't be any modification of programs written for JForth or
Multi-Forth as long as they used relatively standard things (i.e. no
mucking about in the internal guts for performance statistics gathering).

Phil Burk replied:
> Regarding a common Amiga development environment, there may be some
> problems.  We developed JForth because of what we saw as major shortcomings
> in MultiForth.  The calling of library routines by number instead of name,
> having to explicitly store parameters in the registers, and the absence of
> a complete set of includes seemed unacceptable to us.

I don't want to start a JForth/Multi-Forth war, but as your have surmised:

> MultiForth has addressed some of these problems but we have
> ended up with quite different interfaces to the Amiga
> libraries.

CSI (creators of Multi-Forth) had solved all of these problems by the time
I bought their package around the time 1.2 came out.  They call library
routines by name (actually all library routines are called by a number
at some point since the function "number" is really a jump offset to the
library vector), parameters to named library calls are on the stack and
there is a complete set of include files (which you definately need for
any development language on the Amiga),

> the 3-5 times faster execution, to be the main reason to buy JForth
> over MultiForth.

Of course both manufacturers claim higher operating speed :-).  Multi-Forth
claims that they are faster than JForth.  Who's right?  I don't know since
I don't have a copy of JForth to compare MF against.  Suffice to say that
I picked one over the other since they are about the same price.  Is there
a standard set of Forth benchmark programs?  If there is, let's run them on
both JForth and Multi-Forth and compare the results.  We should also gather
a couple of benchmark programs that use features of the Amiga for comparison
as well.  (Open and close a window one-hundred times in a row?)

> Many of the words in JForth and MultiForth are similar,
> like INCLUDE ANEW WORDS and both conform to Forth '83
> so porting between the two systems is not overly difficult.

This is what makes me think that as long as we don't talk about things like
how libraries are accessed internally between the two systems, we should
be able to right a prelude that would allow a 'well-behaved' program to
be instantly portable between JForth and Multi-Forth.  The Forth '83
standard and Martin Tracy's standard prelude go a long way in completing
this job.  Are they just so different its not worth the bother?  Should
we just settle for using Tracy's '83 standard prelude?

						Rich Thomson

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

Date: Sunday, March 7th, 1988
From: Richard A Thomson (thomson@cs.utah.edu)
Subject: FIG -- Forth Interest Group

I am trying to find out how to start a Forth Interest Group Chapter for
Salt Lake City.  The FIG publishes a bulletin called Forth Dimensions,
which are good reading.  There is an indicator next to all the articles
that denotes the level of complexity of the article.  There are articles
on all topics ranging from simple things to mucking with the interpreter
itself!

The address of the Forth Interest Group is:

		Forth Interest Group
		P.O. Box 1105
		San Carlos, California  94070

This address comes from an old (1984) copy of Forth Dimensions, but it
should still be good.  If it's not, somebody please send me the new one
and I'll post it.  It's a good idea to write to FIG and find out it there
is a local chapter in your area.  That's a good way to meet other Forth
programmers and learn some tips from them.  Plus you could show them all
the nifty things your Amiga can do!

						Rich Thomson

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