Monday, 9 December 2013

Little Man Computer (Input&Output)

 

                                                  Little Man Computer (Input&Output)

Program


INP
OUT
HLT

What you should do

  1. Click on the "LMC Simulator Applet" link to start the LMC simulator.
  2. Clear the Message Box and all of the LMC mailboxes -- click the "Clear Messages" button and the "Clear" button if necessary.
  3. Copy the three-line program above and paste it into the Message Box
  4. Click on the "Compile Program" button.
  5. Click on the "Run" button.
  6. When prompted, enter a three-digit number in the "In-Box", and press the "Enter" button.

What you should see

  • After the program is compiled, you should see 901 in mailbox 0 and 902 in mailbox 1.  The Program Counter should start at 0 (click on "Reset" if necessary).
  • When you click on "Run" or "Step", the Message Box will describe the actions of each instruction.
  • After the INP instruction, the Accumulator has a copy of the value in the In Box.
  • After the OUT instruction, the Out Box has a copy of the value in the Accumulator.
  • The final value of the Program Counter is 2.  This mailbox holds 0 - the machine code instruction that tells the LMC to stop executing your program.

No comments:

Post a Comment