Re: mixing C and assembly

In message <72b456ce-494f-43ac-8735-a8ea924caccf@xxxxxxxxxxxxxxxxxxxxxxxxxxx>, cbarn24050@xxxxxxx writes
On Apr 25, 8:32 am, David Brown <da...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
cbarn24...@xxxxxxx wrote:
> On Apr 24, 1:440 >> > wrote:
>> cbarn24...@xxxxxxx wrote:
>>> On Apr 24, 12:43 am, David Brown
>>> <> wrote:
>>>> Secondly, some processors have small fixed-size hardware stacks (small
>>>> PIC's and AVR Tiny's are examples). 0 >> >>>> unnecessary "call" can waste a third of your stack resources.- >>>>Hide quoted text -
>>> Firstly you would be mad to try running C of these chips. Secondly you
>>> would not put call returns on the hardware stack unless you have some
>>> kind of death wish, you keep that space for the ISRs.
>> Firstly, you must then call me mad, along with all the customers for PIC
>> C compilers targeted at the smallest

> They teget them to get money from people like you.

Are you trying to imply that I am the sort of person that will buy any
tool just because it says "C" on the box, and I think "C is always
better than assembler"?

I have no idea what kind of person you are.

Yet you said:-
> They teget them to get money from people like you.

You can't have it both ways.

No, I can't post my code - it was a project for a paying customer.

Allways the same excuse, everyone seems to have a million dollars
worth of code on PIC.

Yes.. Or at least the cost of re-inventing it is far higher than continuing with the current code base.

If you can write a meaningful program in assembly for a device, you can
also write a meaningful program in C (and in Forth, and Ada, and Pascal,
hand-compiled pseudocode, and any other language that can generate
object code with low overheads).

True but C doesn't have low overheads.

Yes it does, very low in most cases. In fact I have seen comparisons where some C compilers produce faster smaller code than assembler. In some cases an experienced assembler programmer can produce, in the same time frame, an application that is smaller and faster than the C program but it is not common.

Well can you get "try before buy" compilers? Can you get your money
back if the compiler doesn't meet your expectations? I think we know
the answer to both questions.

The answer is "yes" I don't know of any embedded C compilers you can't try before you buy. Some are size limited and others time limited. Some companies like IAR offer both size and time limited versions of some of their compilers.

It is certainly the case that you can do more tricks with assembly than
in C, and you have a greater freedom in structuring your code.  I've
written assembly code where the program code and data tables overlapped
at the edges to save space - you can't do that sort of thing in C.  But
unless you are willing to work particularly hard at it, a C compiler
will give you as tight code as you would write in assembly on such a micro.

Not a chance, challenge me if you want, Walter did but changed his
mind after I told him he couldn't have my assembly code untill after
he'd done it in C.

Well lets draw up a competition and agree the rules. You will probably need some one independent to hold the produced code until all have completed their solution.

I'm still waiting for Forth on a PIC.


\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/


Relevant Pages

  • Re: Calling asm from C
    ... char vendorbuf; ... *must* agree with the ABI that the assembler routine expects. ... I've been assuming that "Intel ABI" means something... ... If the C compilers are going to get all random on us, ...
  • Re: Why use relational tables in OO (please just take a look inside)
    ... B-) C is 30-50% slower than hand-tuned assembler. ... > library currently supports these two compilers. ... STL headers and libraries, I assumed I would send you the data files and ...
  • Re: for your languages
    ... And your use of the word "compilers" to refer to translators for ... "assembly language" means that you're using one or both terms in a sense ... I've never heard of an optimizing assembler. ... no longer a *pure* assembler. ...
  • Re: Assembler?
    ... 6502 assembler I used was about 20K, and the disassembler was less than ... compilers optimized to them, they are optimised to the compilers and ... Register shmegister. ... What's cache RAM but a shitload of fast registers..especially for the stack?.. ...
  • Re: Why cant/wont Stern make their game code open source?
    ... I ran native C and Pascal compilers ... pinball machine code better in C or assembler. ... I originally chimed it because Mark said that older CPUs ... couldn't support compiled code and I disagreed with that. ...