Difference between revisions of "CSC231 Homework 4 2014"
(→Problem #1: Addressing modes and one-dimensional arrays) |
|||
Line 24: | Line 24: | ||
<br /> | <br /> | ||
+ | ==Submission== | ||
+ | <br /> | ||
+ | Submit your program in Moodle's '''Homework 4, Problem 1''' section. | ||
+ | <br /> | ||
+ | |||
=Problem #2: Documentation and Style= | =Problem #2: Documentation and Style= | ||
<br /> | <br /> |
Revision as of 06:33, 21 October 2014
--D. Thiebaut (talk) 07:11, 21 October 2014 (EDT)
The assignment is due on 10/28/10 at 11:55 p.m.
Problem #1: Addressing modes and one-dimensional arrays
Assume that your data section is initialized with the following variables:
msg db 3,"ALL",11,"PROGRAMMERS",3,"ARE",11,"PLAYWRIGHTS"
db 3,"AND",3,"ALL",9,"COMPUTERS",3,"ARE",5,"LOUSY"
db 6,"ACTORS"
N equ 10
Note that the msg contains byte numbers followed by words. The byte number preceeding a word corresponds to the number of letters in the word. So '3,"ALL"' for example means that the word that follows 3 is a 3-character word. '11,"PROGRAMMERS"' means that the string following the byte that contains 11 is an 11-character word.
N represents the total number of words in the string msg.
Your assignment is to write a program that uses one or several loops that go N times and that print all the words on separate lines, one after the other, such that each word is capitalized, i.e. its first letter is uppercase, and the others are lowercase.
Submission
Submit your program in Moodle's Homework 4, Problem 1 section.
Problem #2: Documentation and Style
Take your solution program for Problem 1, above, and document it fully. Use past solution programs as examples.
Your program should have:
- A header, containing the name of the program (its file name), the name of the author, a description of what it does (and possible bugs you may know it to contain, and how one should assemble, link, and run it
- Markers highlighting where the data section and code section are located
- Comments throughout the code indicating what the various blocks of instructions do. Do not hesitate to add blank lines in your code to separate logical blocks. Make sure your comments help understand how the computation progresses, rather than what the instruction is doing.
- For example, here is a bad way of documenting an instruction:
inc ebx ; increment ebx
- This is not very helpful because we are not learning anything more about what the code is doing. Instead, if eax is a pointer to a list of characters, a more useful comment would have been:
inc ebx ; move ebx to the next character in string
- You do not have to document each instruction. Only those that are important, or where having some additional details would help.
- Make sure you use variables that have self-documenting names. x, a, for example, do not carry much information. But message, char, index are better.