Site Overlay

Eduardo Santana

Talking to a processor in machine language To understand how machine language works, you have to understand how processors work. Basically, a processor consists of nothing more than millions of tiny switches that can turn on or off. By turning certain switches on or off, you can make the processor do something useful. Instead of physically turning switches on or off, machine language lets you turn a processor’s switches on or off by using two numbers: 1 (one) and 0 (zero) where the number 1 can mean “turn a switch on” and the number 0 can mean “turn a switch off.” So a typical machine language instruction might look like this: 1011 0000 0110 0001 If the preceding instruction doesn’t make any sense, don’t worry. The point is that machine language is a just way to tell a processor what to do. Using 1’s and 0’s is binary arithmetic.

 

Because binary arithmetic can be so hard to read, programmers also represent binary numbers in hexadecimal. Where binary arithmetic uses only two numbers, hexadecimal uses sixteen numbers (0–9 and A–F). So the binary number 1011 0000 0110 0001 could be represented as the hexadecimal number: B061. Machine language is considered the native language of CPUs, but almost no one writes a program in machine language because it’s so tedious and con- fusing.

 

Mistype a single 1 or 0 and you can accidentally give the wrong instruction to the CPU. Because writing instructions in machine language can be so difficult and error-prone, computer scientists have created a somewhat simpler language — assembly language.

𐌢