Machine code, assembly language and high-level languages, and how a simple instruction set works.
What you will learn
- Compare high-level and low-level languages
- Decode and encode simple machine code
- Follow a short assembly program
Three levels
- Machine code: binary instructions the CPU carries out directly. Each processor family has its own.
- Assembly language: the same instructions written as short mnemonics (LDA, ADD, STA) with addresses. A mnemonic is a short word that stands for one machine code instruction. One assembly line = one machine code instruction.
- High-level languages (Python, C#, Java): close to English, so they are quicker to write, read and debug, and they run on different processors once translated. A translator turns it into machine code: a compiler translates the whole program at once, and an interpreter translates and runs it one line at a time (the next lesson compares them). Programmers usually write code in an IDE (integrated development environment), a program with tools for writing and testing code. One line can become many machine code instructions.
Low-level code is used where speed, size or direct control of the hardware matters most: device drivers, embedded systems, parts of operating systems.
The rest of this lesson and its 7 practice questions are locked.
In this lesson
- Three levels
- A tiny instruction set
- Try it: Decode an instruction
7 practice questions, marked as you go; about 25 minutes in all.
Key terms
Mnemonics, Mnemonic, High-level languages, Compiler, Interpreter, IDE, Opcode, Address
In this unit: Languages and translators
High-level and low-level languages, machine code and assembly language, compilers, interpreters and assemblers, IDEs, and the three kinds of error.
- High-level and low-level languages
- Compilers, interpreters and assemblers
- IDEs and errors