CSC231 Homework 1 2010

From dftwiki3
Revision as of 20:28, 15 September 2010 by Thiebaut (talk | contribs) (Created page with '<center> <font size="+2">Page under construction!</font> <br \>300px </center> <tanbox> This assignment is due on Wednesday, Sept. 22, at 11:59 p.…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Page under construction!
UnderConstruction.jpg

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.



Contents



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.