Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1 How is the value -45 represented inside the computer? 2- What is the 2\'s comp

ID: 3870476 • Letter: 1

Question

1 How is the value -45 represented inside the computer? 2- What is the 2's complement of 89? 3- What is the decimal value of the signed 8 bit number 11001100? 4- What is the decimal value of the signed 8 bit number 01111000? 5- What is the largest positive value (decimal) in a 16 bit register (assuming 2's complement is used)? What is the largest and smallest negative value (decimal) in a 16 bit register (assuming 2's complement is used)? 6- 7- Write a program to move 8 to AL and 7 to BL. Then add the two values placing the result in BL Then add 240 to BL. Then add 1 to BL. Then add 99 to AL. Next to each instruction write the value of Z and C flag after that instruction is executed. For example the lines below show the values of C and F flags after each of the following lines are executed. This is just showing you how the problem should be answered ADDB ss, %AL MOVB $1, %BL

Explanation / Answer

[1] Computers are designed to use binary digits to represent numbers and other information
Negative numbers are stored using $ 2's$ complement. This is obtained by taking the 1's complement of the binary representation of the positive number and then adding to it.

-45 --->   0101101
1's com     1010010
               +0000001
---------------------------
2's com     1010011

[2] two’s complement binary number 8bit
89 --> 01011001

[3]If the leftmost bit is a 1, the number is negative
11001100 --> -52

Step :
Flip all the bits in the number. (11001100 becomes 00110011.)
Add 1 to the number. (00110011 + 1 = 00110100.)
Convert the result to base 10 and report its negation.
0+0+32+16+0+4+0+0 = -52 [starts with a 1. It's negative]


[4] 01111000 --> 120

Step :
If the leftmost bit is a 0, the number is positive or zero. Convert the number from base 2 to base 10
0 + 64 +32 + 16 + 8 + 0 + 0 + 0 = 120