In: Computer Science
ASSEMBLY LANGUAGE PROGRAMMING
1. The decimal equivalent of the signed 2’s complement 8-bit binary number 11010101B is ______________.
2. The decimal equivalent of the unsigned 8-bit hex number 0B4H is ______________.
3. The value of the expression ‘H’ – ‘B’ is less than / equal to / greater than that of the expression ‘L’ – ‘C’.
4. 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 _______________________________.
5. If eax = 302B59A1H, and ebx = 700CD37DH, then the instruction add ax, bx will leave the value ______________________________ in the eax register.
6. If eax = 0FFFFFFFFH, and edx = 0FFFFFFFFH, then the instruction imul edx will leave the value ______________________________ in the edx register.
7. If eax = 0D000000DH, and edx = 50000005H, then the instruction idiv dl will leave the value ______________________________ in the eax register.
8. If ax = 3BC4H, then the following instructions cmp ah, al jg Label will / will not cause a jump to Label.
9. If ax = 3BC4H, then the following instructions cmp ah, al ja Label will / will not cause a jump to Label.
10. The following instructions mov eax, 0 mov ecx, 1100B L1: inc eax loop L1 will leave the value ______________________________ in the eax register.
1. a. Check whether it is a positive or a negative number? In a
signed binary two's complement, first bit (the leftmost) indicate
the sign,1 = negative, 0 = positive.
1101 0101B is binary representation of negative 8 bit number.
b. Get the binary representation in one's complement
Do this only when the number is negative
Subtract 1 from the binary initial number:
1101 0101 - 1 = 1101 0100
c. Get the binary representation of the positive (unsigned) number.
Do this step only if the number is negative
Flip all the bits in the signed binary one's complement
representation (reverse the digits) - replace the bits set on 1
with 0s and the bits on 0 with 1s:
!(1101 0100) = 0010 1011
d. Map the unsigned binary number's digits versus the
corresponding powers of 2 that their place value represent.
27 26 25 24
23 22 21 20
0 0 1 0 1 0 1 1
e. Multiply each bit by its corresponding power of 2 and add all
the terms up:
0010 1011(2)=(0 × 27+ 0 × 26+ 1 ×
25+ 0 × 24+ 1 × 23+ 0 ×
22 + 1 × 21+ 1 ×
20)(10)=(0 + 0 + 32 + 0 + 8 + 0 + 2
+1)(10)=(32 + 8 + 2 +
1)(10)=43(10)
f. If needed, adjust the sign of the integer number by the first
digit (leftmost) of the signed binary:
1101 0101(2)= -43(10)
2. (0B4)₁₆ = (0 × 16²) + (11 × 16¹) + (4 × 16⁰) = (180)₁₀
3. Less than
4. Dup
5. A0382D1EH
6. FFFFFFFE00000000H
7. 0D000000DH ÷ 50000005H= 2
Remainder : 3000000H
8. jg is jump if greater it will.
9. ja is jump if above it will.
10. 1100B