Difference between revisions of "CSC231 Homework 2 2010"

From dftwiki3
Jump to: navigation, search
(Problem #2)
(Problem #3: Reverse Engineering)
 
(5 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
----
 
----
  
<center>
+
<!--center>
 
<font size="+2">Page under construction!</font>
 
<font size="+2">Page under construction!</font>
 
<br \>[[File:UnderConstruction.jpg|300px]]
 
<br \>[[File:UnderConstruction.jpg|300px]]
</center>
+
</center-->
  
 
__TOC__
 
__TOC__
Line 11: Line 11:
  
 
<br />
 
<br />
 
+
<tanbox>
 +
Homework due on 9/29 at 11:59 p.m. + 1 minute, even on Mountain Day!
 +
</tanbox>
 
<br />
 
<br />
  
Line 88: Line 90:
 
: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.
 
: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.
+
* Below is the list of bytes that are loaded in memory when the mystery program you have to reconstruct is executed.  Be careful that the way the bytes are listed may not be necessarily the way they would be listed by the assembler...
  
 
<code><pre>
 
<code><pre>
Line 94: Line 96:
 
00000000 206D616B657320
 
00000000 206D616B657320
 
00000007 706572666563742E2E-
 
00000007 706572666563742E2E-
00000010 2E
+
00000010 2E7072616374696365
00000011 7072616374696365
 
 
00000019 627574206E6F626F64-
 
00000019 627574206E6F626F64-
00000022 79277320
+
00000022 79277320736F2077687920
00000026 736F2077687920
 
 
0000002D 3F0A0A
 
0000002D 3F0A0A
 
00000000 B804000000
 
00000000 B804000000
Line 113: Line 113:
 
00000034 CD80
 
00000034 CD80
 
00000036 BA[11000000]
 
00000036 BA[11000000]
0000003B B801000000
+
0000003B B8010000
00000040 B804000000
+
00000040 00B80400
00000045 BB01000000
+
00000045 0000BB01000000
 
0000004A B9[07000000]
 
0000004A B9[07000000]
 
0000004F BA0A000000
 
0000004F BA0A000000
Line 133: Line 133:
 
00000088 BB01000000
 
00000088 BB01000000
 
0000008D B9[24000000]
 
0000008D B9[24000000]
00000092 41
+
00000092 41BA
00000093 BA07000000
+
00000093 07000000
 
00000098 41
 
00000098 41
 
00000099 CD80
 
00000099 CD80
Line 153: Line 153:
 
</pre></code>
 
</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.
+
* 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 its output is.
  
* Store your assembly program in a file called '''hw2b.asm''' and submit it as follows:
+
* Store your assembly program in a file called '''hw2c.asm''' and submit it as follows:
  
     submit hw2 hw2b.asm
+
     submit hw2 hw2c.asm
  
  

Latest revision as of 10:46, 1 October 2010

--D. Thiebaut 20:36, 22 September 2010 (UTC)





Homework due on 9/29 at 11:59 p.m. + 1 minute, even on Mountain Day!



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. Be careful that the way the bytes are listed may not be necessarily the way they would be listed by the assembler...

00000000	206D616B657320
00000007	706572666563742E2E-
00000010	2E7072616374696365
00000019	627574206E6F626F64-
00000022	79277320736F2077687920
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	B8010000
00000040	00B80400
00000045	0000BB01000000
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	41BA
00000093	07000000
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 its output is.
  • Store your assembly program in a file called hw2c.asm and submit it as follows:
   submit hw2 hw2c.asm











  • Here is the listing of the opcodes (hexadecimal bytes) that are loaded in memory w