CSC231 Homework 2 2015
--D. Thiebaut (talk) 19:57, 23 September 2015 (EDT)
This assignment is due on Wed, Sept. 30, 2015, at 11:55 p.m.
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 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