In: Computer Science
a)The decimal equivalent of the signed 2’s complement 8-bit binary number 11010101B is ______________.
b)The decimal equivalent of the unsigned 8-bit hex number 0B4H is ______________.
c)The value of the expression ‘H’ – ‘B’ is less than / equal to / greater than that of the expression ‘L’ – ‘C’.
d)If the .data segment contains declarations
A BYTE 2 DUP (‘a’), ‘+’
B BYTE 3 DUP (‘b’), 0
C BYTE 4 DUP (‘c’), ‘–’
D BYTE 5 DUP (‘d’), 0
then the instruction
input A, D, 6
will display a Windows dialog box with title _______________________________.
f)If eax = 302B59A1H, and ebx = 700CD37DH, then the instruction
add ax, bx
will leave the value ______________________________ in the eax register.
Solution:-
a) Given signed 2's complement of 8 bit binary number 11010101.
Identify whether the given bit is negative or positive. If the MSB is 1 then the binary number is negative and if it is 0 then the binary number is positive.
Find 1's complement of 11010101
11010101 - 1 = 11010100
Reverse all the bits
!(11010100) = 00101011
Assign power of 2 values
128 64 32 16 8 4 2 1
| | | | | | | |
0 0 1 0 1 0 1 1
Therefore, (11010101)binary = (32 + 8 + 2 + 1)
=43 decimal
Since this was a signed binary digits our asnwer will hold minus i.e. -(43) decimal.
b) 8 bit hex value to decimal value
First split all the bits as shown
0 B 4
Replace each bit with its equivalent 4 bit binay digits.
0 = 0000
B = 1011
4 = 0100
Now, combine all the binary digits obtained above
0B4 = 0000 1011 0100
Represent the power of 2's value, since we are working with 8 bit I am eleminating the 4 bits of MSB
128 64 32 16 8 4 2 1
| | | | | | | |
1 0 1 1 0 1 0 0
Therefore, add all the 1 with its 2's power value
(0B4) hex = (128 + 32 + 16+ 4)
= 180 decimal
Thus the decimal of 8 bit (0B4)H = (180)D
c) In this we are considering ASCII value and its equivalent hexadeciaml value.
So,
H - B = 72 - 66
because ASCII (H) = 72 Decimal
and ASCII (B) = 66 Decimal
Therefore, 72 - 66 = 6
L - C = 76 - 67
because ASCII (L) = 4C = 76 Decimal
and ASCII (C) = 67 Decimal
Therefore, 76 - 67 = 9
Thus, we can say that, 'H' - 'B' is less than 'L' - 'C'
f) The bx is getting added to ax, which produces the value as A0382D1E
with the window showing all the registers and flag, a screen similar to as shown below.
EAX 302B59A1 EBX 700CD37D ECX 00000101 EDX FFFFFFFF EAX=302B59A1 EBX=700CD37D ECX=00000101 EDX=FFFFFFFF ESI=00000000 EDI=00000000 EBP=0012FFF0 ESP=0012FFC4 EIP=00401024 EFL=00000206 CF=0 SF=0 ZF=0 OF=0
Note:- I am not completely aware of question 'd' concept. I will ready that concept and expalin it to you as soon as possible.