CSCI 201 Fall 2003

Short Assignment 1: Assembly Level Programming Using Little Man Computer

In this assignment, you will work with Little Man Computer, a computer simulation program developed to introduce students to the basic functions of the CPU. Little Man Computer can be either run interactively over the internet or downloaded to your computer using the following link.

View the attached power point slides and then answer the questions below. Your answers should be submitted in hard copy at the start of class one week from the date that this assignment is given.

Questions

  1. The following Little Man program is supposed to add two input numbers, subtract a third input number from the sum, and output the result, i.e

    OUT = IN1 + IN2 - IN3

    Carefully trace the program. Find what's wrong with the program and modify the program so that it produces the correct output.

    
           Location      Mnemonic
                00         input        
    	    01         store 99 
    	    02         input
    	    03         add 99
    	    04         store 99
    	    05         input
    	    06         subtract 99
    	    07         output
    	    08         halt      
    
    


  2. Using the Little Man Computer program layout as shown on the slides (that is, using Mailbox Address, Code, and Instruction Description columns), write a program that outputs the even numbers from 0 to 10 in ascending order. You can only receive at most two input values - the values 0 (this is the first even number to output) and 2 (adding this number to the previous even number will give you the next even number to output). You cannot start with any data already in memory. Be sure to start your instructions at mailbox #00 and any data you store should begin in mailbox #99 and then proceed in descending order. You should not need more than 17 instructions for this entire program.