LMC Input and Output

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.

KS3 Low-level Programming (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 Assembly Languages (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

The following program will demonstrate the INPUT and OUTPUT instructions of the LMC.

Running the program: the program simply INPUTS a number, then OUTPUTS it.

INP
OUT
HLT

Instructions

  • Copy the three-line program above and paste it into the Program box.
  • Click on the “Assemble Program” button.
  • LMC Input and Output Image 1After the program is assembled you should see RAM addresses 0 to 2 contain the machine code instructions shown in the image.
  • Click on the RUN button.
  • When prompted, INPUT a number.
  • 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

INP //the input value is copied into the accumulator.
OUT //the value in the accumulator is sent to the OUTPUT.
HLT //the program halts.

Example results

INPUT = 2
OUTPUT = 2

Further Readings: