Difference between revisions of "CSC231 Homework 1 2010"
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | <!--{{ CSC231 Homework infobox | |
+ | | homework name=Homework #1 | ||
+ | | date=Sept. 15 2010 | ||
+ | | description=This assignment is due on Wednesday, Sept. 22, at 11:59 p.m. + 1 minute. Programs submitted passed the deadline will not be collected or graded.<br />You can work on this assignment individually or in a group of two. If you decide to work in pair, make sure you have read the very good article on [http://maven.smith.edu/~jfrankli/111s08/pairProgramming2000.pdf Pair Programming]. If you work in pair, you only need to submit one program for each question. Make sure both the name of both programmers appear in the header of the script. | ||
+ | }}--> | ||
<tanbox> | <tanbox> | ||
Line 76: | Line 80: | ||
* Add this information in the header of your program, and add a paragraph explaining the difference you observe between the executable files '''hw1a''' and '''hw1b'''. | * Add this information in the header of your program, and add a paragraph explaining the difference you observe between the executable files '''hw1a''' and '''hw1b'''. | ||
+ | |||
+ | ==Submission== | ||
* Submit your program as follows: | * Submit your program as follows: | ||
submit hw1 hw1b.asm | submit hw1 hw1b.asm | ||
+ | |||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | [[Category:CSC231]][[Category:Homework]] |
Latest revision as of 08:37, 21 September 2010
This assignment is due on Wednesday, Sept. 22, at 11:59 p.m. + 1 minute. Programs submitted passed the deadline will not be collected or graded.
You can work on this assignment individually or in a group of two. If you decide to work in pair, make sure you have read the very good article on Pair Programming. If you work in pair, you only need to submit one program for each question. Make sure both the name of both programmers appear in the header of the script.
Problem #1
- Write an assembly language program that outputs this series of characters.
abcdefghiklmnopqrstuvwxyz abcdefghiklmnopqrstuvw abcdefghiklmnopqrst abcdefghiklmnopq abcdefghiklmn abcdefghik abcdefg abcd a
- We haven't seen loops yet. Loops are a complex concept to master. Do not attempt to use loops, even though your programmer's intuition might want you to try it. :-)
- For this Problem, create a single string that is the whole list of characters above, all 9 lines of it, and print it as a block. In other words, you will have only 1 block of 4 instructions of the type mov eac, ____, mov ebx,____, mov ecx,___, and mov edx,____.
- Store your program in a file called hw1a.asm. Assemble, link and run your program. Verify that it works well.
- Measure the size of the executable file hw1a as follows.
echo `ls -l hw1a | cut -d' ' -f 5` bytes
- You should see something of the form:
1234 bytes
- Include this number in the header of your program, as the size of its executable.
- The purpose of measuring the total size of the executable is to get a sense of the trade-off that exists when writing program between the amount of code versus the amount of data. In general, trying to make one of them simpler or shorter requires making the other longer, or more complex.
Submission
- When your program is debugged, generates the correct output, contains the file size in the header, and is well documented otherwise, submit it as follows:
submit hw1 hw1a.asm
Problem #2
- The problem here is very similar to the previous problem in that the program must output the same text pattern:
abcdefghiklmnopqrstuvwxyz abcdefghiklmnopqrstuvw abcdefghiklmnopqrst abcdefghiklmnopq abcdefghiklmn abcdefghik abcdefg abcd a
- but this time, your program can only contain two strings, declared as follows:
alphabet db "abcdefghiklmnopqrstuvwxyz" linefeed db 10
- Your code section will therefore have to contain many different blocks, each one printing one line of the output.
- Go ahead and code your program, and store it in a file called hw1b.asm.
- Assemble and link it. Verify that it gives you the correct output.
- When you have the correct output, measure the size in bytes of your executable as you did in Problem 1.
- Add this information in the header of your program, and add a paragraph explaining the difference you observe between the executable files hw1a and hw1b.
Submission
- Submit your program as follows:
submit hw1 hw1b.asm