Revise Computingrevisecomputing.co.uk
Free student revisionSee questionsFor schoolsSchool enquiry
Free revisionSee questionsFor schoolsSchool enquiry
Knowledge/A Level/H446/01 Computer systems/Types of Programming Language/Assembly language and the Little Man Computer…

Assembly language and the Little Man Computer instruction set

Assembly language (including following and writing simple programs with the Little Man Computer instruction set). See appendix 5d

1.2.4 Types of Programming Language

Practise exam questions

Types of Programming Language — Note 3 of 5

Candidates need to have an understanding of the purpose and need for assembly language. They need to be familiar with the instructions given in Appendix 5d. They should be able to read, write, trace and amend programs written in the Little Man Computer language.

What you need to know

Assembly language uses short mnemonics to represent machine code instructions. The Little Man Computer (LMC) is a simplified model used to learn assembly language. You need to be able to read, trace, write and amend simple LMC programs.

What to know

  • Assembly is used when direct control of hardware, small code size or maximum speed is needed, e.g. device drivers and embedded systems.
  • LMC instructions: ADD (add the value at an address to the accumulator), SUB (subtract), STA (store the accumulator in an address), LDA (load from an address into the accumulator).
  • LMC branches: BRA (branch always), BRZ (branch if the accumulator is zero), BRP (branch if the accumulator is zero or positive).
  • LMC I/O and data: INP (input into the accumulator), OUT (output the accumulator), HLT (stop), DAT (label a memory location for data, with an optional starting value).
  • Labels name memory locations or lines so branches can refer to them, e.g. loop or count.

Key terms

Assembly language

A low-level language that uses mnemonics (e.g. ADD, LDA) to represent machine code instructions. Each instruction usually translates to one machine code instruction.

Exam technique

  • Tip:Alternative mnemonics such as STO, BR, BZ, BP, IN and END are accepted in answers.
  • Mistake:Forgetting that BRP branches when the accumulator is ZERO as well as positive.
  • Mistake:Putting DAT lines before HLT. Data lines go after the program, otherwise they will be executed as instructions.

Code examples

LMC: input two numbers and output their sum
text
        INP
        STA first
        INP
        ADD first
        OUT
        HLT
first   DAT
LMC: count down from an input number to zero
text
        INP
        STA count
loop    LDA count
        OUT
        BRZ end
        SUB one
        STA count
        BRA loop
end     HLT
count   DAT
one     DAT 1

Ready to test yourself?

Practise 1.2.4 questions
← Previous noteProcedural languages1.2.4 Types of Programming LanguageNext note →Modes of addressing memory: immediate, direct, indirect and indexed1.2.4 Types of Programming Language

Back to Types of Programming Language

Types of Programming Language

Note 3 of 5

  1. 1The need for and characteristics of a variety of programming paradigms
  2. 2Procedural languages
  3. 3Assembly language and the Little Man Computer instruction set
  4. 4Modes of addressing memory: immediate, direct, indirect and indexed
  5. 5Object-oriented languages: classes, objects, methods, attributes, inheritance, encapsulation, polymorphism
Topic overview