Difference between revisions of "CSC231 Homwork 2 Solution 2010"

From dftwiki3
Jump to: navigation, search
(Logic Design)
 
(4 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
 
__TOC__
 
__TOC__
 +
 +
<onlysmith>
 +
=Number Systems=
 +
<code><pre>
 +
Angela Zhu
 +
231a-ab
 +
hw2b.txt
 +
CSC 231
 +
Sept. 29, 2010
 +
 +
Decimal: 135
 +
Hexadecimal: 87
 +
Binary: 1000 0111
 +
 +
Decimal: 1001
 +
Hexadecimal: 3E9
 +
Binary: 0011 1110 1001
 +
 +
Decimal: 255
 +
Hexadecimal: FF
 +
Binary: 1111 1111
 +
 +
Decimal: 2561
 +
Hexadecimal: A01
 +
Binary: 1010 0000 0001
 +
 +
Decimal: 65535
 +
Hexadecimal: FFFF
 +
Binary: 1111 1111 1111 1111
 +
 +
Decimal: 63640
 +
Hexadecimal: F898
 +
Binary: 1111 1000 1001 1000
 +
 +
Decimal: 31
 +
Hexadecimal: 1F
 +
Binary: 1 1111
 +
 +
Decimal: 2290649224
 +
Hexadecimal: 88888888
 +
Binary: 1000 1000 1000 1000 1000 1000 1000 1000
 +
 +
</pre></code>
  
 
=Logic Design=
 
=Logic Design=
Line 164: Line 207:
 
</pre></code>
 
</pre></code>
  
 +
==Testing the Mystery Program==
 
<br />
 
<br />
 +
* To test the programs, the hexadecimal dump of the object file of the original program was compared to the hexadecimal dump of the object file of your version.
 +
* Assume that hw2_mystery.solution.asm is the orginal that you have to recreate, and assume that hw2c.asm is your program:
 +
 +
nasm -f elf hw2c.asm
 +
hexdump -C hw2c.o | tail -190 | head -40 > hw2c.lst
 +
 +
nasm -f elf hw2_mystery.solution.asm
 +
hexdump -C hw2_mystery.solution.o | tail -190 | head -40 > hw2_mystery.solution.lst
 +
 +
diff -y hw2_mystery.solution.lst  hw2c.lst
 +
 +
* The output is shown below.  When only 1 vertical bar separates the two columns, then the program on the left matches the program on the right.  When double vertical bars appear, there is a difference between the two programs.  Visual inspection will indicate where the problem bytes are...
 +
 +
000001f0  04 00 00 00 08 00 00 00  00 00 00 00 00 00 00 00  | 000001f0  04 00 00 00 08 00 00 00  00 00 00 00 00 00 00 00  |
 +
00000200  20 6d 61 6b 65 73 20 70  65 72 66 65 63 74 2e 2e  | 00000200  20 6d 61 6b 65 73 20 70  65 72 66 65 63 74 2e 2e  |
 +
00000210  2e 70 72 61 63 74 69 63  65 62 75 74 20 6e 6f 62  | 00000210  2e 70 72 61 63 74 69 63  65 62 75 74 20 6e 6f 62  |
 +
00000220  6f 64 79 27 73 20 73 6f  20 77 68 79 20 3f 0a 0a  | 00000220  6f 64 79 27 73 20 73 6f  20 77 68 79 20 3f 0a 0a  |
 +
00000230  b8 04 00 00 00 bb 01 00  00 00 b9 11 00 00 00 ba  | 00000230  b8 04 00 00 00 bb 01 00  00 00 b9 11 00 00 00 ba  |
 +
00000240  08 00 00 00 cd 80 b8 ff  ff ff ff b8 04 00 00 00  | | 00000240  08 00 00 00 cd 80 b8 04  00 00 00 bb 01 00 00 00  |
 +
00000250  bb 01 00 00 00 b9 07 00  00 00 b9 00 00 00 00 ba  | | 00000250  b9 07 00 00 00 b9 00 00  00 00 ba 10 00 00 00 cd  |
 +
00000260  07 00 00 00 cd 80 ba 11  00 00 00 b8 01 00 00 00  | | 00000260  80 ba 11 00 00 00 b8 01  00 00 00 b8 04 00 00 00  |
 +
00000270  b8 04 00 00 00 bb 01 00  00 00 b9 07 00 00 00 ba  | | 00000270  bb 01 00 00 00 b9 07 00  00 00 ba 0a 00 00 00 cd  |
 +
00000280  0a 00 00 00 cd 80 b8 04  00 00 00 bb 01 00 00 00  | | 00000280  80 b8 04 00 00 00 bb 01  00 00 00 b9 19 00 00 00  |
 +
00000290  b9 19 00 00 00 ba 0d 00  00 00 cd 80 b8 04 00 00  | | 00000290  ba 0d 00 00 00 cd 80 b8  04 00 00 00 bb 01 00 00  |
 +
000002a0  00 bb 01 00 00 00 b9 06  00 00 00 ba 0a 00 00 00  | | 000002a0  00 b9 06 00 00 00 ba 0a  00 00 00 41 cd 80 b8 04  |
 +
000002b0  41 cd 80 b8 04 00 00 00  bb 01 00 00 00 b9 24 00  | | 000002b0  00 00 00 bb 01 00 00 00  b9 24 00 00 00 41 ba 07  |
 +
000002c0  00 00 41 ba 07 00 00 00  41 cd 80 b8 04 00 00 00  | | 000002c0  00 00 00 41 cd 80 b8 04  00 00 00 bb 01 00 00 00  |
 +
000002d0  bb 01 00 00 00 b9 11 00  00 00 ba 08 00 00 00 cd  | | 000002d0  b9 0e 00 00 00 ba 0b 00  00 00 cd 80 b8 04 00 00  |
 +
000002e0  80 b8 04 00 00 00 bb 01  00 00 00 b9 2d 00 00 00  | | 000002e0  00 bb 01 00 00 00 b9 2d  00 00 00 ba 03 00 00 00  |
 +
000002f0  ba 03 00 00 00 cd 80 b8  01 00 00 00 bb 00 00 00  | | 000002f0  cd 80 b8 01 00 00 00 bb  00 00 00 00 cd 80 00 00  |
 +
00000300  00 cd 80 00 00 00 00 00  00 00 00 00 00 00 00 00  | | 00000300  00 54 68 65 20 4e 65 74  77 69 64 65 20 41 73 73  |
 +
 
<br />
 
<br />
 
<br />
 
<br />
 +
</onlysmith>
 
<br />
 
<br />
 
<br />
 
<br />

Latest revision as of 12:21, 14 December 2010

--D. Thiebaut 21:35, 6 October 2010 (UTC)




This section is only visible to computers located at Smith College