Re: A89: Re: Game Programming -- Pure Assembly vs. TI-GCC?


[Prev][Next][Index][Thread]

Re: A89: Re: Game Programming -- Pure Assembly vs. TI-GCC?




Bleh.. you have a few techinical inaccuracies...


Seth Peelle wrote:
> 
> Daniel Wood wrote:
> >
> > Well, I'm not a programmer, but I believe that the TI-GCC translates the C
> > into ASM(Don't quote me on this).
> 
> Actually, what a compiler does (for ASM, C, or any other programming
> language) is take the "source code" that the programmer writes and
> translate it into "object code", which only the computer can understand
> -- this is the end result of designing a program.


A C compiler translates C code to assembly! This is done by the program 'cc1' in
gcc.
Next, it is assembled (by 'as' usually, but 'a68k' in ti-gcc i believe...) into
object code.
Then, if you have a decent linker, your object files are combined with libraries
to make a final executable. In the case of the tigcc linker... Well, put simply,
it kinda stinks because it lacks the ability to use labraries. (*.a). What would
be nice is a port of GNU ld with the tigcc modifications (calling structure,
etc) so that you could link everything into one object file, -then- run it
through the tigcc linker.

BTW.. anyone interested in a linux port of the tigcc linker? i did one...

> 
> Languages like ASM are called "low-level" programming languages because
> they are very "close" to the machine's language -- the programmer does a
> vast amount of work using this language (he/she must be extremely
> specific in telling the program what to do, which can get very difficult
> and tedious), but the compiler doesn't need to translate it very far to
> make it into the machine's own language.  This way, the programmer has
> complete control over the program, and he/she can fine-tune (or
> "optimize") it so that it runs very fast and efficiently.

C is low-level... B was more so...

> 
> At the other end, languages like C are called "high-level" programming
> languages because they are closer, in a sense, to the programmer's
> language (English, French, etc.).  It is far easier for the programmer
> to understand and work in a language like this.  However, the compiler
> must work harder to be able to translate this into the machine's
> language.  The programmer doesn't have as much fine control over a
> program written in this language -- as a result, it cannot be optimized
> as much and may mot be as fast and efficient.

Not so.. C is not high-level, nor does it take away control.
C itself is a low-level language, but because of its expandability many people
think it is high-level because it can be very powerfull.

> 
> Here's an analogy: You are a native English speaker.  You meet a person
> who speaks only Japanese (which you don't know a single word of).
> Obviously it is very difficult and inefficient for you to communicate
> with him, since you must use tons of gestures and mime acts just to
> convey simple concepts to him.  In addition, he is from a culture that
> is quite unlike yours -- just one particular gesture that you may think
> is appropriate for what you want to tell him may, to him, be extremely
> offensive.  He may even become infuriated and refuse to communicate
> further with you.  ASM is kind of like this -- and the refusal to
> communicate further would be the program locking up ;)
> 
> Now you come across a German.  You notice that his language has many
> similarities to yours, and you can even find some words in his speech
> that are almost identical to your own.  His culture is also very much
> like yours, so you feel more comfortable (and are more efficient) in
> attempting to talk with him.  C is kind of like this.

Interesting analogy.. but well written C code is system independant.


> 
> That's just to give you a general idea of the concept.  And I imagine
> this is far more than what you were expecting to hear, so I'll shaddup
> now ;P
> 
> BeaT (Seth Peelle)
> beat@drigon.com
> http://www.drigon.com/~beat

--robin


Follow-Ups: References: