LMC Load and Save

GCSE Computer Science Resources
14-16 Years Old

48 modules covering every Computer Science topic needed for GCSE level, and each module contains:

  • 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
View the GCSE Resources →

KS3 Computing Resources
11-14 Years Old

We’ve created 45 modules covering every Computer Science topic needed for KS3 level, and each module contains:

  • 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
View the KS3 Resources →

The following program will demonstrate the use of LDA and STA, the Load and Save instructions used in the .
Running the program: when prompted, INPUT a set of two numbers. The program should then OUTPUT them in the same order that they were entered.

INP
STA first
INP
STA second
LDA first
OUT
LDA second
OUT
HLT
first DAT
second DAT
0 INP
1 STA 9
2 INP
3 STA 10
4 LDA 9
5 OUT
6 LDA 10
7 OUT
8 HLT
9 DAT 0
10 DAT 0

Instructions

  • Copy the eleven line program above and paste it into the Program box.
  • Click on the “Assemble Program” button.
  • LMC Load and Save Image 1After the program is assembled you should see RAM addresses 0 to 8 contain the machine code instructions shown in the image.
  • Click on the RUN button.
  • If you have difficulty following what is happening, read the explanation below and use STEP instead of RUN so you can follow each step.

Explanation

first and second are used to label a DAT instruction. DAT identifies the 10th and 11th instructions as data. The labels therefore refer to RAM addresses 9 and 10 respectively (0-indexed counting).

0 INP //the first input value is copied into the accumulator.
1 STA first //the accumulator contents are stored in RAM address 9 (labelled
first).
2 INP //the second input value is copied into the accumulator.
3 STA second //the accumulator contents are stored in RAM address 10 (labelled
second).
4 LDA first //the contents of memory address 9 (labelled first) are loaded into
the accumulator.
5 OUT //the value in the accumulator is sent to the OUTPUT.
6 LDA second //the contents of memory address 10 (labelled second) are loaded into
the accumulator.
7 OUT //the value in the accumulator is sent to the OUTPUT.
8 HLT //the program halts.

Example results

INPUT= 2, 3
OUTPUT = 2, 3