Q
Q
assembly
CopyEdit
Explanation:
assembly
CopyEdit
Explanation:
• ROR (Rotate Right) rotates bits in BX to the right. Bit shifted from LSB is inserted into
MSB.
Q.2. Describe any two string operation instructions with their functions and syntax.
assembly
CopyEdit
MOVSB
Explanation:
assembly
CopyEdit
CMPSB
Explanation:
• Subtracts the two bytes: result not stored, but flags are affected (ZF, SF, etc.)
Q.3. What are the functions of CALL and RET instruction? Write syntax of CALL and RET
instructions.
CALL Instruction:
Function: Calls a procedure (subroutine). Saves current IP (Instruction Pointer) on the stack.
assembly
CopyEdit
CALL ProcedureName
RET Instruction:
Function: Returns from the procedure to the calling instruction by popping IP from the stack.
assembly
CopyEdit
RET
Q.4. What will be content of register BX and CF flag after execution of following:
assembly
CopyEdit
SHL BX, CL
Binary:
Result:
• BX = 0000 0101 0000 → Shifted 5 times = 0001 0000 0000 0000 = 1000H
assembly
CopyEdit
assembly
CopyEdit
XLAT
• AL = [BX + AL]
Q.6 Write the appropriate 8086 instructions to perform the following operation.
assembly
CopyEdit
SHL AL, 1
SHL AL, 1
or
assembly
CopyEdit
MOV CL, 2
SHL AL, CL
assembly
CopyEdit
MOV CS, AX ; Not directly allowed – must be done via far jump
• Needs FAR JMP or indirect method. Direct MOV CS is invalid.
assembly
CopyEdit
assembly
CopyEdit
ROL BX, CL
assembly
CopyEdit
DAA
Step-by-Step:
Final:
• AL = 00H
• CF = 1 (Carry generated)
Q.9 Instructions:
assembly
CopyEdit
SHL BX, CL
assembly
CopyEdit
MOV DS, AX
assembly
CopyEdit
DEC CL
JNZ LOOP1
Answer:
• Final: AL = 00H
Syntax:
assembly
CopyEdit
DAS
• Example:
assembly
CopyEdit
DAS
1. BT – Bit Test
• Used for repeating a string instruction for a defined count (in CX).
• Example:
assembly
CopyEdit
MOV CX, 10
1. JZ – Jump if Zero
3. JC – Jump if Carry
Example:
assembly
CopyEdit
CMP AL, BL
JZ EQUAL
Operation Instruction
MOV AX, BX
Copy BX to CS
MOV CS, AX (via FAR JMP)
TEST AND
3. DAA → Implicit
Instructions:
assembly
CopyEdit
Explanation:
Q.20 Instructions:
assembly
CopyEdit
XCHG AX, BX
1. AND
2. OR
3. XOR
4. NOT
1. MOVSB
2. CMPSB
3. LODSB
4. STOSB
assembly
CopyEdit
MOVSB
1. JZ – Jump if Zero
3. JC – Jump if Carry