Assignment 05

Contents:

  • Overview
  • Internet Requirements
  • Practice Problems
  • Problems to be Submitted
  • Extra Credit

  • Overview

    Topic: Computer Architecture, Low-Level Programming
    Related Reading: Ch. 5, Ch. 7
    Due: 9am Tuesday, 30 July 2002

    Internet Requirements

    For this assignment, we will rely heavily on the PEP/7 software demonstrated in class. You will need to have either a connection to the CC network, or you will have to download a copy of the software to your own machine.

    Practice Problems

  • Do the following Machine Language Lab with Pep/7, if you have not already done so. (the sample program files you need can be found at J:\NS121\General\Pep7\samplefiles\.

  • Do the following Assembly Language Lab with Pep/7, if you have not already done so. (the sample program files you need can be found at J:\NS121\General\Pep7\samplefiles\.

  • Exercise 8 of Ch. 7 (p. 220); answer in back of text

  • Exercise 13 of Ch. 7 (p. 221); answer in back of text

  • Exercise 16 of Ch. 7 (p. 221); answer in back of text

  • Exercise 19 of Ch. 7 (p. 221); answer in back of text

  • Exercise 31 of Ch. 7 (p. 222); answer in back of text

  • Exercise 34 of Ch. 7 (p. 223); answer in back of text

  • Problems to be Submitted (20 points)

    1. (4 points)
      Exercise 15 of Ch. 7 (p. 221).

    2. (4 points)
      Exercise 17 of Ch. 7 (p. 221).

    3. (4 points)
      Exercise 24 of Ch. 7 (p. 222). To be fair to all, you need only do the first five characters of your first name.
      (See program on page 209 of text as a similar example)

    4. (4 points)
      Write the assembly-langauge program which inputs three values (A, B, and C respectively), and outputs the value (A-B)-C.
      (See program on pages 213-214 of text as a similar example)

    5. (4 points)
      Write the assembly-langauge program which inputs three values (A, B, and C respectively), and outputs the value A-(B-C).
      For this problem, you are not allowed to use the ADD instructions.
    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 (2 points)

    We would like to have a program which has the following behavior. Two input numbers should be read from the user. The larger of the two should be printed as output.

    Though it seems easy, accomplishing this task requires several additional instructions of PEP7 which are not discussed in the text.

  • br label
    (shorthand for "Branch")
    This sets the Program Counter (PC) to 'label' and therefore causes the instruction stored at 'label' to be the next to be executed (as opposed to the default, which is to execute the instruction which immediately follows the current one).

  • compx operand
    This compares the value currently stored in X to the value specified by the operand. The result is stored in what are known as "status bits" within the CPU.

  • brge label
    (shorthand for "Branch if Greater Than or Equal To")
    This statement checks the status bits (set by a previous comparison). If the register contents of the previous comparison were greater than or equal to the operand it was compared against, then the Program Counter (PC) is set to be 'label' and therefore causes the instruction stored at 'label' to be the next to be executed.
  • Working out a solution will be quite a feat on your part given this admittedly brief lesson. But alas, it is extra credit...


    ns121 Class Page
    visprof@coloradocollege.edu