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
- Tiny ELF Files [https://nathanotterness.com/2021/10/tiny_elf_modernized.html] (accessed 2025-04-05)