Homework 5
EECE 417
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.
-
Your program must use at least one procedure!!!
-
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 found
on a link on the textbook website.
-
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 textbook 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.
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].
-
(5 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.
-
(25 points)
Write a sample instruction that illustrates each of the following
addressing modes. Show memory and registers before and after each
instruction is executed. Use the same initial values of memory and
registers for each part of the problem.
a) register mode
b) immediate mode
c) register direct
d) base displacement
e) direct addressing
Handing In the Assignment
For this assignment, you will need to turn in a single zip file. To make
grading easier, please name the file hw5.GX.zip. No printout will
be turned in.