Machine code

The representation of a computer program which is actually read and interpreted by the computer.

A program in machine code consists of a sequence of machine instructions (possibly interspersed with data).

Instructions are binary strings which may be either all the same size (e.g. one 32-bit word for many modern RISC microprocessors) or of different sizes, in which case the size of the instruction is determined from the first word (e.g. Motorola 68000) or byte (e.g. Inmos {transputer}).

The collection of all possible instructions for a particular computer is known as its "instruction set".

Execution of machine code may either be hard-wired into the central processing unit or it may be controlled by microcode.

The basic execution cycle consists of fetching the next instruction from main memory, decoding it (determining which operation it specifies and the location of any arguments) and executing it by opening various gates (e.g. to allow data to flow from main memory into a CPU register) and enabling functional units (e.g. signalling to the ALU to perform an addition).

Humans almost never write programs directly in machine code. Instead, they use a programming language which is translated by the computer into machine code.

The simplest kind of programming language is assembly language which usually has a one-to-one correspondence with the resulting machine code instructions but allows the use of mnemonics (ASCII strings) for the "op codes" (the part of the instruction which encodes the basic type of operation to perform) and names for locations in the program (branch labels) and for variables and constants.

< Previous Terms Terms Containing machine code Next Terms >
addressing mode
Altair 8800
assembly language
machine cycle
machine language
machine learning
Mach Interface Generator