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

1. Registry conditions: A. Show how the decimal integer * -120 would be stored i

ID: 3882341 • Letter: 1

Question

1. Registry conditions:

        A. Show how the decimal integer

         * -120 would be stored in 16 bits
         * -120 would be stored in 8 bits
         * -32456 would be stored in 32 bits
         * -32456 would be stored in 16 bits

        B. For each of the following decimal numbers, tell whether it could be
        stored (1) as a 16-bit number (2) as an 8-bit number.

         * 32768
         * -40000
         * 65536
         * 257
         * -128

        C. For each of the following 16-bit signed numbers, tell whether it is
        positive or negative.

         * 1010010010010100b
         * 78E3h
         * CB33h
         * 807Fh
         * 9AC4h

        D. For each of the following instructions, give the new destination contents
        and the new settings of CF,SF,ZF,PF, and OF. Suppose that the flags are
        initially 0 in each part of this question. (Note: need not show AF)

         * ADD AX,BX   where AX contains 7FFFh and BX contains 0001h.
         * SUB AL,BL   where AL contains 01h and BL contains FFh.
         * DEC AL      where AL contains 00h.
         * NEG AL      where AL contains 7Fh.
         * XCHG AX,BX   where AX contains 1ABCh and BX contains 712Ah.
         * ADD AL,BL   where AL contains 80h and BL contains FFh.
         * SUB AX,BX   where AX contains 0000h and BX contains 8000h.
         * NEG AX      where AX contains 0001h.


         E. Suppose ADD AX,BX is executed. In each of the following part, the first
         number being added is the contents of AX, and the second number is the
         contents of BX. Give the resulting value and tell whether unsigned or signed
         overflow occurred.

              512Ch
            +4185h
             ------

              FE12h
            +1ACBh
                ------

            E1E4h
            +DAB3h
          ------

              7132h
            +7000h
                ------

        6389h
            +1176h
           ------

         F. Suppose SUB AX,BX is executed. In each of the following part, the first
         number is the initial contents of AX and the second number is the contents of
         BX. Give the resulting value and tell whether unsigned or signed overflow
         occurred.

             2143h
            -1986h
            ------

             81FEh
            -19BCh
               ------

             19BCh
            -81FEh
               ------

               0002h
            -FEOFh
           ------

             8BCDh
            -71ABh
               ------

Explanation / Answer

A.

In signed representation, the most significant bit is reserved for the sign (0 for +, 1 for -). A negative number is represented in 2's complement. 2's complement is obtained by adding 1 to 1's complement.

120 in binary notation is (in 16 bits): 0000 0000 0111 1000

1's complement is: 1111 1111 1000 0111

2's complement: 1111 1111 1000 1000

In 8 bits, 120: 0111 1000

1's complement is: 1000 0111

2's complement is: 1000 1000

32456 in binary notation (32 bits) is: 0000 0000 0000 0000 0111 1110 1100 1000

1's complement is: 1111 1111 1111 1111 1000 0001 0011 0111

2's complement is: 1111 1111 1111 1111 1000 0001 0011 1000

In 16 bits, 32456 is 0111 1110 1100 1000

1's complement is: 1000 0001 0011 0111

2's complement is: 1000 0001 0011 1000

B.

If N bits are used to store numbers, signed integers can range from: -2N-1 to 2N-1 - 1

If N bits are used to store unsigned numbers (only positive values), the range is 0 to 2N - 1.

So for 16-bit signed integers, the range is -32768 to 32767

For 16-bit unsigned integers, the range is 0 to 65535

For 8-bit signed integers, the range is -128 to 127

For 8-bit unsigned integers, the range is 0 to 255

So the answers are:

C.

The most significant bit represents the sign. So if the MSB is 1, it is a negative number, other wise it is a positive number.

In hexadecimal notation, if the MSB is 1, the fourth hexadecimal number (most significant) will be greater than or equal to 8, i.e. the range is 8, 9, A, B, C, D, E, F for negative numbers.

Based on the above explanation,

As per chegg rules, only 4 subparts of a question need to be answered. 4 subparts of three questions have been answered above. For the rest, please raise a separate question.