Assignment 3

CS/ECE 354-2, Fall 1998

due Monday Oct. 26, before 5pm

Program

Purpose

This program is intended to give practice programming in Pentium assembly language.

Program Statement

Write a Pentium (not SASM!) program that:

Example Runs

Enter string:
bUCky wIns 28-0!
The new string is:
BucKY WiNS 28-0!
Enter string:
0Oo I1i
The new string is:
0oO i1I

Requirements

  1. Your program must contain adequate comments (documentation). Such comments include your name and section number at the top of the program. They also include a description of the program, as well as variable descriptions and comments about the code itself.
  2. Use Pentium instructions only! Do not use SASM instructions! Do not include the statement
         include sasmacros.inc
    
    in your program. Instead, put in the statement
         include Pmacros.inc
    
    You will need to get a copy of the file Pmacros.inc. It is in the directory (folder)
    /p/course/cs354-smoler/public
    
  3. You must read all characters of the input string before any characters of the output string are printed out.
  4. Input character strings will be 80 characters or less. Store the characters of the string in an array.

    Hints

    Handing In the Program

    Follow the guidelines in how to turn in assignments. For this program, you will need to turn in your source code (the .asm extension) and your makefile (the .mak extension). No printout will be turned in.


    Homework

    1. (10 points, 5 each)
      Consider a two dimensional array of IEEE double-precision floating-point numbers (eight bytes each). Let the row index, the first index, vary from 2 to 8, while the column index varies from 0 to 5. Assume that the array is stored in row-major order beginning at address 0x00000040.
        a) How many bytes does it take to store myarray?
        b) Give the hexadecimal address of myarray[6,2].
    2. (3 points)
      A pointer to an element of an array is in register edx. Give a single Pentium instruction that will subtract 4 from this array element.
    3. (12 points)
      At the least significant end of the mantissa of a floating point result are the bits
      0001011  10
      
      The two bits on the right are the guard and round digits for use in rounding. What result will be placed in the least significant digits of the floating point representation if
        a) the result is positive, round toward 0 is used?
        b) the result is negative, round toward 0 is used?
        c) the result is positive, round toward negative infinity is used?
        d) the result is negative, round toward negative infinity is used?
        e) the result is positive, round to nearest is used?
        f) the result is negative, round to nearest is used?

      Handing In the Homework

      Follow the guidelines in how to turn in assignments. For this homework, you will need to turn in a single file containing your answers to the homework questions. To make grading easier, please name your file hw3.txt. No printout will be turned in.