CS 273

Homework 6

Due Monday, November 12, 2001

Read the information on double-byte data and indexed addressing in section 2.3 (pp 71-73, 75-77). Also, read section 5.1 and 5.4-5.7 on stacks and subroutines.

Not From the Book

You may work with other people in the class on conceptualizing the problem; however, this homework is to be done alone. Be sure to reference in your program the people that you work with on the conceptualization of the problem.

Assignment (40 points)

Write a program with a subroutine that will convert a string to all upper case letters. You will need to execute this subroutine on all available constant strings (3 of them) defined in the program. It should work like this:

  1. Be well-structured. It should be possible to easily break it down into the structures described in the book and class.
  2. Your program should use fcc or fcb to put three character strings in EEPROM (somewhere). Be sure to use a fcb to put a 0 in the byte immediately after your strings if you are using fcc to define the constant string.
  3. Your program also needs to define the maximum length of a string to be converted. You may do this by using either `equ' or `fcb' directives, but be sure your use them correctly. Also, the maximum length of the string must be greater than 1 character.
  4. First subroutine, should take one parameter -- the string to be converted; the body of the subroutine should do the following:
  5. Main subroutine (no parameters) should do the following:
    For each character in the buffer, you need to see if it is between 'a and 'z. If it is, you need to convert it to upper case; fortunately, in ASCII you can do this by adding char(A) - char(a) to it. Any other character can be copied directly. Again you are done when you hit a character with a value of 0.
  6. Third subroutine, should take one parameter -- the location in memory to put the converted string (remember to alot for the fact that the string may be the maximum string length);the body of the subroutine should do the following:
  7. Explicitly stop your program; use a "dead loop" as defined in class.
  8. Use appropriate comments to describe what your program is doing. Writing proper comments is an art; you need to describe what your code is doing, not restate the lines of code.
  9. The comments at the top of the program should indicate:

You may (in fact, you probably will) find it helpful to start by writing the program in some imperative high-level language of your choice, and translate that program into assembly code. But that's not an explicit part of the assignment.

Assemble, simulate, and debug your program before submitting it through the Web Submission page. Note: You will receive no points for a program that does not assemble.


Last modified: Tue Nov 6 20:30:34 MST 2001