[comp.sys.amiga] M2Amiga, some answers.

schaub@sugar.UUCP (Markus Schaub) (11/23/87)

Sorry, this got long. It answers questions and remarks of several people.

>an interesting nitpick, but the designers of C wanted programmers to be able
>to make calls to the same routine with a varying number of arguments.  This

BUT also a big source for programming errors. Does your C compiler
complain if you call a 3 parameter procedure with just two parameters?
What is the result?  Nothing, strange behaviour or GURUs? How can you
find this bug? Maybe this is no problem for you, it definitely would
be one for me. This is my opinion, DON'T start any war C vs. Modula-2!

>difficult to use Modula-2 on the Amiga because _everything_ is written
>for C programming, most notably the RKM.  Is this problem any different
>for M2Amiga than for TDI?  I'm asking because I liked Pascal, really

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
ROM kernel. This also includes some changes in the code generation
part of the compiler, fuction results or internal representation of
BOOLEAN's etc.  I cannot give any comment on M2Amiga/TDI 'cause I just don't
know a lot about their compiler. To read the RKM, you still need some 
basic knowledge of C.

> Seems to me any cycles are important.  Perhaps not for general
>code, but when it comes to the decision as to weather or not to use
>assembly, this could make a difference.

In M2Amiga we rather optimized the compiler for the Amiga's needs
than going down to assembly. In M2Amiga there are NO parts that are
written in Assembly.

> PS: Matt, have you tried Modula-2?  I know your a C programmer, 
>           and just wondered if you'd given M2 a look.

Play around with the Demo Disk!

>and hide the grungy details in a separate procedure.  My goal, not
>always achieved, is to have the executable code of any procedure fit
>on a single, not too busy screen.

Good programming practice, I fully agree!

>compiler prompts for a new file to compile after having finished
>(or you can give all the file names on the command line in CLI).

If the loading time is longer than compilation time, you have to find
a way to reduce overall time. It is also very easy to write a file
containing all file names (one each line) of the modules of your program
( in correct order) and then call the compiler:
		m2c <compileMyModules
I'll have to write a program to generate these files automatically. (make)

>  Seems like a good solution to me.  I'd like to know more about this
>  $E option.  If it is clean, and relocatable (??) this should work quite

$E- does not produce any entry or exit code for this procedure. No loading
of the global data's address into a register, no allocation of local variables
on stack, no dynamic link and at end not even a RTS. Very usefull for VERY
dirty tricks!

PROCEDURE Sub; (* $E- *)
BEGIN
 invert value in register D1
END Sub;

PROCEDURE Add (* $E-  equal to a label in Assembly *)
BEGIN
 add D0, D1;
 RTS
END Add;

You can call this Assembly programming without leaving the Modula-2 env.
Other options prevent the generation of parameter deallocation code, used
for procedures supplied to the ROM kernel. (Makes them C procedures)

>When will the M2Amiga Source Level Debugger be released?  Will it be
>included in the $195 price?  

$199 intro $249 retail. No not to my knowledge. I really don't know
anything from the business side of the debugger. As soon I know I'll
let you know too. Release Date, last thing I heard was end of the year.

>What libraries are included?

here comes the list: Sorry it is compressed, could look nicer.
Modules (dir)
  Libraries (dir)
sym (dir)
  Arguments.sym      ASCII.sym Conversions.sym    Coroutines.sym
  FFPConversions.sym FFPInOut.sym FileMessage.sym    FileNames.sym
  FileSystem.sym     Heap.sym InOut.sym   LongRealConversions.sym
  LongRealInOut.sym  MathLib0.sym MathLibLong.sym    RandomNumber.sym
  RealConversions.sym	RealInOut.sym Scan.sym    Storage.sym
  Strings.sym Terminal.sym Windows.sym 
 obj (dir)
 ... object files for these libraries if they have one (ASCII does not!) ...
System (dir)
 sym (dir)
  Arts.sym    MathFFP.sym MathIEEEDoubBas.sym	MathREAL.sym
Interfaces (dir)
 sym (dir)
  Audio.sym   BootBlock.sym Clipboard.sym      Console.sym
  ConUnit.sym DiskFont.sym Dos.sym     Exec.sym
  ExecSupport.sym    Expansion.sym GamePort.sym	GfxMacros.sym
  Graphics.sym	Hardware.sym Icon.sym    Input.sym
  InputEvent.sym     Intuition.sym Keyboard.sym	KeyMap.sym
  Layers.sym  MathTrans.sym Narrator.sym	Parallel.sym
  Printer.sym PrtBase.sym Resources.sym      Serial.sym
  Timer.sym   TrackDisk.sym Translator.sym     Workbench.sym

Hope that answers most of your questions!
-- 
     //	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

haitex@pnet01.cts.com (Wade Bickel) (11/23/87)

schaub@sugar.UUCP (Markus Schaub) writes:
>
>Sorry, this got long. It answers questions and remarks of several people.
>
>>an interesting nitpick, but the designers of C wanted programmers to be able
>>to make calls to the same routine with a varying number of arguments.  This
>
>BUT also a big source for programming errors. Does your C compiler
>complain if you call a 3 parameter procedure with just two parameters?
>What is the result?  Nothing, strange behaviour or GURUs? How can you
>find this bug? Maybe this is no problem for you, it definitely would
>be one for me. This is my opinion, DON'T start any war C vs. Modula-2!
>

          Also, you can easily duplicate this type of parameter passing
       by simply setting up your parameters as a list of data at the end
       of a pointer and dealing with it at the beggining of the routine.
       Alternatively you could push the data onto the stack prior to the
       call and have your routine pop it of on entry.  Both methods are
       a little dirty, but then so is the way C handles it's params.

>>difficult to use Modula-2 on the Amiga because _everything_ is written
>>for C programming, most notably the RKM.  Is this problem any different
>>for M2Amiga than for TDI?  I'm asking because I liked Pascal, really
>
>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
>ROM kernel. This also includes some changes in the code generation
>part of the compiler, fuction results or internal representation of
>BOOLEAN's etc.  I cannot give any comment on M2Amiga/TDI 'cause I just don't
>know a lot about their compiler. To read the RKM, you still need some 
>basic knowledge of C.
>

          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
      to deal with than using C because the listings of the .DEFs are
      can be quite revealing  (often the best source I have).

>> Seems to me any cycles are important.  Perhaps not for general
>>code, but when it comes to the decision as to weather or not to use
>>assembly, this could make a difference.
>
>In M2Amiga we rather optimized the compiler for the Amiga's needs
>than going down to assembly. In M2Amiga there are NO parts that are
>written in Assembly.
>

          This was my comment and what I meant was that a few saved cycles
        at the beginning of a call might usually be insignificant, but
        sometimes can be very important.  The better the compiler at 
        optimizing the call, the less likely that I will be forced to
        use assembly to write a given time critical routine.  Sorry if
        I was unclear in my original comment.

>>  Seems like a good solution to me.  I'd like to know more about this
>>  $E option.  If it is clean, and relocatable (??) this should work quite
>
>$E- does not produce any entry or exit code for this procedure. No loading
>of the global data's address into a register, no allocation of local variables
>on stack, no dynamic link and at end not even a RTS. Very usefull for VERY
>dirty tricks!
>
>PROCEDURE Sub; (* $E- *)
>BEGIN
> invert value in register D1
>END Sub;
>
>PROCEDURE Add (* $E-  equal to a label in Assembly *)
>BEGIN
> add D0, D1;
> RTS
>END Add;
>
          
          This was also my comment.  Would this example compile as shown, or
        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
        assembler like the one in my MANX compiler would be useful, as would
        access to an intermediate assembly file).

>-- 
>     //	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


        
          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.

          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!

                                                 Thanks and Good Luck,

                                                        Wade.

                        PS: Opps!  beginner, not Begginer.


UUCP: {cbosgd, hplabs!hp-sdd, sdcsvax, nosc}!crash!pnet01!haitex
ARPA: crash!pnet01!haitex@nosc.mil
INET: haitex@pnet01.CTS.COM

cmcmanis@pepper.UUCP (11/23/87)

In article <1104@sugar.UUCP> schaub@sugar.UUCP (Markus Schaub) writes:
>>an interesting nitpick, but the designers of C wanted programmers to be able
>>to make calls to the same routine with a varying number of arguments.  This
>
>BUT also a big source for programming errors. Does your C compiler
>complain if you call a 3 parameter procedure with just two parameters?
>What is the result?  Nothing, strange behaviour or GURUs? How can you
>find this bug? Maybe this is no problem for you, it definitely would
>be one for me. This is my opinion, DON'T start any war C vs. Modula-2!


Well the Lattice C compiler (>= 3.10) supports prototyping that will
notify you if you have the wrong number of arguments and if they are 
the wrong type. It also lets you *not* specify the total number of
arguments (like just the first three) is you so desire. Note that I
like Modula 2 and I like C, I use C because that way I don't have to
switch compilers when I get home from work :-) But I do own two M2
compilers, and my wife won't touch C (being a Mesa fan that she is).

--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.

dillon@CORY.BERKELEY.EDU.UUCP (11/25/87)

>BUT also a big source for programming errors. Does your C compiler
>complain if you call a 3 parameter procedure with just two parameters?

	Prototyping fixes this.  But even so, it certainly is NOT a big source
of programming errors.  In all my experience I have never called a subroutine
with the wrong number of parameters.

	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.

					-Matt

peter@sugar.UUCP (11/30/87)

Marshall Dillon:
> Markus Schaub:
> >BUT also a big source for programming errors. Does your C compiler
> >complain if you call a 3 parameter procedure with just two parameters?
> 
> 	Prototyping fixes this.  But even so, it certainly is NOT a big source
> of programming errors.  In all my experience I have never called a subroutine
> with the wrong number of parameters.

Now, now. Haven't you ever called fread with read's arguments (mild flame
may be optionally inserted here, aimed at the people who designed STDIO and
changed the order and number of parameters from read to fread)? Have you
never called putc(fp, c), fooled by some other stdio function that took the
file pointer first? It's not the biggest problem, but it's not negligible
either. I'm as big a 'C' bigot as anyone, but I'm still gonna give Modula
a try.

> 	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.
-- 
-- Peter da Silva  `-_-'  ...!hoptoad!academ!uhnix1!sugar!peter
-- Disclaimer: These U aren't mere opinions... these are *values*.