What is machine code and how do we make the leap from transistors to machine code?

604 views

What is machine code and how do we make the leap from transistors to machine code?

In: Technology

5 Answers

Anonymous 0 Comments

Transistors are circuit components that take in two voltages and give out a certain voltage based on those inputs. For example, you can have a transistor that outputs a high voltage if both of its inputs are high and a low voltage if not; or you can have one that outputs high if either one or both of the inputs are high and outputs low if both inputs are low.

The operation of those two transistors I described is identical to the Boolean Logic operations AND and OR. A Boolean AND operation evaluates to true if both operands are true, an OR evaluates to true if at least one operand is true. So, in this way we can use transistors to recreate logical operations by equating voltages with truth values, namely by treating a high voltage as meaning “true” and a low voltage as meaning “false”.

As it happens, Boolean operations can be combined to do arithmetic if we equate truth values to numbers (true↔1 and false↔0), and of course we can use that equivalency to relate digits to voltages and use transistors to do arithmetic.

Your CPU is made up of things called arithmetic logic units, which are bundles of transistors set up to do all of the basic mathematical and logic operations a computer needs. This is where machine code comes in. Machine code is essentially a list of operations (represented as numbers called opcodes) and their inputs, and it is what any program eventually gets turned into to run it. When running a program, its machine code gets loaded into RAM, the CPU gets pointed to where the program starts, and then as it runs through the program it will pull each line of machine code and decode the opcode (using Boolean logic) to figure out where in the arithmetic logic unit the operands need to go.

You are viewing 1 out of 5 answers, click here to view all answers.