Engineers-Excel.com

     
Engineering using Spreadsheets

Little Man Computer: How to use

Description
How to use


Click here to see a video demonstration of the LMC Simulator Tool.

The LMC Simulator consists of 4 sheets:

1. CPU: This sheet shows the workings of the CPU. Clicking the Reset Button will start the execution of the programme loaded in the Little Man Computer's memory. Enabling the "Run at Full Speed" checkbox will cause the LMC to run at max speed.

Note: A blank instruction is treated as instruction: 000 (REST or HALT).

2. Programme: This sheet is the "higher level programme" editor. Enter the insruction in the first column, the memory address in the second and comments in the third.

3. Inputs: This sheet holds the inputs. A blank input is treated as 000.

4. Outputs:
This sheet holds the outputs.

There are 2 options to load and run a programme:

1. Enter the instructions directly into the memory of the LMC on the first sheet and click reset.

The OpCodes Used are:

1xx - ADD - Take the value stored in mailbox xx and add it to the value on the calculator.
2xx - SUBTRACT - Take the value stored in mailbox xx and subtract it from the value on the calculator.
3xx - STORE - Take the value from the calculator and store it in mailbox xx
400 - INPUT - Take the input from the INBOX and enter into the calculator
5xx - LOAD - Take the value from mailbox xx and enter it in the calculator.
6xx - BRANCH - Reset the program counter to the value xx. xx will be the next instruction executed.
7xx - BRANCH IF ZERO - If the calculator contains the value 0, reset the program counter to the value xx.
8xx - BRANCH IF NOT NEGATIVE - If the calculator is not negative, reset the program counter to the value xx.
900 - OUTPUT - Fetch the value from the calculator, and put it in the OUTBOX.
000 - REST - Stop working.


2. Use the Programme sheet to edit the programme. The editor will force the right syntax and point out errors. Then click the Load button to load the programme into the memory. Go the the CPU sheet and click Reset.

The following sample programme to add 2 numbers is pre-loaded into the tool:

INPUT
Input First Number into calculator
STORE 99 Store at address 99
INPUT
Input Second Number into calculator
ADD 99 Add the first number stored at add 99
OUTPUT
Output result
REST
Done