In: Computer Science
Q17. Fill in the blanks:
Consider the operands to be signed words (16 bit)
a) mov ax, - 48 cwd mov bx , 5 idiv bx ; ax = _______ , dx = _____ (provide answers in decimal) Consider the operands to be signed words (16 bit)
b) mov ax , -1 mov bx , -1 imul bx ; ax = _________H, dx =__________H (provide answer in Hex) Consider the operands to be signed words
c) mov ax , -1 mov dx , 2 imul dx ; ax = _______H ,dx = ________H(provide answer in Hex) Consider the operands to be signed byte (8 bit)
d) mov al, -48 cbw mov bl, 5 idiv bl ; al = _____, ah = _______ (provide answers in decimal) 5
Q18. Fill in the values as the following code fragment is executed:
a) count DB 9A H ; count is Byte variable initialized to 9A H num DB BC H ; num is a Byte variable initialized to BCH mov ah, count mov al, num ; ax = _______________H
b) mov ax, 1234H mov ax, ‘A’ ; ax = ________________H (Hint: ASCII code of ‘A’ = 65 in decimal)
c ) mov dx , 0087H mov ax, 6000H mov bx, 100H div bx ; ax = ________________H
d) mov ax, 1237H sub al, 38H ; ax = ________________H
a) mov ax, - 48
cwd
mov bx , 5
idiv bx ; ax = -9 , dx = -3
Ans. IDIV performs signed integer division
b) mov ax , -1
mov bx , -1
imul bx ; ax =00000001 H, dx =00000000H
Ans. IMUL performs multiplication if 8,16,32 bit data with either AL, AX or EAX. Preserves sign of product by sign extending it into upper half of destination register.
c) mov ax , -1
mov dx , 2
imul dx ; ax = FFFFFFFE H ,dx = 00000000H
Ans. IMUL performs multiplication if 8,16,32 bit data with either AL, AX or EAX. Preserves sign of product by sign extending it into upper half of destination register.
d) mov al, -48
cbw
mov bl, 5
idiv bl ; al = -9 , ah = -3
Ans. IDIV performs signed integer division
Q18. Fill in the values as the following code fragment is executed:
a) count DB 9A H ; count is Byte variable initialized to 9A H
num DB BC H ; num is a Byte variable initialized to BCH
mov ah, count
mov al, num ; ax = 9ABC H
Ans. Here data of count variable is stored in higher byte of Accumulator (ah) and data of num variable is stored at lowwer byte of Accumulator (al). Hence 2 datas are stored in one register.
b) mov ax, 1234H
mov ax, ‘A’ ; ax = 1241 H (Hint: ASCII code of ‘A’ = 65 in decimal)
c ) mov dx , 0087H
mov ax, 6000H
mov bx, 100H
div bx ; ax = 8760 H
d) mov ax, 1237H
sub al, 38H ; ax = 12FF H