Difference between revisions of "CSC231 Homework 2 2010"
(→Problem #2) |
(→Problem #2) |
||
Line 79: | Line 79: | ||
submit hw2 hw2b.txt | submit hw2 hw2b.txt | ||
+ | |||
+ | =Problem #3: Reverse Engineering= | ||
+ | |||
+ | * First write a program that contains the following instruction: | ||
+ | |||
+ | inc ecx | ||
+ | |||
+ | :Figure out how it gets coded in hexadecimal. This instruction adds 1 to the contents of ecx. So if ecx is 7 before the instruction, it will contain 8 after the instruction has finished executing. | ||
+ | |||
+ | * Below is the list of bytes that are loaded in memory when the mystery program you have to reconstruct is executed. | ||
+ | |||
+ | <code><pre> | ||
+ | |||
+ | 00000000 206D616B657320 | ||
+ | 00000007 706572666563742E2E- | ||
+ | 00000010 2E | ||
+ | 00000011 7072616374696365 | ||
+ | 00000019 627574206E6F626F64- | ||
+ | 00000022 79277320 | ||
+ | 00000026 736F2077687920 | ||
+ | 0000002D 3F0A0A | ||
+ | 00000000 B804000000 | ||
+ | 00000005 BB01000000 | ||
+ | 0000000A B9[11000000] | ||
+ | 0000000F BA08000000 | ||
+ | 00000014 CD80 | ||
+ | 00000016 B8FFFFFFFF | ||
+ | 0000001B B804000000 | ||
+ | 00000020 BB01000000 | ||
+ | 00000025 B9[07000000] | ||
+ | 0000002A B9[00000000] | ||
+ | 0000002F BA07000000 | ||
+ | 00000034 CD80 | ||
+ | 00000036 BA[11000000] | ||
+ | 0000003B B801000000 | ||
+ | 00000040 B804000000 | ||
+ | 00000045 BB01000000 | ||
+ | 0000004A B9[07000000] | ||
+ | 0000004F BA0A000000 | ||
+ | 00000054 CD80 | ||
+ | 00000056 B804000000 | ||
+ | 0000005B BB01000000 | ||
+ | 00000060 B9[19000000] | ||
+ | 00000065 BA0D000000 | ||
+ | 0000006A CD80 | ||
+ | 0000006C B804000000 | ||
+ | 00000071 BB01000000 | ||
+ | 00000076 B9[06000000] | ||
+ | 0000007B BA0A000000 | ||
+ | 00000080 41 | ||
+ | 00000081 CD80 | ||
+ | 00000083 B804000000 | ||
+ | 00000088 BB01000000 | ||
+ | 0000008D B9[24000000] | ||
+ | 00000092 41 | ||
+ | 00000093 BA07000000 | ||
+ | 00000098 41 | ||
+ | 00000099 CD80 | ||
+ | 0000009B B804000000 | ||
+ | 000000A0 BB01000000 | ||
+ | 000000A5 B9[11000000] | ||
+ | 000000AA BA08000000 | ||
+ | 000000AF CD80 | ||
+ | 000000B1 B804000000 | ||
+ | 000000B6 BB01000000 | ||
+ | 000000BB B9[2D000000] | ||
+ | 000000C0 BA03000000 | ||
+ | 000000C5 CD80 | ||
+ | 000000C7 B801000000 | ||
+ | 000000CC BB00000000 | ||
+ | 000000D1 CD80 | ||
+ | |||
+ | </pre></code> | ||
+ | |||
+ | * Your assignment is to write the original code that corresponds to this series of bytes, exactly, and to write in the header of the program you will submit what the output of the program is. | ||
+ | |||
+ | * Store your assembly program in a file called '''hw2b.asm''' and submit it as follows: | ||
+ | |||
+ | submit hw2 hw2b.asm | ||
+ | |||
+ | |||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | [[Category:CSC231]][[Category:Asm]][[Category:Homework]] | ||
+ | |||
+ | * Here is the listing of the opcodes (hexadecimal bytes) that are loaded in memory w |
Revision as of 16:17, 22 September 2010
--D. Thiebaut 20:36, 22 September 2010 (UTC)
Problem #1
- Design a 4-bit adder.
- Each input bit has the same weight.
- Generate the boolean expressions for the bits that represent the sum of the 4 bits.
- Draw the schematics for the least significant output bit. You do not need to draw the schematics for all the bits, just the least significant one. Make sure you draw accurately the AND, OR, EXOR, or NOT gates. Put the part number inside or next to the gate, and add the pin numbers.
- Either scan, take a picture, or use a drawing/CAD package to create an electronic version of your diagram.
- Create a pdf that will contain all the answers to Problem #1. Call this pdf hw2.pdf, and submit it as follows:
submit hw2 hw2.pdf
Problem #2
- Complete the table below which shows the equivalent representations of unsigned integers in binary, hexadecimal, and decimal.
- Use as many bits are required.
- You are not allowed to use binary to decimal, or hexadecimal to decimal conversion tools. You can use calculators or computers to do multiplications and additions, though.
Decimal | Hexadecimal | Binary |
---|---|---|
17 | 11 | 00010111 |
135 | ||
1001 | ||
FF | ||
A01 | ||
FFFF | ||
1111 1000 1001 1000 | ||
1 1111 | ||
1000 1000 1000 1000 1000 1000 1000 1000 |
- Store your answers in a file called hw2b.txt and submit it as follows:
submit hw2 hw2b.txt
Problem #3: Reverse Engineering
- First write a program that contains the following instruction:
inc ecx
- Figure out how it gets coded in hexadecimal. This instruction adds 1 to the contents of ecx. So if ecx is 7 before the instruction, it will contain 8 after the instruction has finished executing.
- Below is the list of bytes that are loaded in memory when the mystery program you have to reconstruct is executed.
00000000 206D616B657320
00000007 706572666563742E2E-
00000010 2E
00000011 7072616374696365
00000019 627574206E6F626F64-
00000022 79277320
00000026 736F2077687920
0000002D 3F0A0A
00000000 B804000000
00000005 BB01000000
0000000A B9[11000000]
0000000F BA08000000
00000014 CD80
00000016 B8FFFFFFFF
0000001B B804000000
00000020 BB01000000
00000025 B9[07000000]
0000002A B9[00000000]
0000002F BA07000000
00000034 CD80
00000036 BA[11000000]
0000003B B801000000
00000040 B804000000
00000045 BB01000000
0000004A B9[07000000]
0000004F BA0A000000
00000054 CD80
00000056 B804000000
0000005B BB01000000
00000060 B9[19000000]
00000065 BA0D000000
0000006A CD80
0000006C B804000000
00000071 BB01000000
00000076 B9[06000000]
0000007B BA0A000000
00000080 41
00000081 CD80
00000083 B804000000
00000088 BB01000000
0000008D B9[24000000]
00000092 41
00000093 BA07000000
00000098 41
00000099 CD80
0000009B B804000000
000000A0 BB01000000
000000A5 B9[11000000]
000000AA BA08000000
000000AF CD80
000000B1 B804000000
000000B6 BB01000000
000000BB B9[2D000000]
000000C0 BA03000000
000000C5 CD80
000000C7 B801000000
000000CC BB00000000
000000D1 CD80
- Your assignment is to write the original code that corresponds to this series of bytes, exactly, and to write in the header of the program you will submit what the output of the program is.
- Store your assembly program in a file called hw2b.asm and submit it as follows:
submit hw2 hw2b.asm
- Here is the listing of the opcodes (hexadecimal bytes) that are loaded in memory w