🎢Assembly Language
Computers can only process code that's written in machine code. As you know, machine code is composed of 0s and 1s, this makes machine code harder to work with. That's why programmers use assembly language, which uses mnemonics to represent operation codes (opcodes).
Registers and Accumulator
In a simple computer, all calculations are carried out in a single register called accumulator. However, some other computers use up to 16 general purpose registers to temporarily hold values whilst final result is being calculated. Usually, assembly instructions are unique to a given computer architecture. A group of instructions given for a specific computer is called an Instruction Set.
Common Instructions

The <operand> can be:
The actual value (specified by #, to include binary number, you must add B at the end. e.g. #11B)
A value stored in a register (specified by R)
Direct & Immediate Addressing
This instruction uses immediate addressing, as the actual value (5) is given in the operand:
SUB R3, R2, #5
Whereas this instruction uses direct addressing, as the operand contains memory address (300) of the data:
LDR R1, 300
Comments
Comments can be added to the code by using a semi-colon so that you can explain to other programmers what the program is actually doing:
ADD R2, R1, #5 ; Adds 5 to the value stored in R1, then stores it in R2
Rational Operations
There are no IF statements in assembly language. Instead, compare and branch instructions are used for .

While Loops
Loops also don't exist in assembly language. So in order to do , we need compare and branch instructions.
MOV R0, #5
LOOP:
INP R1,2
CMP R0, R1
BNE LOOP
HALT
The program above keeps on repeating until the user inputs the number 5.
Logical Bitwise Operators
Instructions to perform AND, OR, NOT and XOR operations typically look like this:

Logical Shift Operators
Left Logical Shift: Multiplies the number by 2 for one shift. Use the Instruction LSL Rd, Rd, <operand>
Right Logical Shift: Divides the number by 2 for one shift. Use the Instruction LSL Rd, Rd, <operand>
The <operand> is the number of bits that the number will be shifted by.
Resources
Visual Assembler: https://peterhigginson.co.uk/AQA/
Last updated