Machine Code

Share

What is Machine Code?

Machine code is the only type of code that a CPU understands. A piece of machine code is a sequence of bytes containing the algorithms of a program to be executed by the CPU.

When you run a program in your computer, the machine code of the program is transferred from the disk to the RAM. Once loaded in the RAM, the CPU starts reading it, byte by byte. In a typical computer, machine code is formatted as a list of instructions, with each instruction starting with an operation code (opcode) that tells the CPU what the next bytes mean.

For example, in other to add two numbers stored in the RAM, you might have multiple instructions: two instructions telling the CPU to load the data from the RAM and put it in a CPU register, and a third instruction telling to add the two numbers together and put it in another register, and finally a fourth instruction telling it to save the result in the register back into the RAM.

Surf the Web

Written by Noel Santos.

About the Author

I'm a self-taught Brazilian programmer graduated in IT from a FATEC. In a world of increasingly complex and essential computers, I decided to use my technical expertise in hardware, desktop applications, and web technologies to create an informative resource to make PC's easier to understand.

View Comments