Difference between revisions of "CSC231 Homework 1"
(→Problem #1: Number conversions) |
(→Problem #2: Reverse engineering) |
||
Line 77: | Line 77: | ||
Reconstruct the original program and write its assembly code. Store your program in a file called '''hw1.asm''' (no uppercase, and it's a one in front of the dot, not an ell). | Reconstruct the original program and write its assembly code. Store your program in a file called '''hw1.asm''' (no uppercase, and it's a one in front of the dot, not an ell). | ||
+ | |||
+ | Remember that you can generate the listing of your assembly program by using the '''-l''' (minus ell) switch: | ||
+ | |||
+ | nasm -f elf -F stabs -l hw1.lst hw1.asm | ||
The output of your program should be the same output as the program shown here outputs when it runs. | The output of your program should be the same output as the program shown here outputs when it runs. |
Revision as of 14:13, 10 September 2008
<meta name="keywords" content="computer science, assembly language, pentium, exercise, machine language, intel" /> <meta name="description" content="Dominique Thiebaut's Web Page" /> <meta name="title" content="Dominique Thiebaut -- Computer Science" /> <meta name="abstract" content="Dominique Thiebaut's Computer Science Web pages" /> <meta name="author" content="thiebaut at cs.smith.edu" /> <meta name="distribution" content="Global" /> <meta name="revisit-after" content="10 days" /> <meta name="copyright" content="(c) D. Thiebaut 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,2008" /> <meta name="robots" content="FOLLOW,INDEX" />
Contents
Assignment #1
This assignment is due on Wednesday 9/17/08, at 11:59 p.m. plus one minute. You will need to submit the different parts of this assignment electronically so make sure you have a working CSC231 class account.
Problem #1: Number conversions
Convert by hand the following decimal numbers in binary and in hexadecimal:
11 23 65 1023
Convert the following hexadecimal numbers to binary and decimal
11 23 6f ffffffff
Convert the following binary numbers to hexadecimal and decimal
01010101 11110 1111 1110 1101 0001
Store your answers in a file called hw1.txt (all lowercase, with a one, not an ell in front of the dot) in your 231a-xx account. The information below will show you how to submit this file.
Problem #2: Reverse engineering
Same exercise as the one we did in class. Here is the collection of bytes representing the program
00000000 676565
00000003 7A20626163
00000008 6B7320666172652063
00000011 6C696D6220696E2070
0000001A 6F6F6C210A0A0A
00000000 B804000000BB
00000006 01000000BA
0000000B 03000000
0000000F B9[00000000]
00000014 CD80BB01000000
0000001B BA03000000
00000020 B804000000
00000025 B9[08000000]
0000002A CD80BB01000000
00000031 BA05000000
00000036 B9[0C000000]
0000003B B804000000
00000040 CD80BB01000000
00000047 BA07000000
0000004C B9[1A000000]
00000051 B804000000
00000056 CD80BB01000000
0000005D BA12000000
00000062 B9[00000000]
00000067 B804000000
0000006C B801000000
00000071 BB00000000CD80
Reconstruct the original program and write its assembly code. Store your program in a file called hw1.asm (no uppercase, and it's a one in front of the dot, not an ell).
Remember that you can generate the listing of your assembly program by using the -l (minus ell) switch:
nasm -f elf -F stabs -l hw1.lst hw1.asm
The output of your program should be the same output as the program shown here outputs when it runs.
Submission
To submit your files, you need to connect to your 231a-xx account where the two files will reside: hw1.txt and hw1.asm.
Submit both hw1.txt and hw1.asm as follows:
submit hw1 hw1.txt submit hw1 hw1.asm
To verify that the files have been copied to your instructor's handin folder correctly, try submitting both files again, and if the submit command asks if you want to overwrite the already existing file, then that means that your file is already submitted and in the right place.
You may submit new versions of your program at any time. When you submit a file a second time, it overwrites the previous version.