[comp.sys.amiga] M2Amiga, another bunch of answers

schaub@sugar.UUCP (Markus Schaub) (12/04/87)

Again several people mailed or posted comments and/or questions on
M2Amiga and Modula-2. I tried to keep the quotes as short as possible.

>>>difficult to use Modula-2 on the Amiga because _everything_ is written
>>>for C programming, most notably the RKM.  Is this problem any different
>>We faced this problem, using pointers extensively and playing a lot
>>with all different kinds of ROM stuff (always with Modula-2, starting
>>with our PD version (Fish #24)) we managed to get very close to C and the
>          I have been using Modula-2 (Benchmark) for about 5 months and
>      this has not been a problem.  I don't know about M2Amiga, but in
>      Benchmark all the RKM routines are supported and it is often easier

Modula-2 versions _can_ be a problem if the definition uses a variable
parameter instead of a pointer to the structure. In the Amiga OS you often can
give NIL (=NULL for C/TDI M2 people) to get default values. 

M2Amiga supports ALL RKM routines.

>      to deal with than using C because the listings of the .DEFs are
>      can be quite revealing  (often the best source I have).

Documentation of the RK is not the job of the developer of a compiler. For the
Amiga C Compiler (Lattice) this is a little bit different because these sources
were used to write the RK. (I assume) Our Defs contain all structures and 
procedures this makes it very easy to read them. If there are too many comments
in the Defs all you see are comments.

The list of procedures with all the requested parameters, their names and types
in a definition module is very helpful indead.

>>PROCEDURE Add (* $E-  equal to a label in Assembly *)
>>BEGIN
>> add D0, D1; RTS
>>END Add;
>      would you need to use INLINE statements to code the "Add" procedure
>      above?  (I assume you must, but just thought I'd ask, as an in-line

Yes, you still need the INLINE statement, we still believe that it is possible
to write everything in Modula-2, so we did not include an inline assembler. If
however you want to write Assembly code you can use the object converter to
convert your Assembler output into a M2Amiga object file. There you can even
use the Open/CloseLibrary mechanism and all other goodies of the runtime-system.
        
>          In general the only real disadvantage to using Modula-2 vs. C
>        as a dev. lang. for the Amiga seems to be the fact that so much
>        C source is available.  None the less, Modula-2 seems to be gaining
>        a foothold.  Because M2 should be much easier for a begginer to
>        learn, and the fact that M2 compilers are a relative bargain, more
>        and more people are likely to use it, and thus the shortage of
>        source will diminish.  I have noticed an improvement in just the
>        last few months.
>          I think that if the Amiga C users realized just how much faster
>        the compile-link-execute-debug cycle is using M2 as opposed to C
>        there would be many converts.

Yes, there is a lot of C source around. I translated a lot to Modula-2 and
I learned a lot doing it. I think, with little understanding of C, everbody
can get the substantial parts out of a C source. 

>  What would really make this possible would be a good interface
>  so that M2 routines could (without serious programming effort)
>  call C routines from an existing C library.  Lets face, if you
>  have a large collection of C routines, and you have to give them
>  up or convert them yourself in order to switch, your not going
>  to switch!

There is at least one other change for the compiler nessesary, adaption to
C parameter conventions, we can make a M2 procedure behave like a C proc but
not the other way around. (Small fix if needed).
To fit the C libraries into M2 environment is not easy. But I have some ideas
about doing this. Let's see if I find some time besides reading this newsgroup.
This could cause serious problems for a Source Level Debugger.

>either. I'm as big a 'C' bigot as anyone, but I'm still gonna give Modula
>a try.

First, thanx Peter for being open minded, I'm looking forward to your list
of comments, flames, ...

>> 	Modula II is *much* too wordy for my tastes... when I look at source
>> I want to see my PROGRAM, not a bunch of keywords.
>
>Me too. My biggest complaint with highly structured languages is that you
>can't see anything but the structure.

I'm currently working with a syntax directed editor for Modula-2 on the PC
and now that I'm used to it I think this is a good thing. Forget about
typing keywords, semicolons, indentation etc. Very nice features are wrap and
unwrap of LOOP/IF/WHILE etc statements. Select a block and say 'make an IF'.
Not yet available on the Amiga, and I don't know if it ever will be.

>In the latest (January) issue of AmigaWorld, Oxxi is advertising Benchmark
>Modula-2.  Does anyone have it or M2Amiga?  Could you send me (mail, please)

I hope they didn't forget our ad in AmigaWorld.

>your impressions of the two systems?  A comparison would be wonderful.
>	What library support is standard
>	How well does the integrated editor/compiler work

I have both systems but! (see disclaimer) I'm waiting for a comparison too.

NEWS:
Yesterday I recieved a few disks from Europe and I found a really nice
environment for M2Amiga on it. It is not integrated into the editor, it calls
the programs in correct order. It works with mouse and menus and I think this
will be the environment for our dynamic linker. There all modules are loaded,
linked and executed instead  of the conventional link / execute cycle. This
is very helpful during development because it loads always the latest version
of your modules.

-- 
     //	Markus Schaub		uunet!nuchat!sugar!schaub      (713) 523 8422
    //	M2Amiga Developer	trying to get back the money I  paid  for  my
\\ //				Amiga by selling a few M2Amiga.
 \X/	c/o Interface Technologies Corp, 3336 Richmond #323, Houston Tx 77098

schaub@sugar.UUCP (Markus Schaub) (12/04/87)

I forgot to mention that they started a Modula-2 (M2Amiga) PD Library in
Europe. I think this is a very good idea to support Modula-2. With shared
efforts there soon will be a resonable Software Library for Modula-2.

I hope this really works out. 

-- 
     //	Markus Schaub		uunet!nuchat!sugar!schaub      (713) 523 8422
    //	M2Amiga Developer	trying to get back the money I  paid  for  my
\\ //				Amiga by selling a few M2Amiga.
 \X/	c/o Interface Technologies Corp, 3336 Richmond #323, Houston Tx 77098

peter@sugar.UUCP (Peter da Silva) (12/05/87)

Markus:
> Me (Peter):
> >Me too. My biggest complaint with highly structured languages is that you
> >can't see anything but the structure.
> 
> I'm currently working with a syntax directed editor for Modula-2 on the PC
> and now that I'm used to it I think this is a good thing. Forget about
> typing keywords, semicolons, indentation etc. Very nice features are wrap and
> unwrap of LOOP/IF/WHILE etc statements. Select a block and say 'make an IF'.
> Not yet available on the Amiga, and I don't know if it ever will be.

That wouldn't be the M2SDS syntax directed editor, would it? I was about as
impressed with it as with any other syntax directed editor I've ever used.

That is, not at all. I know some people swear by them, but I've yet to find
one that's worth the effort. Some of the tools they provide are useful, but
just about all of them (autoindent, for example) are available without the
overhead.

Now, if you can do a GOOD version of "vi" for the Amiga in Modula, that'd
be a different matter. Start off with the ed-clone from "Software Tools"...
might even make me a convert :->.
-- 
-- Peter da Silva  `-_-'  ...!hoptoad!academ!uhnix1!sugar!peter
-- Disclaimer: These U aren't mere opinions... these are *values*.

wolf@ssyx.ucsc.edu (Mike Wolf,4264777) (12/06/87)

In article <1221@sugar.UUCP> schaub@sugar.UUCP (Markus Schaub) writes:
>>> 	Modula II is *much* too wordy for my tastes... when I look at source
>>> I want to see my PROGRAM, not a bunch of keywords.
>>
>>Me too. My biggest complaint with highly structured languages is that you
>>can't see anything but the structure.
>
>I'm currently working with a syntax directed editor for Modula-2 on the PC
>and now that I'm used to it I think this is a good thing. Forget about
>typing keywords, semicolons, indentation etc. Very nice features are wrap and
>unwrap of LOOP/IF/WHILE etc statements. Select a block and say 'make an IF'.
>Not yet available on the Amiga, and I don't know if it ever will be.
>
>     //	Markus Schaub		uunet!nuchat!sugar!schaub      (713) 523 8422

Last summer I was hired to do ADA programming under VMS.  (UCSC just has
UNIX)  The latest editor for VMS is called the Language Sensitive Editor.
I found the LSE more of an annoyance then anything else, and quickly
returned to using the TPU enviroment I have set up.  I found that using
LSE just slowed me down, because everytime I expanded the structure of
my program I got way more stuff then I wanted.  I wasted a lot of time
going through the options and the various structures just selecting the
ones I wanted.

At first I figured that the problem was just that ADA makes languages
like PASCAL look absolutly free form.  After trying the LSE on PASCAL
and C, I decided that it slowed me down in other languages also.  An LSE
style editor seems like it would only be useful for a group of people who
are experienced enough to know what all the structures are, but not
experienced enough so it's faster to just type it in yourself.  I suppose
it might prove useful to those who type slowly.

Structured languages may be necessary for some types of programming
projects, and they may ease program maintanence, but they're no fun. :-)

+------------------------------------+---------------------------------------+
|        Michael Wolf                | An old Scandinavian quote:            |
|  BITNET: wolf@ucscj.BITNET         |   "You can lead a herring to water,   |
|  ARPA:   wolf@ssyx.ucsc.edu        |    but you have to walk real fast,    |
|  UUCP: ...ucbvax!ucscc!ssyx!wolf   |    or else he'll die."                |
+------------------------------------+---------------------------------------+

daveh@cbmvax.UUCP (12/07/87)

in article <1221@sugar.UUCP>, schaub@sugar.UUCP (Markus Schaub) says:

> Yes, you still need the INLINE statement, we still believe that it is possible
> to write everything in Modula-2, so we did not include an inline assembler. 
> If however you want to write Assembly code you can use the object converter 
> to convert your Assembler output into a M2Amiga object file. There you can 
> even use the Open/CloseLibrary mechanism and all other goodies of the
> runtime-system.

Perhaps there's no need for assembler in general programming, but how about
building up Amiga libraries and devices.  Most compilers can't produce the 
required ROMTag, jump table, and especially assembler-specified entry points
into routines (args passed in registers instead of on the stack).  In C
I've done most of a device/library type item in C, but I still use the
Assembler to produce the jump table, ROMTag, and C compatible argument stack
for any objects that need parameters.

> I'm currently working with a syntax directed editor for Modula-2 on the PC
> and now that I'm used to it I think this is a good thing. Forget about
> typing keywords, semicolons, indentation etc. Very nice features are wrap and
> unwrap of LOOP/IF/WHILE etc statements. Select a block and say 'make an IF'.
> Not yet available on the Amiga, and I don't know if it ever will be.

The Emacs I used in college did this (not a MicroEmacs, the one from MIT
written in TECO, with CMU extensions) to a programmable extent, for Pascal.
You could tell it to capitalize your keywords, or give abbreviations for them
that would be expanded.  It knew about indentation and matching END with
BEGIN.  And if you really wanted it, you could tell it to build you an IF,
WHILE, REPEAT, PROCEDURE, etc. framework with all proper syntax.  They never
had it supply ";", but other than that it was kind of a painless version of
a syntax directed editor.  Gosling's emacs on another system there had
"Electric-C", a similar invention for C language.  These systems were pretty
nice.  However, just before I left school, they moved all the Freshmen to
their own VAX with a specialized Pascal environment and Pascal syntax-directed
editor.  This editor was very bad.  It enforced it's idea of what everything
should look like onto the user.  I knew a bit more about structure and 
syntax, but using it was so much pain, I was really glad I started 3 years
earlier.  So it can really go both ways.

>      //	Markus Schaub		uunet!nuchat!sugar!schaub      (713) 523 8422

-- 
Dave Haynie     Commodore-Amiga    Usenet: {ihnp4|uunet|rutgers}!cbmvax!daveh
   "The B2000 Guy"              PLINK : D-DAVE H             BIX   : hazy
		"I can't relax, 'cause I'm a Boinger!"

dillon@CORY.BERKELEY.EDU (Matt Dillon) (12/08/87)

>required ROMTag, jump table, and especially assembler-specified entry points
>into routines (args passed in registers instead of on the stack).  In C
>I've done most of a device/library type item in C, but I still use the
>Assembler to produce the jump table, ROMTag, and C compatible argument stack
>for any objects that need parameters.

	Err... Yer supposed to use MakeLibrary() for that, no?  (As I was
told after posting the first version of my example library).  Also, I figure
if people make their own custom libraries they can use whatever calling
sequence they want: in registers or on the stack.  Look at it this way:

	If your library routines are in C passing arguments on the stack
puts the burden of pushing them on the assembly programmer, but doesn't slow
anything down because if they were passed in registers, the burden would be
double ended (on both the library routines and the programmer).

	If your library routines are in assembly, passing arguments in 
registers puts the burden of placing them there on the assembly programmer
(as if you could get out of it), but doesn't slow anything down because if
they were passed on the stack instead, the burden would be double ended
with the assembly having to put them back in registers.

	So I figure it be up to the library implementor, yah?

					-Matt

schaub@sugar.UUCP (Markus Schaub) (12/14/87)

In article <2916@cbmvax.UUCP>, daveh@cbmvax.UUCP (Dave Haynie) writes:
> in article <1221@sugar.UUCP>, schaub@sugar.UUCP (Markus Schaub) says:
> 
> Perhaps there's no need for assembler in general programming, but how about
> building up Amiga libraries and devices.  Most compilers can't produce the 
> required ROMTag, jump table, and especially assembler-specified entry points
> into routines (args passed in registers instead of on the stack).  In C

This is my current project. I'm writing a special linker for devices and
libraries. This linker uses information from the definition module and the
object file. Args passed in registers is already implemented and used for
library calls. 

> Dave Haynie     Commodore-Amiga    Usenet: {ihnp4|uunet|rutgers}!cbmvax!daveh

-- 
     //	Markus Schaub		uunet!nuchat!sugar!schaub      (713) 523 8422
    //	M2Amiga Developer	trying to get back the money I  paid  for  my
\\ //				Amiga by selling a few M2Amiga.
 \X/	c/o Interface Technologies Corp, 3336 Richmond #323, Houston Tx 77098

louie@trantor.umd.edu (Louis A. Mamakos) (12/16/87)

Actually, its fairly trivial to produce the ROMTag structure, etc in a little
assembly language stub, and then call your C routine to do the real work.  I've
done this both in a stand-alone driver that lives in DEVS:, as well as a
device which installs itself using MakeLibrary() from inside an application
program.

Is this real difficult to do in Modula-2?  It was pretty easy in Aztec-C.


Louis A. Mamakos  WA3YMH    Internet: louie@TRANTOR.UMD.EDU
University of Maryland, Computer Science Center - Systems Programming