Difference between revisions of "CSC231 Homework 2 2015"
(→Problem 3) |
|||
Line 3: | Line 3: | ||
<br /> | <br /> | ||
<bluebox> | <bluebox> | ||
− | This assignment is due on Wed, Sept. 30, 2015, at 11:55 p.m. | + | This assignment is due on Wed, Sept. 30, 2015, at 11:55 p.m. <br /> |
+ | You can work in pair on this assignment. If you do so, make sure you include both names in the header of your program, and | ||
+ | that both students in the pair submit the program on Moodle under their name. | ||
</bluebox> | </bluebox> | ||
<br /> | <br /> |
Revision as of 19:00, 23 September 2015
--D. Thiebaut (talk) 19:57, 23 September 2015 (EDT)
This assignment is due on Wed, Sept. 30, 2015, at 11:55 p.m.
You can work in pair on this assignment. If you do so, make sure you include both names in the header of your program, and
that both students in the pair submit the program on Moodle under their name.
Contents
Preparation
- ssh to aurora with your 231a-xx account.
- get 3 programs from my 231a account on aurora:
wget http://cs.smith.edu/~dthiebaut/handout/hw2_1 wget http://cs.smith.edu/~dthiebaut/handout/hw2_2 wget http://cs.smith.edu/~dthiebaut/handout/hw2_3
- make the programs executable:
chmod a+rx hw2_*
- you are now ready to work on all 3 problems for this week, which go in increasing levels of complexity.
Problem 1
- Recreate, as exactly as possible, the original program called hw2_1.asm which, when assembled and linked, yielded the program hw2_1.
- Save your program in a file called hw2_1.asm, and make sure that:
- when you assemble and link it (using nasm -f elf, and ld -melf_i386), your executable has the same size as mine, and
- the hexdump of your program matches the hexdump of mine, and, finally,
- the output of your program is the same as the output of mine.
- Submit your program on Moodle, in the HW 2 PB 1 section (when available)
Problem 2
- Recreate, as exactly as possible, the original program called hw2_2.asm which, when assembled and linked, yielded the program hw2_2.
- Save your program in a file called hw2_2.asm, and make sure that:
- when you assemble and link it (using nasm -f elf, and ld -melf_i386), your executable has the same size as mine, and
- the hexdump of your program matches the hexdump of mine, and, finally,
- the output of your program is the same as the output of mine.
- Submit your program on Moodle, in the HW 2 PB 2 section (when available)
Problem 3
- Recreate, as exactly as possible, the original program called hw2_3.asm which, when assembled and linked, yielded the program hw2_3.
- Save your program in a file called hw2_3.asm, and make sure that:
- when you assemble and link it (using nasm -f elf, and ld -melf_i386), your executable has the same size as mine, and
- the hexdump of your program matches the hexdump of mine, and, finally,
- the output of your program is the same as the output of mine.
- Submit your program on Moodle, in the HW 2 PB 3 section (when available)
- Note: I may have used some instructions that we haven't see yet (as of 9/23/15), and which are illustrated in the code below:
mov eax, ebx ; copy the contents of ebx into eax
mov ebx, eax ; copy the contents of eax into ebx
mov ebx, ecx ; copy the contents of ecx into ebx
mov edx, eax ; copy the contents of eax into edx
mov eax, edx ; copy the contents of edx into eax
mov ebx, edx ; copy the contents of edx into ebx