Low-level languages
low-level languageAlso known as low level language. This is a computer programming language which closely represents machine language. Low-level languages are more difficult to understand than high-level languages but they execute quicker. are languages that sit close to the computer's instructionA single action that can be performed by a computer processor. set and do not resemble natural languages such as English or Welsh. An instruction set Collectively, the set of instructions a processor understands. is the set of instructions that the CPU/processorCentral processing unit - the brain of the computer that processes program instructions. understands. Every processor has its own instruction set.
Two types of low-level language are:
- machine codeA low level language that on the surface makes very little sense.
- assembly languageA low-level programming language closely related to machine language. Also called assembly code.
Machine code
high-level languageAlso known as high level language. This is a computer programming language used to write programs. High-level languages need to be translated into machine code through a compiler, interpreter or assembler. contain commandAn instruction given to a computer. that programmers use to instruct the computer what to do. They are restricted by the limited number of commands that they can implement. In fact, high-level commands are nothing more than a series of machine code instructions in a more readable format.
Machine code is made up of bit patterns that are executed directly by the CPU.
Advantages of using machine code
Writing in machine code allows programmers to do things that might not be possible in a high-level language. High-level language commands are like predefined sentences, where machine code instructions are like predefined words. Using words as opposed to sentences gives more flexibility - to build complex sentences or to keep programs very short and simple.
For example, many high-level languages do not allow the programmer to specify items such as the screen's refresh rate. However, it is usually possible to specify this using machine code.
Disadvantages of using machine code
Machine code is notoriously difficult to write in, understand and debugThe process of finding and correcting programming errors. because it consists of binaryA number system that contains two symbols, 0 and 1. Also known as base 2. code. Usually, when programmers need direct control they use another type of low-level language called assembly language.
Assembly language
Assembly language sits between machine codeA low level language that on the surface makes very little sense. and high-level languages. While high-level languages use statementThe smallest element of a programming language which expresses an action to be carried out. to form instructions, assembly language uses mnemonicShort text codes used for writing instructions in assembly code. (short abbreviations). Each mnemonic directly corresponds to a single machine code instruction. As a result, assembly language is known as a one-to-one language. Some examples of mnemonics are shown in the table.
Mnemonic | Action |
LDA | Transfers a number from RAM (random access memory) to the accumulator. |
STA | Transfers a number from the accumulator to RAM. |
ADD | Adds the value held in a memory address to the value held in the accumulator. |
SUB | Subtracts the contents of the accumulator from the contents held in a memory address. |
BRA | Goes to another memory address. |
Mnemonic | LDA |
---|---|
Action | Transfers a number from RAM (random access memory) to the accumulator. |
Mnemonic | STA |
---|---|
Action | Transfers a number from the accumulator to RAM. |
Mnemonic | ADD |
---|---|
Action | Adds the value held in a memory address to the value held in the accumulator. |
Mnemonic | SUB |
---|---|
Action | Subtracts the contents of the accumulator from the contents held in a memory address. |
Mnemonic | BRA |
---|---|
Action | Goes to another memory address. |
In assembly language, programmers write programs as a series of mnemonics. Mnemonics are much easier to understand and debug than machine code, giving programmers a simpler way of directly controlling a computer.
In assembly language, a machine code program would look like this:
INP
STA 06
LDA A1
Writing in mnemonics is easier for programmers because they are usually brief representations of the commands. They are quicker to write than binary and it is easier to spot mistakes.
Little Man Computer is a simulation of a very basic processor using Von Neumann architectureA description of the processing architecture that all CPUs use. John von Neumann invented the processor architecture which stores a program in memory as instructions and executes them sequentially using the ALU, control unit and registers. This is known as the stored program concept.. It uses an example of simple assembly language that contains a limited set of mnemonic instructions that can be used to program simple assembly programs. Little Man Computer is freely available on the internet for students to use.
More guides on this topic
- The CPU - Eduqas
- Primary storage - Eduqas
- Secondary storage and embedded systems - Eduqas
- Networks - Eduqas
- Internet and cybersecurity - Eduqas
- Data representation - Eduqas
- Storage and data organisation - Eduqas
- Operating systems - Eduqas
- Algorithms - Eduqas
- Sorting, searching and validation - Eduqas
- Software development - Eduqas
- Impacts of digital technology on wider society - Eduqas