[comp.sys.amiga] C vs. Assembler

dmg@ssc-vax.UUCP (David Geary) (06/16/88)

>In article <312@pedro.UUCP> (Pete Ashdown) writes:

>To this day, I still haven't learned a structured language.  I _tried_ to get 
>into 'C', but I found out quickly that I was uneasy not knowing _exactly_ what 
>was going on with my program.  I prefer assembly, simply because I feel that 
>I am more in control.  Speed has another thing to do with it.  I know 'C' can 
>be very fast for some programmers, but I think it would end up being very 
>slow code for me, simply because I am a beginner at it.  Above all, I want to 
>write games on the Amiga.  After seeing Marble Madness kludge its scrolling, 
>I don't think that 'C' is the language I am looking for.  I really haven't 
>seen "brilliant game #1" that was written in 'C'.  It also may have something 
>to do with the fact that I loaned out my K&R and haven't gotten it back 
>yet :-). 
  
>Thanks for your suggestions.  I may just turn back to examining 'C'.  I have 
>already done program #1 to some extent in assembly.  Should I turn back to 
>'C' or should I keep going with assembly?  I'd be curious to find out from 
>other 68000 assembly programmers (like Mark R.) how they got started. If they 
>went from 'C' to assembly or just started out in assembly. 

    Unlike many C programmers, I have never done any serious assembly, however,
I am well-versed in C, having taught it for over 2 years.
I can understand your preferring assembly because it gives you more control.
I always recommend that my students (in an introductory C class) do two
things to become better at C:

1)  Read other people's C source.
2)  Learn assembly.

    I do not recommend that they actually USE assembly (although I have nothing
against assembly), but it helps tremendously if you understand some assembly
when learning C.  It's much easier to comprehend how arguments are "passed"
if you understand concepts like a stack ;-)

    I get tired, though, of claims such as:  WRITTEN ENTIRELY IN ASSEMBLY
FOR MAXIMUM SPEED AND SMOOTH RESPONSE.  Give me a break.  When you are
writing C code you ARE writing in assembly - call it Power Assisted
Assembly ;-).  Sure, there are some assembly gurus out there who
could take the assembly output by a C compiler, and optomize it for
more speed, but I think our current compilers on the Amiga are good
enough so that the gains made by optomization of the assembly are
rarely justifiable, and/or rarely make a significant difference in speed.

   As for games, well, I'm currently working on a game called 
"brilliant game #1" ;-).  Actually, it's an Arkanoid clone, which is about
halfway done, and is entirely in C.  At first, I had some problems
with speed, but it was due to a lack of understanding the Amiga, not
problems with C being too slow.

   C will give you the ability to "think" in a higher-level language,
and still give you most of the benefits of assembly.  C will also
give you SOME degree of portability.  C's portability is a bit
overstated in my opinion, but for sure, it'll be more portable than
assembly.

  I'd recommend that you take the time to learn C.  The fact that you
already know assembly will help you tremendously when learning C.  My
best students are ALWAYS assembly programmers.  As an assembly language
programmer with no HHL experience, C is the perfect choice.  If you
are concerned with C "doing things under the covers" that you cannot
control, you can always look at, and/or change the assembly output
by your C compiler.

Good luck on your games...

 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ "...They don't give a damn,		~
~     about no trumpet playin' band	~
~     It aint what they call  		~
~     rock and roll..."			~
~					~
~	      Sultans of Swing		~
~               Dire Straits            ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 
 
-- 
***********************************************************
* David Geary, Boeing Aerospace Co., Seattle, WA 	  *
* I disclaim all disclaimers....			  *
***********************************************************

peter@sugar.UUCP (Peter da Silva) (06/18/88)

Oh yes, Tracers is written entirely in 'C', and when we showed it to Rick Ross
at Discovery Software he seemed to think it was totally hacked out assembly.

In fact, we don't even do our own blits...
-- 
-- `-_-' Peter (have you hugged your wolf today?) da Silva.
--   U   Mail to ...!uunet!sugar!peter, flames to /dev/null.
-- "A foolish consistancy is the hobgoblin of little minds".

cks@ziebmef.uucp (Chris Siebenmann) (06/23/88)

In article <2008@ssc-vax.UUCP> dmg@ssc-vax.UUCP (David Geary) writes:
...
>...............  Sure, there are some assembly gurus out there who
>could take the assembly output by a C compiler, and optomize it for
>more speed, but I think our current compilers on the Amiga are good
>enough so that the gains made by optomization of the assembly are
>rarely justifiable, and/or rarely make a significant difference in speed.

 Unfortunately, Aztec C usually produces noticeably sub-optimal code,
as did old version of Lattice (I haven't seen the output of Lattice
4.0; anyone care to comment on its code quality?). Atzec C is a good
base-level optimizing compiler; it gets most of the basic
optimizations like common subexpression elimination (I won't call
constant folding an 'optimization'; I call compilers without it
'brain-damaged' instead), but compared to GNU C or Greenhills C it has
a long way to go.

-- 
	But he said leave me alone I'm a family man
	And my bark is much worse than my bite
Chris Siebenmann		uunet!utgpu!{ontmoh!moore,ncrcan}!ziebmef!cks
cks@ziebmef.UUCP	     or	.....!utgpu!{,ontmoh!,ncrcan!brambo!}cks