The Cyber-Spy.Com Usenet Archive Feeds Directly
From The Open And Publicly Available Newsgroup
This Group And Thousands Of Others Are Available
On Most IS NNTP News Servers On Port 119.
Cyber-Spy.Com Is NOT Responsible For Any Topic,
Opinions Or Content Posted To This Or Any Other
Newsgroup. This Web Archive Of The Newsgroup And
Posts Are For Informational Purposes Only.
From: firstname.lastname@example.org (Nico Coesel)
Subject: Re: To C or not to C
Date: Sat, 04 Jan 2003 18:40:51 GMT
NNTP-Posting-Date: 4 Jan 2003 18:41:13 GMT
X-Newsreader: Forte Free Agent 1.21/32.243
X-Received-Date: Sat, 04 Jan 2003 19:41:18 MET (news01.chello.no)
>"Michael Culley" wrote in message
>> Thanks to everyone's help here my small project has progressed well. I now
>> had a completed (although very messy) prototype. For those who didn't read
>> my previous thread it is using an 8051 and a max232 to connect to a serial
>> port. I'm doing this project with a friend and he prefers to use C while I
>> prefer to use assembler. We have both written the software and both
>> work the same with only minor differences. I can see 2 problems with using
>> C. First, there is alot of extra assembly code added in that we don't know
>> what it does, if this produces a bug it could be hard to track down.
>> it appears to use alot more of the rom. The assembler version is 757 bytes
>> and the C version is 1508 bytes. About 350 bytes is text in both, so the C
>> code is almost 3 times larger than the assembler version. The C version
>> had quite a few hours spent on it getting it down to 1500 bytes where the
>> assembler version hasn't been optimised. 1500 bytes seams like a huge
>> when we only have 2k.
>> What does everyone think, which is better C or assembler? We are using
>> Michael Culley
>That's very interesting. I've always heard that assembly language would
>produce a shorter more succinct and faster running code than code compiled
>from C. Your experience confirms that view at least in your small program.
>But, I never figured that the difference would be as geat as you've found, 3
>to1 that's amazing and almost scary. I'm writing a MIDI controller that is
>several thousand lines long and the program will have to bomb through it at
>a very fast rate to keep up with the MIDI commands. It's for a pipe organ.
>I'm working in assemby and am glad I didn't even think of doing it in C.
>Based on your experience it dosen't look like code compiled from C could run
>fast enough to do my job. Thanks for the insight.
Generally speaking, C is as fast as assembly. If a program is too
slow, assembly won't help you. It's better to optimize the algorithm.
BTW, I recently did a midi project on a 8051. I wrote it entirely in
C. Among other things the device needed to be capable of receiving
firmware updates through the midi interface. This proved to be no
problem at all. Upload rates of 640kbit/s (20 times midi bitrate) are
easely handled by the software (a standard motorola hex file is
uploaded; including checksums etc).
Reply to nico@nctdevpuntnl (punt=.)
Bedrijven en winkels vinden? Adresboekje.nl
Go Back To The Cyber-Spy.Com
Usenet Web Archive Index Of
The sci.electronics.design Newsgroup