Difference between revisions of "CSC231 Homework 2 2010"

From dftwiki3
Jump to: navigation, search
(Created page with '--~~~~ ---- <center> <font size="+2">Page under construction!</font> <br \>300px </center> __TOC__ <br /> <br /> <br /> <br /> =Problem #1= *…')
 
(Problem #3: Reverse Engineering)
 
(12 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 20: Line 22:
 
* Each input bit has the same weight.
 
* Each input bit has the same weight.
 
* Generate the boolean expressions for the bits that represent the sum of the 4 bits.
 
* 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.
+
* 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.
 
* 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:
 
* Create a pdf that will contain all the answers to Problem #1.  Call this pdf hw2.pdf, and submit it as follows:
Line 27: Line 29:
  
 
=Problem #2=
 
=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.
 +
 +
 +
{| style="color:green; background-color:#ffffcc;" cellpadding="10" cellspacing="0" border="1"
 +
! 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...
 +
 +
<code><pre>
 +
 +
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
 +
 +
</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 its output is.
 +
 +
* Store your assembly program in a file called '''hw2c.asm''' and submit it as follows:
 +
 +
    submit hw2 hw2c.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

Latest revision as of 09: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