[comp.sys.atari.st] Mixing C and Assembly

dinapoli@rodan.acs.syr.edu (Ron DiNapoli) (05/02/90)

Has anyone out there managed to mix Mark Williams C and assembly code?  If so, 
what assembler was used?  If MWC wont let you do it (I've heard rumors to
this effect) is there another C compiler that WILL let you??  Please email
responses and I'll summarize to the net.

Thanks a lot

Ron DiNapoli
Applied Logic Systems, Inc

ron%als.com@logiclab.cis.syr.edu
dinapoli@sunrise.acs.syr.edu
dinapoli@rodan.acs.syr.edu

hyc@math.lsa.umich.edu (Howard Chu) (05/03/90)

In article <3140@rodan.acs.syr.edu> dinapoli@rodan.acs.syr.edu (Ron DiNapoli) writes:
>Has anyone out there managed to mix Mark Williams C and assembly code?  If so, 
>what assembler was used?  If MWC wont let you do it (I've heard rumors to
>this effect) is there another C compiler that WILL let you??  Please email
>responses and I'll summarize to the net.

This isn't exactly the clearest of questions. The Mark Williams package
comes with an assembler, what else do you need? The entire Mark Williams
software suite is pretty closely modeled after a Unix programming environment,
and all the tools reflect that orientation. In particular, the object file
format used by their compiler, assembler, and linker is a proprietary format,
and not what you get out of the DRI assembler. Also, the syntax used in the
assembler is pretty much the same as you'll see on a Unix system. 

If what you're really asking is "does MWC let you use inline assembly code
in your C source files" the answer is no. But it's a simple matter to pull
out the inline code and assemble it separately using their assembler. 
--
  -- Howard Chu @ University of Michigan
  ... the glass is always greener on the side ...

dillenbu@uicbert.eecs.uic.edu (05/03/90)

  I use Assempro from Abacus and MWC together.  I compile the
Assempro source code into PC-relocatable form with a header at the
beginning containing the addresses of each routine.  Then, I run a MWC 
program that converts the object file into MWC format.  I am then able
to link these files and MWC object files together.  Unless you planning
on doing some heavy duty assembly language programming, I suggest you
stick to the MWC assembler.  The only nice thing Assempro offers
is macros.  By the way, I had to create the conversion program myself.
   dillenbu@uicbert.eecs.uic.edu
   John Dillenburg

ignac@electro.UUCP (Ignac Kolenko) (05/03/90)

In article <11900@stag.math.lsa.umich.edu> hyc@math.lsa.umich.edu (Howard Chu) writes:
>In article <3140@rodan.acs.syr.edu> dinapoli@rodan.acs.syr.edu (Ron DiNapoli) writes:
>>Has anyone out there managed to mix Mark Williams C and assembly code?  If so,
[stuff deleted]
>This isn't exactly the clearest of questions. The Mark Williams package
>comes with an assembler, what else do you need? The entire Mark Williams
>software suite is pretty closely modeled after a Unix programming environment,
>and all the tools reflect that orientation. In particular, the object file
>format used by their compiler, assembler, and linker is a proprietary format,
>and not what you get out of the DRI assembler. Also, the syntax used in the
>assembler is pretty much the same as you'll see on a Unix system. 
>
>If what you're really asking is "does MWC let you use inline assembly code
>in your C source files" the answer is no. But it's a simple matter to pull
>out the inline code and assemble it separately using their assembler. 



from experience here at electrohome, i'd say that Mark Williams C 
has probably the most rediculous, non standard, brain dead, stupid assembler
i've ever seen for the MC68000. nothing in it makes any sense, like how
to make a register list, the naming conventions for labels, etc. also,
why the hell are comments started with a bloody '/' character??? it makes
porting of assembly files a REAL hassle. like Howard says, the object
file format is completely proprietary, so you can't use a world class
assembler such as MadMac (in the atari devkit) with the MWC environment.
blech!  :-(

we've switch over to Manx C for internal development on the Atari, and
i have to admit that it is probably one of the best environments you
can get for the Atari ST. it comes with a NORMAL assembler, the compiler
generates reasonably efficient code, and it supports a number of code
models which my other favorite, Laser C, doesn't yet. 

i think i've gotten off topic ... hope this all helps!



-- 
=====Ignac A. Kolenko (The Ig)=====watmath!watcgl!electro!brasoft!ignac======
     co-author of QuickST, and the entire line of Quick Software!!!!
  Branch Always Software Box 2624, Station B, Kitchener, Ont. CANADA N2H 6N2
=============================================================================

woodside@ttidca.TTI.COM (George Woodside) (05/04/90)

In article <1716@electro.UUCP> ignac@electro.UUCP (Ignac Kolenko) writes:
>from experience here at electrohome, i'd say that Mark Williams C 
>has probably the most rediculous, non standard, brain dead, stupid assembler
>i've ever seen for the MC68000. nothing in it makes any sense, like how
>to make a register list, the naming conventions for labels, etc. also,
>why the hell are comments started with a bloody '/' character??? it makes
>porting of assembly files a REAL hassle. like Howard says, the object
>file format is completely proprietary, so you can't use a world class
>assembler such as MadMac (in the atari devkit) with the MWC environment.

I was a bit surprised to read this. While I haven't used it, I know that
MadMac has a switch for writing MWC compatible output. That should
eliminate most of the problems quite quickly.

I have to agree with the complaints about the MWC "as" syntax, but I
do understand the reasons. Their documentation states that the syntax
of their compilers and assemblers is common across all development
platforms. So, while it may be bizarre for any one specific machine, it
maintains the same standards for all. The '/' comment deliniator is an
obvious carryover from C syntax. Most of the assembler is designed
to be a compiler back end, not a general purpose assembler. I may find it
as clumsy as anyone else, but I do realize why it is that way.

-- 
* George R. Woodside - Citicorp/TTI - Santa Monica, CA *
* Path:       woodside@ttidca                          *
*   or:       ..!{philabs|csun|psivax}!ttidca!woodside *

dag@persoft.com (Daniel A. Glasser) (05/07/90)

The assembler shipped with the Mark Williams C package uses a Unix V7 style
syntax.  The object file format is also modeled after the Unix V7 object file
format, allowing for long symbol names (the object format supports flexnames,
the compiler doesn't generate them) and the symbol table is case sensitive.

MADMAC was produced by Atari long after MWC shipped its compiler package
and the object file format was pretty much determined.

When the MWC object file format was determined there was no acceptable
standard available.  As a result they ported their Coherent object format
and tools to the 68000 and the Atari ST.  (Coherent is a ground-up/clean-room
implementation of Unix V7.)

The compiler can be made to generate Motorolla style assembly with an
undocumented switch (which I cannot recall at this moment, try -VMOTO or
something like that), and there are converters available for MWC->DRI and
DRI->MWC object files.  Note that the Alcyon/DRI compiler uses the leading
"_" on symbol names, whereas the MWC compiler uses a trailing "_".  The
converters handle this.

						Daniel A. Glasser
-- 
  Daniel A. Glasser  |  Persoft, Inc.  |  dag@persoft.com (if it works yet)
  "Their brains were small, and they died."