LMC solution




Exercise 1

Little man computer programming Exercise ( Objective – Write a LCM program that performs as follow)

1) Obtains and stores 3 numbers from the LMC users.

2) Calculates the sum of the first number and the second number.

3) Determines if the 3rd nimber is larger than the sum or smaller than the sum of the 1st two number.

4) Halts if the 3rd number is larger than the sum of the first two numbers.

5) Contines if the 3rd number is smaller than the sum of the first two number by dong the following two actions:

i. Outputs the different between the sum and 3rd number

ii. Loops back to the begining of the program.

Start by Creating a flow Chart: Don not write code or thing about how this can possible by programmed ( imagine that it is someone esle’s job to write the code,

and that you don’t know what computer or programming language they are using) . Be sure that your flowchart uses decision point- diamond shapes with a question inside and more then one path exiting the diamond. Ideally, you should use a drawing program like powerpoint to create this flowchart.

= Write your program on paper, closely referencing our flow chart as you do so. Be sure that your written program contains thes 4 columns:

Memory Address/ Operation code / Instruction Mnemonic/ Description

= When you have completed the previous step, mentally review your work from start to finish to see if it makes sense and can be expected to succed.

= Input your program into the LCm and prove it works. Test both cases. Try different number sets to make sure that your program is reliable.

= To complete this lab, enter your program code int an Excel spreadsheet or word document. It should be easy to read and follow, and it should include the 4

columns described above.

Exercise 2

Little man computer programming

1) Obtains a nibble from the LMC user by collecting 1 bit at a time. Non-binary values must be rejected (ignored, just keep prompting for correct value)
2) Converts the nibble to a decimal value.
3) Provides the decimal value to the user and then halts.
Instruction and Requirements:

Create a flow chart, Follow the same flow chart guidelines and recommendations from the previous LMC lab.Write your program. Test it extensively. Revise as necessary.Document your program code within an Excel spreadsheet in the same fashion (or better) that you used in the previous LMC lab. Be sure that your spreadsheet has 4 following columns:

Memory Address/ Operation code/ Instruction Mnemonic and Description