This document offers detailed revision notes for Topic 3 of the OCR A-Level Computer Science syllabus, focusing on Assembly Language. It explains the fundamentals of the Little Man Computer (LMC) model, a simplified representation of a computer that operates using assembly and machine code. Key co...
Compute science—A Level—Topic 3 Assembly Language
Mnemonics and their functions
The Little Man Computer (LMC) is a instructional model of a computer, developed
by Dr Stuart Madnick, it models a simple Von Neumann architecture and can be Mnemonic/Machine code Instruction
programmed in Machine or assembly code.
LDA (0101 xxxxxxx) Load address to ACC.
STA (0011 xxxxxxx) Store ACC to address.
ADD (0001 xxxxxxx) Add address to ACC.
SUB (0010 xxxxxxx) Sub address to ACC.
INP (1001 0000001) Input from keyboard to ACC.
OUT (1001 0000010) Output from ACC to display.
BRA (0110 xxxxxxx) Branch always
BRP (0111 xxxxxxx) Branch if ACC is >=0
BRZ (1000 xxxxxxx) Branch if ACC = 0
DAT (The data) Declares a variable
HLT (00000000000) Ends the Program
The table above shows the mnemonics and their
What does the program do? instructions. Mnemonics are terms that are
either names or symbols used to define or spec-
What are branches used for? On the left side, we have the assembly language code ify a computing function, this is important as it
“BRA” , “BRP” & “BRZ” are which are known as mnemonics (“INP”,STA”). First, doesn't require the programmer to remember
branches, in LMC, branches the program asks for an input and it will store it in vari- the machine code( in binary) so becomes more
are used to set the contents able “A” which could be anywhere in the RAM (on the readable and easier for them.
of the ACC to a given label/ right), this will repeat for variable “B” and “C”. The Opcode and Operand
address. They can be used “LDA” mnemonic loads variable “C” into the Accumula- • The opcode is the part of the binary which
for creating loops or condi- tor located in the CPU, the “OUT” then outputs the
tions. data stored in the ACC which in this case is “C”, it will tells the computer what to do.
repeat this for “B” and “C” and then the program will • The Operand is the part of the binary which
end using the Mnemonic “HLT”. The “DAT” at the tells the computer what to do it to.
bottom basically declares the variables.
In summary, the program asks for 3 inputs then out- ADD: 0001 0010011
puts them in reverse order.
It will add the value stored in memory
address 19 to the ACC.
Label
• If value in ACC is positive, High level language
go to loop (which starts at A language designed to help express the computer program in a way that reflects the problem being
the output mnemonic). solved, high level language programs are far easier to read than low level language as high level language
tends to use more of the English language instead of Mnemonics . Examples include: Python, Java Script
and C#.
Low level language Assembly language
A Language that is very closely A Language that is very closely related to Machine code. This is
related to Machine code. Exam- an example of a low level language, this language uses Mnemon-
ples of low level language: As- ics which are either names or symbols to define or specify a func-
sembly language & Machine tion so this isn’t as understandable as high level language howev-
code. er it is a lot easier than just binary numbers (machine code).
Machine code
A Language which uses binary with a set of all possible instructions made
available by the hardware design of a particular processor, all languages
above this have a translator which translate ultimately translates all
code into machine code.
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller JackJordi05. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $3.90. You're not tied to anything after your purchase.