On week 1 short video "Compilers reources", at 5'06'' they show the "assembled file" (machine code the assembler produces from the assembly code). Screenshot: screenshot of the "example" of machine code -assembled file-

We've been taught that machine code is binary code the CPU understands. I know it is many times expressed in hexadecimal for simplification purposes... but this? Can someone explain what does this has to do with binary or machine code?


What we're looking at here is an object file, that's object code written in "Executable and Linkable Format", being interpreted as ASCII. At least that's what I'd judge it, according to the first four bytes' being ^?ELF.

So, yes, it is a piece of machine code, but, you're right, this is not really how the 'machine' sees it of course. It is binary, as all files are, but if you open an object file in a text editor, and ask it to interpret those 1's and 0's as ASCII, this is what you see. The two-byte strings starting with ^, and colored purple here, are what's called control characters—i.e. the first one is ^?, which is ASCII for the number 0x7f, or 127, so, if you viewed this machine code file as binary, it would start with that number: 01111111...

  • So there's a text editor (not the one we use to code in a higher order language) that translates for us to "read" binary but into a still "not humanly readable" code, i.e. just machine code yet in another base (ASCII or Unicode can be used as "base" (?)). Right? – Martin Sep 11 '14 at 12:28
  • yes. the text editor does not interpret the code, just displays the 1's and 0's (in whatever way the it is designed to / the user asks it to). in this case, as in most cases, it's displaying ASCII. if you use the linux command xxd -b (try it on an executable like hello from pset1, or anything else) instead of gedit to view the file, you can the numerical contents of the file in binary. however, it's not all that enlightening, and a you could view absolutely any file, of any type, as binary, and to you, the human, they look pretty much the same. – postylem Sep 11 '14 at 12:35
  • I suppose no matter how you view the file, though, be it as it was written, in a language like C before compiling, or at the level of machine code in binary, you're not really seeing what it is that "the CPU understands", because, at the deepest level, the computer doesn't use a text editor or a linux command to 'view' the file; it just interacts directly, physically—electromagnetically, with the file's bits on the disk. (: – postylem Sep 11 '14 at 12:41
  • Yes, just that binary 1 and 0s are direct expressions of ON and OFF states. Only in this sense they are a "representation" and we could even say a "direct instruction" for the machine to activate or not an electromagnetic impulse. Decimal, hexadecimal or ASCII are not direct representations in this sense so we can say they are an interpretation or direct translation of the binary code, even though they are not a language; you don't need to learn the corresponding "word" for each instruction but just a single rule for all, that is the base, the formula to translate it. – Martin Sep 11 '14 at 14:04
  • Thanks a lot postylem! – Martin Sep 11 '14 at 14:06

All that is preceded by ^ is caret notation, used for the unprintable control characters in ASCII. Here, ^? (127) is for DEL (delete I assume) and the ^@ so strangely pervasive in the screen output is the NUL character (value of 0). ASCII can be used as a numerical base translation in the same way decimal or hexadecimal is used...

  • This answer should be read after postylem's as it just adds up to his. – Martin Sep 11 '14 at 14:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .