OCR A-Level Computer Science H446
Processors: Structure, Performance and Types
Input, Output and Storage
Systems Software
Applications Generation
Software Development
Types of Programming Language
Exchanging Data
Networks
Web Technologies
Data Types and Number Representation
Data Structures
Boolean Algebra
Legal, Moral, Cultural and Ethical Issues
Elements of Computational Thinking
Problem Solving and Programming
Algorithms
Types of Programming Language
Assembly language and the Little Man Computer
- 2 things to know
- Component 01
Overview
Recall questions on assembly language and its instruction format, the Little Man Computer, its accumulator and DAT, tracing and writing LMC programs with BRA, BRZ and BRP, value limits, and executing an ADD instruction.
What you need to know
Answer each one before you reveal it.
A student uses BRP to loop while a counter is greater than zero, and finds the loop runs one time too many. Explain.
Questions from this subtopic
Each one with the model answer underneath.
- 1
What is assembly language?
Model answer
A low-level language in which each instruction corresponds to a single machine code instruction, written as a short mnemonic - such as ADD or STA - with an operand, instead of as a binary pattern. It is translated into machine code by an assembler and is specific to one processor family's instruction set.
- 2
Give two advantages and two disadvantages of writing in assembly language rather than a high-level language.
Model answer
Advantages: complete control over the processor, registers and memory, so the code can be made as small and as fast as the hardware allows; and direct access to hardware features that a high-level language may not expose, which matters for device drivers and embedded systems. Disadvantages: it is slow to write and very error-prone, because everything must be spelled out at the level of individual instructions; and it is not portable, since the program only runs on the processor family it was written for and must be rewritten entirely for any other.
- 3
What is the general format of an assembly language instruction?
Model answer
An opcode - the mnemonic saying what operation to carry out - followed in most cases by an operand, which is the data to act on or the address of that data. Some instructions, such as one that halts the processor, need no operand. Lines may also carry a label, which names that memory location so it can be referred to elsewhere without knowing its actual address.
- 4
What is the Little Man Computer?
Model answer
A simple model of a computer used to teach how a processor really works. It has a single accumulator, a program counter, an input and an output, and a hundred numbered mailboxes acting as memory, each holding one instruction or one item of data. It has a very small instruction set, so complete programs can be written and traced by hand.
- 5
In the Little Man Computer, what is the accumulator used for?
Model answer
It is the single register in which arithmetic is done and through which almost all data passes. A value is loaded into it from a mailbox or from input, added to or subtracted from, tested by the branch instructions, and then stored back to a mailbox or sent to output. Because there is only one, a value that is needed later must be stored before the accumulator is reused.
- 6
What does the DAT instruction do in the Little Man Computer, and why is it not really an instruction?
Model answer
It reserves a mailbox to hold data rather than a program instruction, and optionally sets its initial value. It is an assembler directive: it generates no operation for the processor to carry out, it simply tells the assembler to set that memory location aside, usually with a label so the program can refer to it by name.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Types of Programming Language, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.