Searching \ for 'C versus asy example' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/language/index.htm?key=c
Search entire site for: 'C versus asy example'.

Truncated match.
PICList Thread
'C versus asy example'
1999\03\28@001009 by Chris Eddy

flavicon
face
Fellow Technologists;

I just finished porting a piece of Assembly to HiTech's C compiler.  I
was pleasantly suprised by the results, so thought I would share them.
The original Asm file assembled to use 603 words of ROM and 108 words of
RAM.  When converted to C, the compiler generated 557 words of ROM and
102 words of RAM ( I say word, but mean byte).  So I trimmed a little
bit of RAM and ROM.  And now I don't rip out chunks of hair trying to do
16 bit math and array sorting in assembly.

If there are any fence sitters out there, get over here on this side of
the fence quick.  The water is warm and the sky is clear. This compiler
will pay for itself in just a few months.

Chris Eddy, PE
Pioneer Microsystems, Inc.

1999\03\28@012052 by Gerhard Fiedler

picon face
At 23:59 03/27/99 -0500, Chris Eddy wrote:
>The original Asm file assembled to use 603 words of ROM and 108 words of
>RAM.  When converted to C, the compiler generated 557 words of ROM and
>102 words of RAM ( I say word, but mean byte).

i always suspected that the figures which claim that assembler is tighter
assume "fully optimized assembler". who has time for that? only the fellows
who design for products sold in the millions. and the ram is the same
story, the compiler simply does a pretty good job of allocating local
(temp) storage.

>If there are any fence sitters out there, get over here on this side of
>the fence quick.  The water is warm and the sky is clear. This compiler
>will pay for itself in just a few months.

welcome on the sunny side of the fence! :)

ge

1999\03\28@104521 by Wagner Lipnharski

picon face
So you just compared what the C compiler did against what YOU did in
assembler.
Not trying to judge your capacity in asm, are you sure you did the best
you can in asm?
Remember that what the C compiler produced was exactly an assembler
code...
Wagner

Chris Eddy wrote:
{Quote hidden}

1999\03\28@122312 by Ross

flavicon
face
I'm a big time assembler and I can beat any (C) compiler
I agree with Wagner Lipnharski people are lazy these days
and want to you c compilers to do everything the easy way.

You get out what you put in saving 52 bytes I nothing. I you
smart you save more byte buy using unused memory and
fully understand what your goals are to accomplish.

//Ross


(HANWE)

----------
: From: Wagner Lipnharski <spam_OUTwagnerlTakeThisOuTspamEARTHLINK.NET>
: To: .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU
: Subject: Re: C versus asy example
: Date: Sunday, March 28, 1999 7:44 AM
:
: So you just compared what the C compiler did against what YOU did
in
: assembler.
: Not trying to judge your capacity in asm, are you sure you did the
best
: you can in asm?
: Remember that what the C compiler produced was exactly an assembler
: code...
: Wagner
:
: Chris Eddy wrote:
: >
: > Fellow Technologists;
: >
: > I just finished porting a piece of Assembly to HiTech's C
compiler.  I
: > was pleasantly suprised by the results, so thought I would share
them.
: > The original Asm file assembled to use 603 words of ROM and 108
words of
: > RAM.  When converted to C, the compiler generated 557 words of
ROM and
: > 102 words of RAM ( I say word, but mean byte).  So I trimmed a
little
: > bit of RAM and ROM.  And now I don't rip out chunks of hair
trying to do
: > 16 bit math and array sorting in assembly.
: >
: > If there are any fence sitters out there, get over here on this
side of
: > the fence quick.  The water is warm and the sky is clear. This
compiler
: > will pay for itself in just a few months.
: >
: > Chris Eddy, PE
: > Pioneer Microsystems, Inc.

1999\03\28@130640 by Bob Blick

face
flavicon
face
At 09:19 AM 3/28/99 -0800, you wrote:
>I'm a big time assembler and I can beat any (C) compiler

Hey Chris, sounds like you've got volunteers to write free code for you
while you sip umbrella drinks at the beach :-)

Cheers,
Bob

http://www.bobblick.com/

1999\03\28@133414 by Wagner Lipnharski

picon face
Not trying to start another battle here, but it is just a matter to
learn things. I can't write assembler code as fast as I can do it in C,
so, I don't see the point that C is easier.  When I think about a
function in "C", I almost see the same routine in assembler, so why let
somebody else decide how your software will be, if you can do it by
yourself?

Yes, I agree with you, for some people easier than write code in C is
just seat in the beach and ask somebody else to do it.  :) .. for those,
my company doors (and other companies too) will be always closed.

Remember, Cobol writers are making from $100 to $250/hour right now,
just because lots of people just decided that there are easier ways to
do things, without never learn the basics of pure and simple
programming.  I guess that there are a great percentage of high-school
students that can't multiply 25x37 without a calculator, not that it is
necessary, but it is somehow as important as when you make physical
exercises preparing your body for other jobs, as for example, live
better and healthier.

Bob Blick wrote:
{Quote hidden}

1999\03\28@180856 by Chris Eddy

flavicon
face
Ross wrote:

> I'm a big time assembler and I can beat any (C) compiler
> I agree with Wagner Lipnharski people are lazy these days
> and want to you c compilers to do everything the easy way.
>

Ouch! lazy! that does hurt.  I have done at least 40 or more complete
products, hardware and software.  I have covered 8 pin, 5X, 14000, and
7X.  I have measured pulse periods to 1uS with a 4MHz crystal.  PID
control in SW.  I am an authorized PIC consultant.  I write nice tight
clean code.  Nobody was more suprised than me that the compiler won out.

But let's be honest.  As a consultant, I can't be satisfied with doing an
anal job at a piece of code.  (there.. were even).  Every customer wants
to know how much the job will cost.  I proved that a relatively seasoned
effort MIGHT be beaten out by the compiler in a fraction of the time.
Try this equation:

   Cost of software=hours of dev X rate per hour + reliability of code X
it is in the field.

The one case I will concede is that asy MAY excel in ultra fast timing,
and may train the programmer to learn the machine much more intimately.

> : So you just compared what the C compiler did against what YOU did
> in: assembler.
> : Not trying to judge your capacity in asm, are you sure you did the
> best you can in asm?

It was the best that I could do, yes.  Then there are folks like Warren,
Payson, and Dmitry (you know who you are) that elevate to a new level of
genius.  If you let them at a piece of code, when they are done, all bets
are off.  I do not claim to match their level of intelligence.  If I can
buy a compiler that incorporates their smarts at the speed of Pentium,
then I will be satisfied, and apply my efforts to the remainder of the
mountain of work.

Chris Eddy
Pioneer Microsystems, Inc.

1999\03\28@182126 by Chris Eddy

flavicon
face
Wagner Lipnharski wrote:

> Not trying to start another battle here, but it is just a matter to
> learn things. I can't write assembler code as fast as I can do it in C,
> so, I don't see the point that C is easier.  When I think about a
> function in "C", I almost see the same routine in assembler, so why let
> somebody else decide how your software will be, if you can do it by
> yourself?
>

The code that I ported had a bunch of 16 bit variables in it.  I had to
capture a bunch and then sort and analyze them.  The device analyzes an
ignition signal from a car (ANY car, which is even harder).  When I ported,
the math, array sorting, comparing, and casting became absolutely trivial.
The other project is a hall effect metal thickness analyzer, with a delta
sigma A/D and long (read 32 bit) math in it.  The compiler did it without
complaint.  I don't propose to lean on the compiler like a lard.  You won't
find me posting messages looking for someones finished I2C master routine
that I can plug in and forget.  Like any tool, it can be misused.  I have
adopted numerous projects from companies where the code was buggy in the
field.  I can assure you, there are a portion of engineers out there that
haven't got a clue how to write a solid assy program, and yet they tried.
Single threaded code on a '73 where the interrupts weren't even running, and
yet he was trying to time everything out in seconds.  I won't insult these
folks, they just need to learn alot.  But if you can hand them a compiler and
keep them out of trouble, why not?

Chris Eddy
Pioneer Microsystems, Inc.

1999\03\28@183336 by Ross

flavicon
face
Again I have been around since the 8008 days
if you want good code you can write in what ever
you want.

Being a consultant for PIC  you should have developed
an asy LIB you do not have to re invent the will every
time you write code in asy.

People have  the idea that the person writing a good c compiler
that can optimizes asy should know that it can at times make
your code larger or bigger on simple code.

I'm an asy and love it because you can not debug c code
as you could in asy its the processors native code or closer.

I have tried all kinds c compilers and I still bet you if you
keep a good lib you can be just efficient in writing code
in asy. Some guys want a free lunch for the time they

spend coding. But just remember the only free lunch you
get is the one you have worked for and earned it.



//Ross


(HANWE)

----------
: From: Chris Eddy <ceddyspamKILLspamNB.NET>
: To: .....PICLISTKILLspamspam.....MITVMA.MIT.EDU
: Subject: Re: C versus asy example
: Date: Sunday, March 28, 1999 3:04 PM
:
: Ross wrote:
:
: > I'm a big time assembler and I can beat any (C) compiler
: > I agree with Wagner Lipnharski people are lazy these days
: > and want to you c compilers to do everything the easy way.
: >
:
: Ouch! lazy! that does hurt.  I have done at least 40 or more
complete
: products, hardware and software.  I have covered 8 pin, 5X, 14000,
and
: 7X.  I have measured pulse periods to 1uS with a 4MHz crystal.  PID
: control in SW.  I am an authorized PIC consultant.  I write nice
tight
: clean code.  Nobody was more suprised than me that the compiler won
out.
:
: But let's be honest.  As a consultant, I can't be satisfied with
doing an
: anal job at a piece of code.  (there.. were even).  Every customer
wants
: to know how much the job will cost.  I proved that a relatively
seasoned
: effort MIGHT be beaten out by the compiler in a fraction of the
time.
: Try this equation:
:
:     Cost of software=hours of dev X rate per hour + reliability of
code X
: it is in the field.
:
: The one case I will concede is that asy MAY excel in ultra fast
timing,
: and may train the programmer to learn the machine much more
intimately.
:
: > : So you just compared what the C compiler did against what YOU
did
: > in: assembler.
: > : Not trying to judge your capacity in asm, are you sure you did
the
: > best you can in asm?
:
: It was the best that I could do, yes.  Then there are folks like
Warren,
: Payson, and Dmitry (you know who you are) that elevate to a new
level of
: genius.  If you let them at a piece of code, when they are done,
all bets
: are off.  I do not claim to match their level of intelligence.  If
I can
: buy a compiler that incorporates their smarts at the speed of
Pentium,
: then I will be satisfied, and apply my efforts to the remainder of
the
: mountain of work.
:
: Chris Eddy
: Pioneer Microsystems, Inc.

1999\03\28@191823 by Eric Oliver

flavicon
face
Well said.

Eric

-----Original Message-----
From:   Chris Eddy [SMTP:EraseMEceddyspam_OUTspamTakeThisOuTNB.NET]
Sent:   Sunday, March 28, 1999 5:04 PM
To:     PICLISTspamspam_OUTMITVMA.MIT.EDU
Subject:        Re: C versus asy example

Ross wrote:

> I'm a big time assembler and I can beat any (C) compiler
> I agree with Wagner Lipnharski people are lazy these days
> and want to you c compilers to do everything the easy way.
>

Ouch! lazy! that does hurt.  I have done at least 40 or more complete
products, hardware and software.  I have covered 8 pin, 5X, 14000, and
7X.  I have measured pulse periods to 1uS with a 4MHz crystal.  PID
control in SW.  I am an authorized PIC consultant.  I write nice tight
clean code.  Nobody was more suprised than me that the compiler won out.

But let's be honest.  As a consultant, I can't be satisfied with doing an
anal job at a piece of code.  (there.. were even).  Every customer wants
to know how much the job will cost.  I proved that a relatively seasoned
effort MIGHT be beaten out by the compiler in a fraction of the time.
Try this equation:

   Cost of software=hours of dev X rate per hour + reliability of code X
it is in the field.

The one case I will concede is that asy MAY excel in ultra fast timing,
and may train the programmer to learn the machine much more intimately.

> : So you just compared what the C compiler did against what YOU did
> in: assembler.
> : Not trying to judge your capacity in asm, are you sure you did the
> best you can in asm?

It was the best that I could do, yes.  Then there are folks like Warren,
Payson, and Dmitry (you know who you are) that elevate to a new level of
genius.  If you let them at a piece of code, when they are done, all bets
are off.  I do not claim to match their level of intelligence.  If I can
buy a compiler that incorporates their smarts at the speed of Pentium,
then I will be satisfied, and apply my efforts to the remainder of the
mountain of work.

Chris Eddy
Pioneer Microsystems, Inc.

1999\03\29@090209 by Andy Kunz

flavicon
face
At 09:19 AM 3/28/99 -0800, you wrote:
>I'm a big time assembler and I can beat any (C) compiler
>I agree with Wagner Lipnharski people are lazy these days
>and want to you c compilers to do everything the easy way.
>
>You get out what you put in saving 52 bytes I nothing. I you
>smart you save more byte buy using unused memory and
>fully understand what your goals are to accomplish.

If you're smart and in the business of trying to pay your bills doing
custom engineering, any tool that saves you time can increase your bottom
line.

That's why I went to C - the profit motive.

(To all socialists - sorry for being so capitalistic, but I don't like
bread lines).

Andy


  \-----------------/
   \     /---\     /
    \    |   |    /          Andy Kunz
     \   /---\   /           Montana Design
/---------+   +---------\     http://www.montanadesign.com
| /  |----|___|----|  \ |
\/___|      *      |___\/     Go fast, turn right,
                              and keep the wet side down!

1999\03\29@102307 by Ross

flavicon
face
Again heres another guy that need the umbrella drink.
their is no bread asy is compiled down to asy anyway.
That's my 2 cents.


//Ross


(HANWE)

----------
: From: Andy Kunz <@spam@mtdesignKILLspamspamFAST.NET>
: To: KILLspamPICLISTKILLspamspamMITVMA.MIT.EDU
: Subject: Re: C versus asy example
: Date: Monday, March 29, 1999 5:50 AM
:
: At 09:19 AM 3/28/99 -0800, you wrote:
: >I'm a big time assembler and I can beat any (C) compiler
: >I agree with Wagner Lipnharski people are lazy these days
: >and want to you c compilers to do everything the easy way.
: >
: >You get out what you put in saving 52 bytes I nothing. I you
: >smart you save more byte buy using unused memory and
: >fully understand what your goals are to accomplish.
:
: If you're smart and in the business of trying to pay your bills
doing
: custom engineering, any tool that saves you time can increase your
bottom
: line.
:
: That's why I went to C - the profit motive.
:
: (To all socialists - sorry for being so capitalistic, but I don't
like
: bread lines).
:
: Andy
:
:
:    \-----------------/
:     \     /---\     /
:      \    |   |    /          Andy Kunz
:       \   /---\   /           Montana Design
: /---------+   +---------\     http://www.montanadesign.com
: | /  |----|___|----|  \ |
: \/___|      *      |___\/     Go fast, turn right,
:                                and keep the wet side down!

1999\03\29@113232 by Wagner Lipnharski

picon face
I hope you are not saying that who uses asy programming are dumb stupid
and poor ignorant people, that needs to go to a bread line, just because
they are not "smart enough to use C"... because if it was your
intention, you already offended half of the World, include USA people
who use to make money programming (also) in asy...  a little respect for
the others is good and very well accepted anywhere... including in bread
lines.

Andy Kunz wrote:
> If you're smart and in the business of trying to pay your bills doing
> custom engineering, any tool that saves you time can increase your bottom
> line.
>
> That's why I went to C - the profit motive.
>
> (To all socialists - sorry for being so capitalistic, but I don't like
> bread lines).

1999\03\29@114301 by Andy Kunz

flavicon
face
At 11:30 AM 3/29/99 -0500, you wrote:
>I hope you are not saying that who uses asy programming are dumb stupid
>and poor ignorant people, that needs to go to a bread line, just because
>they are not "smart enough to use C"... because if it was your
>intention, you already offended half of the World, include USA people
>who use to make money programming (also) in asy...  a little respect for
>the others is good and very well accepted anywhere... including in bread
>lines.

No, actually not intended to offend anyone.

I think both have their appropriate place.  In fact, a good bit of my
library is in assembly - Z-80, 6502, 6805, and PIC.

But what's really great is being able to fully debug an app on my PC and
just compile it for the PIC.  That's what I'm talkign about.

Andy


  \-----------------/
   \     /---\     /
    \    |   |    /          Andy Kunz
     \   /---\   /           Montana Design
/---------+   +---------\     http://www.montanadesign.com
| /  |----|___|----|  \ |
\/___|      *      |___\/     Go fast, turn right,
                              and keep the wet side down!

1999\03\29@123948 by John Bellini

flavicon
face
I have to put my two bits worth in on this one.

I have to agree with Andy in that C has its place and Assembly has its
place.  The good coder knows when to use the right one and or both.

JB

               {Original Message removed}

1999\03\29@151858 by Mark Willis

flavicon
face
My take was that Andy was basically saying, "Getting the client the
software, working right, on time, keeps them happy & keeps me employed",
in other words.  Obviously it works for Andy - I remember seeing him
type out Assembler for the list on occasion <G>

 C's great for getting something working, and working fast.  It lets
you work at a "conceptual", "What do I want done" level, more than a
"how the PIC does this", "down on the silicon" level <G>  And being able
to compile & test code on your PC, is certainly a handy tool.

 Assembler's great for making sure no compiler or optimization bugs
will cause problems (i.e. Pacemakers, life-critical avionics, etc.) and
for shrinking code size down - usually at least.  Assembler takes more
time to code, usually.

 When you're a contractor and the client wants it tomorrow, and "it"
involves floating point math, 32-bit integer math, etc. etc., I lean
towards C;  if it has to be "perfect" with no possible bugs, I lean
towards Assembler; it's good to know both.

 I've started off "Pseudo-coding" something in C, testing that, then
re-code it in assembler, etc.  Nothing's wrong with people having
favorite flavors of PIC programming languages, people! <G>

 Mark

John Bellini wrote:
{Quote hidden}

1999\03\29@160051 by wagnerl

picon face
Yes, it is good to explain those differences to the newbies, if not,
they will think that "easier" means "the best", and they can be
polarized by this statement. Every tool serves for a specific
application, but to know when to use the screwdriver your first need to
know when NOT to use the wrench.

In large scale production, every MHz you can drop in the processor by
speeding up the code, means less power, less cost, less EMI, less
production problems, and in this case you think twice before discard asy
programming.  Here we work different, by whole project, so if we need to
waste 100 hours more in programming but saving a million in the
hardware, there is just one direction to go.  If we would contract
external software development we would think the same way.

It is not difficult to show to a customer that if he spend $10k more in
the software, and this will save $0.50 per board, he would save $490k in
the first million boards produced... :)

Wagner

1999\03\29@161944 by Andy Kunz

flavicon
face
>  I've started off "Pseudo-coding" something in C, testing that, then
>re-code it in assembler, etc.  Nothing's wrong with people having
>favorite flavors of PIC programming languages, people! <G>

Also, I find the C compiler to be a very handy translation tool which I can
use to speed up the development process immensely, precisely for the
reasons you stated.

My environment of choice started out as PASM, then SPASM, then CVASM.  Now
it's HiTEch C and the integrated assembler.  It's great to be able to use
those libraries of code I developed for the early Parallax tools in my
latest jobs.  The key was _not_ to use the Parallax macros, though.

Andy


  \-----------------/
   \     /---\     /
    \    |   |    /          Andy Kunz
     \   /---\   /           Montana Design
/---------+   +---------\     http://www.montanadesign.com
| /  |----|___|----|  \ |
\/___|      *      |___\/     Go fast, turn right,
                              and keep the wet side down!

1999\03\29@171009 by Gerhard Fiedler

picon face
At 15:58 03/29/99 -0500, Wagner Lipnharski wrote:
>Yes, it is good to explain those differences to the newbies, if not,
>they will think that "easier" means "the best", and they can be
>polarized by this statement. Every tool serves for a specific
>application, but to know when to use the screwdriver your first need to
>know when NOT to use the wrench.

i feel that one of the best ways to get familiar with YAA (yet another
assembler :) is to look at the (assembler) output of a (preferrably good)
compiler. this doesn't teach you everything about this part's assembler,
but it shows many of the coding techniques for that particular part. and
you can do it while you're already producing something.

(of course, this does not apply to someone developing for millions per year
production, that's more a "rapid prototype" approach.)

ge

1999\03\30@010250 by Nigel Goodwin

flavicon
picon face
In message <73245390544AD11194940000F8D82F65982747@XG>, John Bellini
<RemoveMEJBelliniTakeThisOuTspamSTATPOWER.COM> writes
>I have to put my two bits worth in on this one.
>
>I have to agree with Andy in that C has its place and Assembly has its
>place.  The good coder knows when to use the right one and or both.

Every language has it's place, but assembler is the most efficient for
'running', but probably not for 'writing' :-).

For an example take computer games, most (if not all) Amiga games were
written in assembler, they ran fast on a 68000 at under 8MHz with 512kB
RAM using a single floppy drive. Now look at modern PC games, usually
written in 'C', often requiring a 200MHz+ Pentium, 32mB RAM, 300mB hard
drive space, and still don't run as smooth :-).

For those who remember the Amiga, much of the operating system was
written in 'C', but in later years there was a group who rewrote it in
assembler, this provided a huge speed increase from the operating system
routines. Games almost always totally bypassed the Amiga operating
system, and provided their own interfaces.
--

Nigel.

       /--------------------------------------------------------------\
       | Nigel Goodwin   | Internet : spamBeGonenigelgspamBeGonespamlpilsley.demon.co.uk     |
       | Lower Pilsley   | Web Page : http://www.lpilsley.demon.co.uk |
       | Chesterfield    | Official site for Shin Ki Ju Jitsu         |
       | England         |                                            |
       \--------------------------------------------------------------/

1999\03\30@163510 by John Bellini

flavicon
face
Your first statement is correct about every language having its place.

However, you picked the wrong the area to compare too. 90% of all game
engines are written in assembler for speed and size, the rest of the
games are done in C or C++, usually C++.   Fast computers are needed
because of the enormous and complex 3D worlds being created.  Most of
the size and speed is required for the textures and world creation and
of course the excellent A.I. being produced.  Video games are among the
most complex programs I come across.

All that this means is that your first statement is correct.  There is a
proper place for assembly and proper place for C / C++.

John

               {Original Message removed}


'C versus asy example'
1999\04\06@102409 by John Payson
flavicon
face
|However, you picked the wrong the area to compare too. 90% of all game
|engines are written in assembler for speed and size, the rest of the
|games are done in C or C++, usually C++.   Fast computers are needed
|because of the enormous and complex 3D worlds being created.  Most of
|the size and speed is required for the textures and world creation and
|of course the excellent A.I. being produced.  Video games are among the
|most complex programs I come across.

One of the games I did for the PC (Wormy II) ran at a full 60 frames/sec
on a 4.77MHz 8x88 with a CGA card.  Over 1,000 lines of Pascal code, and
about 20 non-comment lines of assembly for the game (another 25 lines or
so for an optional cool video effect).  Those 20 lines of assembly code
represented about 85-95% of the worst-case main-loop time.

Very seldom, with games or any type of programming, is it necessary to
write in 100% assembly to meet a speed goal.  Sometimes it is necessary
to do so for size reasons (since even code which is only executed rarely
takes up as much space as code which is executed often), but in general
it's reasonable to focus purely on the (typically) 10% or less of the
code which takes up more than 90% of the execution time.  After all, a
10% speedup there will net the same performance improvement as a 90%
speedup elsewhere, and improving 10% of the code by 10% is probably a lot
easier than cutting 90% of the code by 90%.

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...