Assembly language is a programming language that is one step away from machine code.
Machine code is made up of 0s and 1s and is extremely difficult for a programmer to use.
Assembly language has the same structure and instruction set as the commands in machine code but they use mnemonics (names) rather than binary code.
Each type of computer has its own machine code and assembly language. This means that a program written in machine code for one CPU will not run on another type of CPU.
Initially computer programs were all written in low level languages but over time high level languages have been developed that are closer to written English and easier to use.
However, assembly language programs:
Require less memory and execution time
Allow code to interact directly with hardware, such as device drivers
Suitable for time-critical processes.
You need to be able to write simple programs using the commands in the table below:
Here are some common assembly language programs that you might be asked to write on your Unit 2 paper:
Add together two numbers:
INP ‘input a number
STA 99 ‘store the number in memory address 99
INP ‘input a number
ADD 99 ‘add the number stored in memory address 99 to the number in the accumulator
OUT ‘output the result of the addition (from the accumulator)
HLT ‘halt/stop/end
2. Subtract one number from another:
INP ‘input a number
STA first ‘store the number a variable called first
INP ‘input a number
STA second ‘store the number in a variable called second
LDA first ‘load the number in variable first into the accumulator
SUB second ‘subtract the contents of second from the accumulator
OUT ‘output the number in the accumulator
HLT ‘halt/stop/end
first DAT ‘declare first as variable
second DAT ‘declare second as variable
Here is a recap on the Fetch Decode Execute Cycle:
Intro to Fetch Decode Execute Cyle in Little Man Computer - Part 1
Intro to Fetch Decode Execute Cyle in Little Man Computer - Part 2
WJEC Unit 2 June 2019
Question Answer
WJEC Unit 2 June 2022
Question Answer