Not a premium member yet? Save 100's of hours on lesson prep with a comprehensive library of GCSE Computer Science resources - including worksheets, tests, and PowerPoint presentations.
Download the complete GCSE Computer Science bundle including all teacher resources and student revision:
- 200+ Computer Science/ICT resources
+ any we release in the future!
- Access to all student revision notes
- OCR, AQA, Edexcel and WJEC compatible
- New 9-1 GCSE spec
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
- Copy the three-line program above and paste it into the Program box.
- Click on the “Assemble Program” button.
- After 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.
INP //the input value is copied into the accumulator. OUT //the value in the accumulator is sent to the OUTPUT. HLT //the program halts.
INPUT = 2
OUTPUT = 2