View Single Post
Old 05 August 2010, 20:29   #16
Registered User
Ze_ro's Avatar
Join Date: Apr 2006
Location: Winnipeg / Canada
Posts: 50
Originally Posted by MethodGit View Post
Another question...... is there a particular reason that X86 isn't used more often in computing/gaming platforms? Seems as if Xbox (and 360?) is the only known console platform to not use C, or at least Xbox emulator authors don't use it by the looks of things. I'm not sure if stuff like the PSP/PS2 is supposed to be more Linux-based what with its use of ELFs and what not...
I'm not quite sure you've got a handle on these things here... C and ASM are computer languages. When you write anything in a computer language, it has to be "compiled" into machine language, which is something specific that only a certain family of processors can understand. The Xbox doesn't really "use C", but rather people will write a program in C and use a compiler to translate it into x86 machine language, at which point it will run on the Xbox. There is tons of Xbox software that was originally written in C.

ASM is quite a bit different from C... C is designed to be portable and more human-readable, but at the expense that you can't always be sure what the compiler is going to do with your code. A function in C could compile into a single machine language command, or a whole string of commands, or sometimes different commands depending on the context. ASM is based entirely on machine language, so much so that it's usually little more than assigning short names to functions of the processor itself. Since each family of processors uses it's own machine language to describe it's functions, when you write in ASM, you're writing only for that family, and nothing else. It's much harder for a human to read and make sense of, but a programmer is 100% sure what his code will translate to because it's a straight one-to-one mapping. Ideally, this means that a skilled programmer can write much more efficient code, while with C, you're limited by the features of the compiler you're using.

To make an analogy, writing in ASM is like learning French in order to talk to a French person, while writing in C is like drawing pictures and showing them to that same person. The pictures won't carry the same meaning, but they're easier for you, and you can also show them to a Russian person and get approximately the same understanding.

SDL is something different entirely... it's a set of standardized functions to talk to the hardware of a device. As you might imagine, programming graphics on a Amiga is quite a bit different from programming graphics on a Wiz, as they use different hardware created by different people for different purposes. Rather than trying to write directly to the hardware, you can simply ask SDL to do it for you. SDL knows how to talk to your hardware, so it translates for you. It makes it much easier to port software between different platforms because you don't have to learn exactly how the hardware works.

Ideally, if a program is written in C and uses SDL to talk to the hardware, it should be a simple matter to recompile it for another platform (In reality, you'll always have to make a few changes... like swapping out keyboard controls for something appropriate to an Xbox controller for example). However, if a program is written in ASM, you pretty much have to rewrite it from scratch.
Ze_ro is offline  
Page generated in 0.03912 seconds with 10 queries