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:
- Prints the string "Enter string: ".
- Reads a character string one character at a time until end of line
('\n').
- Changes the case of each alphabetic character
(e.g., 'A' -> 'a'
and 'b' -> 'B').
- Leaves other characters unchanged
(e.g., '9' -> '9').
- Prints the string "The new string is: ".
- Prints the new characters including a terminating '\n'.
- Exits after processing one string.
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
-
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.
-
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
-
You must read all characters of the input string before
any characters of the output string are printed out.
- Input character strings will be 80 characters or less.
Store the characters of the string in an array.
Hints
- Take a look at the course web page under
programming advice.
This page has been appended to include a section on dealing
with Pentium assembly language code.
- Note that the operation of the I/O instructions work
a little bit different for Pentium programs than they did
for SASM programs.
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
- (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].
- (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.
- (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.