[try Beta version]
Not logged in

 
How does a compiler actually send the code to the processor?

Mar 15, 2011 at 6:36pm
I want to know how because as weird as this sound I feel distant from my x86 Intel Celeron and I want to be able to know EXACTLY how the compiler converts codes and actually "sends" them to the processor and how does the processor accept them?

Also, how can I do that myself(troll-ish, I know, but just curious)?
Mar 15, 2011 at 7:16pm
There are several steps during compilation, the original sourcecode may be transformed in several intermediate forms before becoming an actual executable file.
You can write directly in a binary file that can be directly executed by the processor but it would be really painful ( x86 architecture has lots of instructions )
If you want to write really low-level programs you can write them in assembly which is the closest human-readable thing to the processor.

For a more detailed explanation of the compilation process, see http://en.wikipedia.org/wiki/Compiler
Mar 16, 2011 at 12:06am
Well, thanks for the link....Though I could've just searched that myself.
Mar 16, 2011 at 12:26am
And no thanks for the Assembly offer! I'd rather just go down to machine code if I'm going to get that low with programmability. :P
Mar 16, 2011 at 12:35am
The difference between assembly and machine code is mostly that assembly is written in words. Assembly languages usually define a number of useful macros, and allow you to use labels and stuff like that, but other than that assembly code usually resolves 1:1 to machine code.
Mar 16, 2011 at 12:41am
Doesn't matter to me though.

I prefer machine code over it and hate when people suggest I learn Assembly.

Just because YOU prefer it over machine language doesn't mean I DO.

We are different people, remember?
Mar 16, 2011 at 11:06am
As I said, you can write in machine code. But you need to know all the values for the mnemonics and registers.
The most tricky part with x86 architecture is that instructions which would have the same mnemonics in assembly have different opcodes in machine code and maybe different instruction size.

If you want to write directly in binary you'll need to get the specification from your CPU vendor and for your operating system.
Mar 16, 2011 at 11:52am
closed account (zb0S216C)
I believe the language you're looking for is called 1GL. This is a quote from wikipedia:
The first-generation programming language, or 1GL, is machine code. It is the only language a microprocessor can process directly without a previous transformation.

1GL is before the assembly language.
Last edited on Mar 16, 2011 at 11:54am
Mar 16, 2011 at 1:47pm
It's not called 1GL, that's just an abbrevation for 1st Generation Language. Saying machine code is called 1GL would be equal to saying C is called 3GL.
Mar 16, 2011 at 3:16pm
closed account (zb0S216C)
Saying machine code is called 1GL would be equal to saying C is called 3GL

The information was from Wikipedia, not me. Still, according to Wikipedia, 1GL is the lowest level language you're going to find. By the way, 1GL is an acronym, not the actual name.

This website backs up Wikipedia: http://www.javvin.com/softwareglossary/1GL.html
Last edited on Mar 16, 2011 at 3:18pm
Mar 16, 2011 at 3:42pm
Sorry, my english is not very fluent. What is the difference between an acronym and an abbrevation?

Anyways: There is no language called 1GL. 1GL is simply the term used to describe the languages that consist of processor operation codes.
Mar 16, 2011 at 3:45pm
Wiktionary wrote:
abbreviation
A shortened or contracted form of a word or phrase, used to represent the whole: Dr.

acronym
An abbreviation formed by (usually initial) letters taken from a word or series of words, that is itself pronounced as a word, such as RAM, radar, or scuba; sometimes contrasted with initialism.
Last edited on Mar 16, 2011 at 3:45pm
Mar 16, 2011 at 3:57pm
Research executable formats, such as ELF:
http://en.wikipedia.org/wiki/Executable_and_Linkable_Format
Mar 16, 2011 at 5:19pm
closed account (zb0S216C)
What is the difference between an acronym and an abbrevation?

An abbreviation is term used when you shorten a word. For example, const is an abbreviation of constant.

A acronym is word or letter that consists of the first letter of each word( s ). For example, FTW is an acronym for For The Win.

There is no language called 1GL

You're right, Hanst. However, I think Opcode is really low. Correct me if I'm wrong here, but isn't Assembly based on Opcode?
Mar 16, 2011 at 5:45pm
Opcodes are the numeric values which tell the processor which instruction it has to execute.
Assembly replaces those numeric values with symbolic mnemonics.

An assembly file is basically the same as an executable file but the instructions are written as text instead of binary data
Mar 16, 2011 at 5:46pm
Assembly would translate into OpCode yes. I worked with OpCode on an emulator in college, for the longest time I thought OpCode = Assembly but then when I started opening programs with Olly Dbg again I noticed that Assembly has many more functions. OpCode would look like a set of Hex numbers '3B' or something like that.
Topic archived. No new replies allowed.