Using Labels with the LMC Simulator

KS3 Computer Science

11-14 Years Old

48 modules covering EVERY Computer Science topic needed for KS3 level.

GCSE Computer Science

14-16 Years Old

45 modules covering EVERY Computer Science topic needed for GCSE level.

A-Level Computer Science

16-18 Years Old

66 modules covering EVERY Computer Science topic needed for A-Level.

GCSE Computer Memory Resources (14-16 years)

  • An editable PowerPoint lesson presentation
  • Editable revision handouts
  • A glossary which covers the key terminologies of the module
  • Topic mindmaps for visualising the key concepts
  • Printable flashcards to help students engage active recall and confidence-based repetition
  • A quiz with accompanying answer key to test knowledge and understanding of the module

A-Level Data Storage Resources (16-18 years)

  • An editable PowerPoint lesson presentation
  • Editable revision handouts
  • A glossary which covers the key terminologies of the module
  • Topic mindmaps for visualising the key concepts
  • Printable flashcards to help students engage active recall and confidence-based repetition
  • A quiz with accompanying answer key to test knowledge and understanding of the module

Labels are used to label a memory address. This makes it much easier to refer to memory addresses which hold data or instructions.

Example 1 – using labels with data:

  • data1 DAT
    • Explanation: The memory address where this data is stored would be labelled data1. No data would initially be stored at this location. If this was the 7th line of assembly code to be compiled then the label would refer to memory address 6 (RAM addresses start at 0)
  • data1 DAT 50
    • Explanation: The memory address where this data is stored would be labelled data1 and store the data 50. If this was the 7th line of assembly code to be compiled then the data 50 would be stored at memory address 6 (RAM addresses start at 0)
  • STA data1
    • Explanation: The contents of the accumulator would be stored at memory address 6.
  • LDA data1
    • Explanation: The data which is stored at memory address 6 would be loaded into the accumulator.

Example 2 – using labels with branch instructions: (i.e. BRP, BRA & BRZ)

  • loop1 INP
    • Explanation: The memory address where this instruction is stored would be labelled loop1.
  • BRZ loop1
    • Explanation: If the contents of the accumulator were zero, the program would branch to the memory address labelled loop1 and carry out the instruction there. To achieve this, the Program Counter would be set to the memory address labelled loop1.
    • If the contents of the accumulator were not zero then the Program Counter would simply be incremented by one.

An example program using labels with data and branch instructions

(it outputs the numbers 1 – 10 in sequence)

start LDA store
OUT
ADD one
STA store
LDA limit
SUB store
BRP start
HLT
store DAT 1
one DAT 1
limit DAT 10
0 LDA 8
1 OUT
2 ADD 9
3 STA 8
4 LDA 10
5 SUB 8
6 BRP 0
7 HLT
8 DAT 1
9 DAT 1
10 DAT 10
Using Labels with the LMC Simulator Image 3