0
$\begingroup$

Wikipedia article on machine code and more in general Wikipedia's take on machine code seems pretty amiguous sometimes.
Often it makes me wonder if there's more, or it is just bad generalization.

Look at this:

Machine code or machine language is ......Numerical machine code (i.e., not assembly code) may be regarded as the lowest-level representation of a compiled or assembled computer program or as a primitive and hardware-dependent programming language.

It seems to treat numerical machine codes as a subset of machine codes.
Does this imply assembly has to be considered a machine code too?
Or...Is it just implying that exists some non-numerical machine code?
Maybe it's just bad-written, or maybe it's me.

Again, article on object code:

In a general sense an object code is a sequence of statements or instructions in a computer language,[2] usually a machine code language (i.e., binary) or.....

"i.e, binary" Does this mean that there are non-binary machine codes?

I'm a little bit confused.

$\endgroup$
4
$\begingroup$

Yes and no and, really, it doesn't matter.

All data in computers, including programs, is stored in devices that have two possible states – e.g., memory cells that can be at a high voltage or low voltage or areas of a disc that are magnetized north–south or south–north. These two-state systems are naturally interpreted as the binary digits 0 and 1. Any sequence of 0s and 1s can naturally be interpreted as a number written in binary.

Machine code is data that is stored on computers. Therefore, it is stored in a sequence of two-state cells, which can be viewed as a sequence of binary digits, which can be viewed as a binary number (or a sequence of binary numbers if you divide it into blocks). Does that mean it is a binary number? Really, that's a question of philosophy. The computer doesn't say "That pattern of 1s and 0s represents the number 3476247, which means I should do X": it just says "That pattern of 1s and 0s means I should do X." To the computer, it's just an instruction. But if you and I want to talk about that instruction, it's probably easiest to first see it as a number and then figure out what instruction it stands for.

$\endgroup$
2
$\begingroup$

Machine code isn't necessarily numerical, but it will eventually have to be represented by some binary number, as all things that a modern computer can store or reason with must be stored as something representing a binary number (e.g. electrical pulses, small pits and bumps, etc.) .

Assembly code is not the same a machine code (on most machines), since this needs to undergo the process of assembly to be transformed into machine code. Assembly code is not very different from machine code, but it is more easier for humans to interpret and edit.

Also note that the word 'binary' is often used to denote a file/data on a computer that has no direct human-readable interpretation. As such, only the computer reads it, so we regard the data as 'binary', since that is the way the computer interprets all data.

$\endgroup$
  • $\begingroup$ Hi! Thank you for your answer. Can you give an example of non-numerical machine code? Assembly is not usually considered machine code since it has to be translated by the assembler to machine code. $\endgroup$ – Gabriele Scarlatti Jan 17 '18 at 15:17
  • $\begingroup$ Well, it all depends on how you represent it, really. You can always choose to represent your machine code numerically. In the end, it doesn't really matter, as David Richerby states in his answer. $\endgroup$ – Discrete lizard Jan 17 '18 at 16:26
  • $\begingroup$ Nobody's gonna complain and we can delete them when we're done. Which I guess is now. :-) $\endgroup$ – David Richerby Jan 20 '18 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.