Ques
Ques
Ques
5) b. Suppose
MOV AX,[SI]; where DS = 1200h, SI = 0044h
then the data will go which bank?
Ans: In the given scenario, the instruction "MOV AX, [SI]" is executed. The DS
(Data Segment) register is set to 1200h, and the SI (Source Index) register is set to
0044h.
When the instruction is executed, it accesses the memory location pointed to by
the combination of DS and SI registers. In this case, DS = 1200h and SI = 0044h.
Therefore, the effective memory address is calculated as 1200h:0044h.
The effective memory address 1200h:0044h indicates that the data is located in
the memory bank with the segment address 1200h and the offset address 0044h.
In other words, the data will be retrieved from the memory bank starting at
address 12000h and located at an offset of 44h within that bank.
6) b. What happens to the constants of AX, BX, DX register after execution of the
following 8086 instruction sequence?
i) MOV AX,99D;
MOV BX,10D
DIV BX;
Ans:
MOV AX, 99D;
MOV BX, 10D;
DIV BX;
After executing these instructions, the contents of the registers are as follows:
AX: The quotient of the division operation, which is 99 divided by 10 (9 in this
case).
BX: The value 10D remains unchanged.
DX: The remainder of the division operation, which is 99 divided by 10 (9 in this
case).
MOV AX, 5559D;
MOV BX, 66D;
MUL BX;
After executing these instructions, the contents of the registers are as follows:
AX: The product of the multiplication operation, which is 5559 multiplied by 66.
BX: The value 66D remains unchanged.
DX: The upper 16 bits of the result of the multiplication operation are stored in
DX.
Please note that the actual values in AX, BX, and DX registers will depend on the
specific values used in the instructions, and the provided values (99D, 10D, 5559D,
66D) are used here for illustration purposes.
7) c. Show the how flag register is affected by the addition of FB2CH and 8C1BH
MOV BX, FB2CH
ADD BX, 8C1BH
Ans:
To determine how the flag register is affected by the addition of FB2CH and
8C1BH, let's go through the instructions step by step:
1. MOV BX, FB2CH:
This instruction moves the value FB2CH into the BX register. It means that BX now
holds the value FB2CH.
2. ADD BX, 8C1BH:
This instruction adds the value 8C1BH to the contents of the BX register. The
addition is performed as follows:
FB2C
8C1B
178E7
After the addition, the result 178E7 is stored in the BX register. Now, let's examine
how the flag register is affected:
Carry Flag (CF): The carry flag is set if there is a carry-out from the most significant
bit (bit 15) during addition. In this case, since there is no carry-out, the CF flag will
be cleared (0).
Overflow Flag (OF): The overflow flag is set if the result of a signed operation is
too large or too small to fit into the destination operand. In this case, we are
performing an unsigned addition, so the OF flag is not relevant and remains
unchanged.
Zero Flag (ZF): The zero flag is set if the result of an operation is zero. In this case,
the result is not zero, so the ZF flag will be cleared (0).
Sign Flag (SF): The sign flag is set if the result is negative (has the most significant
bit, bit 15, set to 1). In this case, the result is positive, so the SF flag will be cleared
(0).
Auxiliary Carry Flag (AF): The auxiliary carry flag is set if there is a carry-out from
bit 3 to bit 4 during addition. In this case, there is no carry-out from bit 3 to bit 4,
so the AF flag will be cleared (0).
Parity Flag (PF): The parity flag is set if the result has an even number of set (1)
bits. In this case, the result has an odd number of set bits, so the PF flag will be set
(1).
Direction Flag (DF): The direction flag does not change in this scenario and
remains unaffected.
Carry Flag (CF): The carry flag is set if there is a carry-out from the most significant
bit (bit 15) during addition. In this case, since there is no carry-out, the CF flag will
be cleared (0).
Therefore, after the addition of FB2CH and 8C1BH, the flag register will be:
CF = 0
OF = unchanged
ZF = 0
SF = 0
AF = 0
PF = 1
DF = unchanged
7) b. If SP = 5FCBH, AX = 4C5DH, BX = 25CFH and DX = 5fCDH, Show the contents
of the following stack as each instruction is executed.
i) PUSH BX and i) POP DX
ii) PUSH AX and ii) POP AX
iii) PUSH DX and iii) POP BX
Ans:
Let's go through each instruction step by step:
Given:
SP = 5FCBH (Stack Pointer)
AX = 4C5DH
BX = 25CFH
DX = 5FCDH
I) PUSH BX:
SP = 5FC9H
Stack:
Address 5FC9H: 25CFH
After the operation:
Decrement SP by 2:
SP = 5FC9H
Write the value of AX (4C5DH) to the memory location pointed to by SP:
Stack:
Address 5FC9H: 4C5DH
iv) POP AX:
SP = 5FC9H
Stack:
Address 5FC9H: 4C5DH
After the operation:
SP = 5FCBH
Stack:
(empty)
After the operation:
Decrement SP by 2:
SP = 5FC9H
Write the value of DX (5FCDH) to the memory location pointed to by SP:
Stack:
Address 5FC9H: 5FCDH
vi) POP BX:
SP = 5FC9H
Stack:
Address 5FC9H: 5FCDH
After the operation:
Read the value from the memory location pointed to by SP (5FC9H):
BX = 5FCDH
Increment SP by 2:
SP = 5FCBH
Stack:
(empty)
At the end of these instructions, the stack is empty, and the values of the registers
are as follows:
SP = 5FCBH
AX = 4C5DH
BX = 5FCDH
DX = 5FCDH