Lab #1

The goal of this assignment is to write your first assemble language program using the different components we've talked about in class. Please follow the instructions and be sure to start early.

Things you'll need to understand and be able to use to do this lab:

  • Basic syntax of assembler
  • syscalls for reading and printing integers and strings
  • Some basic instructions and pseudo ops: li,la,move,add,sub,lb,sb,syscall,j,ble,bgt,etc.
  • Understanding of the basic assembler directives: .data, .text, .asciiz, etc.
  • Lab Report Format & Requirements (What you need to do and what you need to turn in):

    1. Program written in any high level language you choose (C, C++, Pascal, Fortran, Cobol, Lisp, Java, etc.) Be sure to comment and fully test this version. 
    2. A revised version of the program with comments and notes indicating how each part will be converted into assembly language.
      Relevant info would include: where labels will be created (and label names) and which registers will be used and for what purposes. (Do this prior to writting the MIPS version of the program)
    3. Program written in MIPS Assembly - This should be well commented
    4. "Test Cases" - What test cases did you use to verify that you're program worked?
    5. Sample Runs: Show me the test cases for BOTH your high level language program and the Assembly version.
      Use your test cases and comment the output to demonstrate that it worked as expected.
      Your test cases should show that the program did work correctly.
    6. Match the structure of the generated output as closely as possible
    7. Answer the following questions:
      1. What test cases did you use and why? (What was each case meant to test?)
        (My advice is to write test cases BEFORE programming)
      2. What mistakes did you make in writing the program?
      3. How might you revise/improve the program?
      4. How long did this assignment take you?
      5. How long did you spend debugging?
      6. Were there any special debugging techniques that you used?
      7. Were there any special development techniques that you used?

    The Program:

    Write a simple distance calculator to add distances in feet and inches and print the total number of yards, feet, and inches.
    The program should allow the user to continue entering distances until they enter 0 feet and 0 inches.
    Although the data entered will just be in feet and inches, the final sum should be in feet, inches and yards.
    (See Sample Runs)

    Sample Runs:

    Run 1:

    Enter the number of feet: 3
    Enter the number of inches: 2
    Enter the number of feet: 1
    Enter the number of inches: 4
    Enter the number of feet: 5
    Enter the number of inches: 5
    Enter the number of feet: 0
    Enter the number of inches: 0
    Total Distance: 3 yards, 0 feet, and 11 inches.
    
      
    
    

    Run 2:

    Enter the number of feet: 5
    Enter the number of inches: 11
    Enter the number of feet: 9
    Enter the number of inches: 15
    Enter the number of feet: 0
    Enter the number of inches: 0
    Total Distance: 5 yards, 1 feet, and 2 inches.

    Hints & Suggestions:

    1. Start Early 
    2. Revise your C/C++ program as much as possible.
      Try to think about how it will translate to ASM and revise it to make it easier.
      (A more complex/hard to follow C program may translate to a simpler ASM program)
    3. Work slowly and methodically - Translate one line of C at a time.
      Make notes about register usage/etc. before starting the ASM.
    Getting Started:
    SPIM Setup:
    For this program you SHOULD load the trap file
    You need to be sure that you are NOT emulating a bare machine