Assignments | Course Home | Schedule & Lecture Notes | Submit

Saint Louis University

Computer Science 140
Introduction to Computer Science

Michael Goldwasser

Fall 2006

Dept. of Math & Computer Science

Assignment 05

Machine Language

Contents:


Overview

Topic: Machine Language
Related Reading: Ch. 2.1-2.3, and Appendix C
Due: 8pm Tuesday, 3 October 2006


Internet Requirements

For this assignment, we will rely heavily on the CPU Simulator software demonstrated in class. You will need to have an external Internet connection to run this software.


Practice Problems


Problems to be Submitted (20 points)

  1. (3 points)

    Complete Chapter Review Problem 3 of Ch. 2 (p. 110)

  2. (5 points)

    Complete Chapter Review Problem 9 of Ch. 2 (pp. 111).

  3. (5 points)

    Complete Chapter Review Problem 11 of Ch. 2 (p. 111).

  4. (7 points)

    2 Oct 2006: Uh oh.
    The description for this problem was designed using the example of code from Problem 17 on page 112 of the book. Unfortunately, when typing up the assignment I accidentally said to use Problem 20 on page 113.

    If you have not already done this problem, I prefer to have you use Problem 17, and so I am writing the rest of this description assuming that you do so. However if you have already worked through the problem with the code for Problem 20 and are comfortable with your answer, feel free to submit that answer and I'll grade it.

    Consider the program which is specified in Chapter Review Problem 17 of Ch. 2 (p. 112). Rather than solving the problem as stated in the book, we wish you to do the following.

    Demonstrate the execution of each individual instruction as follows. Give a table as follows, showing the values of the Program Counter(PC), Instruction Register(IR), and the first three general purpose registers, as each exists at the end of each fetch phase of the machine cycle. Continue until the machine halts (it shouldn't be too long...)

    PC    IR    R0   R1   R2
    --   ----   --   --   --
    00   2003   00   00   00
    02   2101   03   00   00
    
    Notice that the first line shows the state of the three registers at the point when the first instruction has been fetched, but not yet executed.

Overall, please type your answers to all of the problems in a single document to be submitted electronically. Please see details about the submission process.


Extra Credit (3 points)

In class, we examined a program which computed the absolute value of the number originally stored in memory address 20 and it writes that result to address 21.

Here, we want you to write a program which computes the absolute value of the difference between the values stored in address 20 and address 21. You should write this result to address 22.


CSCI 140, Fall 2006
Michael Goldwasser
goldwamh at our university domain

Last modified: Wednesday, 04 October 2006
Assignments | Course Home | Schedule & Lecture Notes | Submit