Mach2, Internet
Volume Number: 6
Issue Number: 6
Column Tag: Jörg's Folder
Mach2 and InterNet
By Jörg Langowski, MacTutor Editorial Board
Mach2 - any news?
Mach2 Forth is still alive and well - at least on my Macintosh. For me, it
remains the ideal vehicle to test new system features, new managers, etc. because of
the incremental compilation (Forth !), its well-designed assembler and the possibility
to program and debug very ‘close to the machine’ - at each stage, you can very easily
keep track of what your program is actually doing in detail.
Just to prove that others are using Mach2 to develop applications of very
important size, here’s a letter from Switzerland:
“Hello Jörg,
Brief Intro:
FORTH (MacFORTH and MACH1&2) user since the advent of the Mac 128K.
Project manager and coauthor of a 50k line MACH2 ECG analysis program, now
maintaining and reworking the whole program alone.
My Question: Do you know anything about the state of Palo Alto Shipping Company.
I was in Palo Alto in November 89 for one week and tried to reach Lori Chavez. I
presume the company died because only the answering machine responded to my calls,
nobody called back despite the messages I left, nobody was at the company’s office and
they even stopped advertising in MacTutor. I would be more than happy to hear that
they are still up and running, but if my assumptions are correct, the further
development of our product will be severely crippled when System 7.0 arrives.
Thank you for responding
Werner Thie, Winterthur, Switzerland”
[I have noticed similar things. There is an answering machine at PASC’s number,
(415) 688-1111, but I haven’t been successful at reaching them, either. Also, there
have been almost no more new messages on the Mach2 round table on GEnie for months,
and none at all from PASC. I hope this is not going to end like the NEON story that
after a while we’ll be in a position to try and get Mach2 into the public domain,
because the company has abandoned the product. It would be a real shame, given the
qualities of Mach2. I am sorry I cannot give you better news for now. Does anyone else
out there know more? Please write or drop us a link.]
One can learn a lot about Macintosh code segmentation in general - not only
applied to Mach2 - from a note that reached me from Norway:
“Dear Jörg,
Included is a ‘Bug report’ and a short talk on NEW-SEGMENT, things I have had to
discover the hard way. Can this be of any use as a MACH2-Forth revival for MacTutor?
Or has the world of C++++, MWP This, MWP That, Lisp, Serieus, Hypercard, Pascal
Supercharge , Oooops, done away with all the “Mac”-Forthers?
Several months ago, I have written to Palo Alto Shipping reporting about the
above named bug and hoping to receive an answer on a Why-does this happen? question.
I think, they are busy MacApping...
I believe Mach2 Forth is a viable alternative on the Macintosh, and I would hate
to see it disappear. I believe there is still a lot of scope for improvement.
Conrad Weyns
Film/Video sound technician
Oslo, Norway”
Conrad’s note on code segmentation follows:
Use of NEW-SEGMENT in Mach2
Important considerations that are NOT documented anywhere in the Mach2
manual.
Developing any reasonably sized application in Mach2 Forth, will sooner or later
bring one to the issue of CODE segmentation. Not only because of the 32K limit in
relative addressing, a necessity for relocatable code [on 68000 machines, not on the
68020 and higher - jl], but also because dividing the application into logical entities
that use memory only when needed seems a good practice.
Code segmentation becomes a key issue and is in fact very much in tune with the
Forth idea of “Factoring”.
In the Mach2 manual we are told that we can use NEW-SEGMENT any number of
times and need simply to precede the words that will be referenced in later segments
with GLOBAL.
Jörg Langowski suggested in the Jan89 issue of MacTutor to gather all
VARIABLEs, MACH words and Compiler utilities in one segment, as this segment is only
needed for compilation and can consequently be removed from the final TURNKEYed
application [CONSTANT in MACH2 does not use any code (dictionary) space, only
vocabulary space which in the turnkey gets discarded anyway. So the above represents
no winning for CONSTANTs. This is very different in other Forth implementations!].
This is a good idea, though easier said than done. It can be very hard to know so
early in the development process just how many variables you are going to need and
WHAT good descriptive name to give them. Remember the issue of this talk is
Segmentation and Reasonably Large Program Size (e.g. 10-15 user segments and a
total size close to 200K bytes).
Having to back up and recompile 10 segments just because you need a new
variable is a pain in the and after all, we are using Forth because we love it, and
sequential loading-testing-debugging of small quantities is the name of the game. If you
would have to recompile everything every time, why use Forth [Yeah, why? Might as
well use C++ then jl].
Mach2 manual p.61: GLOBAL will add the next word defined to a linked list of
words which should be given jump table entries the next time a NEW-SEGMENT is
made. Use GLOBAL sparingly, it adds 8 bytes to the program size for each definition
(a jump table entry is 8 bytes long).
In reality, NEW-SEGMENT adds the 8 byte jump table entry to the MACH2 CODE
0 resource, which is the jump table. It adds to that resource which is already over 4K
large because it contains entries for all existing predefined MACH2 words. This is why
the MACH2 application ‘grows’ after each NEW-SEGMENT.
TURNKEY is the word that actually copies the whole of the MACH2 CODE 0 rsrc
into your application.