Answers to End of Chapter Reviews and Exercises
for Assembly Language for x86 Processors, 7th Edition
Chapters 1 to 13
Revision date: 1/18/2014
Chapter 1
1.7.1 Short Answer Questions
-
Most significant bit (the highest numbered bit).
-
(a) 53 (b) 150 © 204
-
(a) 110001010 (b) 110010110 © 100100001
-
00000110
-
(a) 8 (b) 32 © 64 (d) 128
-
(a) 12 (b) 16 © 16
-
(a) 35DA (b) CEA3 © FEDB
-
(a) 0000 0001 0010 0110 1111 1001 1101 0100
(b) 0110 1010 1100 1101 1111 1010 1001 0101
© 1111 0110 1001 1011 1101 1100 0010 1010 -
(a) 58 (b) 447 © 16534
-
(a) 98 (b) 1203 © 671
-
(a) FFE8 (b) FEB5
-
(a) FFEB (b) FFD3
-
(a) 27641 (b) 16093
-
(a) 19666 (b) 32208
-
(a) −75 (b) +42 © −16
-
(a) −128 (b) −52 © −73
-
(a) 11111011 (b) 11010110 © 11110000
-
(a) 10111000 (b) 10011110 © 11100110
-
(a) AB2 (b) 1106
-
(a) B82 (b) 1316
-
42h and 66d
-
47h and 71d
-
229 1, or 6.8056473384187692692674921486353 X 1038
-
286 1, or 77371252455336267181195263
-
Truth table:
-
Truth table: (last column is the same as #25)
-
It requires 24 (16) rows.
-
2 bits, producing the following values: 00, 01, 10, 11
1.7.2 Algorithm Workbench
-
Code example (C++)
int toInt32(string s) {
int num = 0;
for(int i = 0; s[i] >= ‘0’ && s[i] <= ‘1’; i++) {
num = num * 2 + s[i]-‘0’;
}
return num;
} -
Code example (C++)
int hexStrToInt32(string s) {
int num = 0;
for(int i = 0; ; i++) {
if( s[i] >= ‘0’ && s[i] <= ‘9’ )
num = num * 16 + s[i]-‘0’;
else if( s[i] >= ‘A’ && s[i] <= ‘F’ )
num = num * 16 + (s[i]-‘A’+10);
else
break;
}
return num;
} -
Code example (C++)
string intToBinStr( int n ) {
vector stack;do {
int quotient = n / 2;
int remainder = n % 2;
stack.push_back(remainder);
n = quotient;
} while( n > 0 );
完整答案链接:http://dt2.8tupian.net/2/23240a12b500.pg3