0% found this document useful (0 votes)
13 views9 pages

Q

The document provides a comprehensive overview of assembly language instructions for the 8086 microprocessor, detailing operations such as stack initialization, bit manipulation, string operations, and procedure calls. It explains the functions and syntax of various instructions, including MOV, ROR, DAA, and REP, along with examples of their usage. Additionally, it covers addressing modes, branching instructions, and logical operations, making it a valuable resource for understanding 8086 assembly programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views9 pages

Q

The document provides a comprehensive overview of assembly language instructions for the 8086 microprocessor, detailing operations such as stack initialization, bit manipulation, string operations, and procedure calls. It explains the functions and syntax of various instructions, including MOV, ROR, DAA, and REP, along with examples of their usage. Additionally, it covers addressing modes, branching instructions, and logical operations, making it a valuable resource for understanding 8086 assembly programming.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Q.1.

Write appropriate instructions to perform following operations:

(a) Initialize stack at 42000H

assembly

CopyEdit

MOV AX, 4200H ; Load upper part of 42000H into AX

MOV SS, AX ; Load AX into SS (Stack Segment)

MOV SP, 0000H ; Initialize Stack Pointer

Explanation:

• Stack segment starts at SS:SP = 4200:0000 = Physical address 42000H.

(b) Rotate register BX right 4 times

assembly

CopyEdit

MOV CL, 04H ; Number of times to rotate

ROR BX, CL ; Rotate right BX 4 times

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.

1. MOVSB – Move Byte String

Function: Moves byte from source string to destination string.

assembly

CopyEdit

MOVSB

Explanation:

• SI points to source (DS:SI)

• DI points to destination (ES:DI)

• After execution: [ES:DI] ← [DS:SI]

2. CMPSB – Compare Byte Strings

Function: Compares byte at [DS:SI] with [ES:DI] and sets flags.

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

MOV BX, 050H

MOV CL, 05H

SHL BX, CL

Binary:

• BX = 0000 0101 0000 (050H = 80)

• CL = 05 → Shift 5 times left

Result:

• BX = 0000 0101 0000 → Shifted 5 times = 0001 0000 0000 0000 = 1000H

• BX = 1000H, CF = 0 or 1 depending on last shifted-out bit (in this case: CF = 0)


Q.5. Explain the following instructions of 8086.

(i) DAA – Decimal Adjust after Addition

Use: Adjusts result of addition to valid BCD.

assembly

CopyEdit

MOV AL, 09H

ADD AL, 07H ; AL = 10H (invalid BCD)

DAA ; AL becomes 16 (Valid BCD)

(ii) XLAT – Translate Byte to Table Entry

assembly

CopyEdit

XLAT

• AL = [BX + AL]

• Used in look-up tables for character conversion or encryption.

Q.6 Write the appropriate 8086 instructions to perform the following operation.

(i) Multiply AL register contents by 4 using shift:

assembly

CopyEdit

SHL AL, 1

SHL AL, 1

or

assembly

CopyEdit

MOV CL, 2

SHL AL, CL

(ii) Move 2000 H into CS register:

assembly

CopyEdit

MOV AX, 2000H

MOV CS, AX ; Not directly allowed – must be done via far jump
• Needs FAR JMP or indirect method. Direct MOV CS is invalid.

Q.7 Assembly language instructions for:

(1) Divide the content of AX register by 50H

assembly

CopyEdit

MOV BL, 50H

DIV BL ; AL = Quotient, AH = Remainder

(2) Rotate content of BX register left by 4 bits

assembly

CopyEdit

MOV CL, 04H

ROL BX, CL

Q.8 Write content of AL and flags after:

assembly

CopyEdit

MOV AL, 99H

ADD AL, 01H

DAA

Step-by-Step:

• AL = 99H + 01H = 9AH

• After DAA, AL becomes 00H, and Carry Flag is set.

Final:

• AL = 00H

• CF = 1 (Carry generated)

• AF = 1 (Auxiliary carry generated)

Q.9 Instructions:

(i) Shift BX register 3 bit left

assembly
CopyEdit

MOV CL, 03H

SHL BX, CL

(ii) Move 1234H in DS register

assembly

CopyEdit

MOV AX, 1234H

MOV DS, AX

Q.10 LOOP1 Execution:

assembly

CopyEdit

MOV CL, 00H

MOV AL, 00H

LOOP1: ADD AL, 01H

DEC CL

JNZ LOOP1

Answer:

• CL = 00H → JNZ not satisfied → Loop will not execute.

• Final: AL = 00H

Q.11 Execution of DAS (Decimal Adjust after Subtraction):

Syntax:

assembly

CopyEdit

DAS

• Used after subtracting two BCD numbers.

• Example:

assembly

CopyEdit

MOV AL, 45H


SUB AL, 12H

DAS

• Adjusts AL to valid BCD after subtraction.

Q.12 Bit Manipulation Instructions (any 4):

1. BT – Bit Test

2. BTS – Bit Test and Set

3. BTR – Bit Test and Reset

4. BTC – Bit Test and Complement

Q.13 Use of REP in string instructions:

• Used for repeating a string instruction for a defined count (in CX).

• Example:

assembly

CopyEdit

MOV CX, 10

REP MOVSB ; Moves 10 bytes from DS:SI to ES:DI

Q.14 Any three branching instructions:

1. JZ – Jump if Zero

2. JNZ – Jump if Not Zero

3. JC – Jump if Carry

Example:

assembly

CopyEdit

CMP AL, BL

JZ EQUAL

Q.15 Six addressing modes with diagram:

1. Immediate: MOV AX, 1234H

2. Register: MOV AX, BX


3. Direct: MOV AX, [1234H]

4. Register Indirect: MOV AX, [SI]

5. Base + Index: MOV AX, [BX + SI]

6. Base + Index + Displacement: MOV AX, [BX + SI + 10H]

Q.16 Select appropriate instruction:

Operation Instruction

Rotate DX right 2 times ROR DX, 02H

MOV BL, 06H


Multiply AX by 06H
MUL BL

Load 4000H in SP MOV SP, 4000H

MOV AX, BX
Copy BX to CS
MOV CS, AX (via FAR JMP)

Signed Division of BL and AL IDIV BL

Rotate AX right through carry 3 times RCR AX, 03H

Q.17 Difference between TEST and AND:

TEST AND

Only affects flags Affects flags and destination

No data is modified Destination is updated

Usage: Conditional checks Usage: Bit masking

Q.18 Addressing Modes of Instructions:

1. MOV AX, 3456H → Immediate

2. ADD BX, [2000H] → Direct

3. DAA → Implicit

4. MOV AX, [SI] → Register Indirect

5. MOV AX, BX → Register

6. SUB AX, [BX + SI + 80H] → Based Indexed with Displacement


Q.19 Comparing two strings using string instructions:

Instructions:

assembly

CopyEdit

CLD ; Clear Direction Flag

MOV CX, count ; Set string length

REP CMPSB ; Compare byte strings

Explanation:

• DS:SI = source string, ES:DI = target string.

• Flags (ZF) used to determine mismatch.

Q.20 Instructions:

1. MUL BL (after loading 88H in BL)

2. IDIV BL (signed division)

3. MOV AX, 4000H → MOV DS, AX

4. ROL AX, 04H

5. SHR BX, 03H

6. MOV SS, FF00H

Q.21 Role of XCHG instruction:

• Swaps content of two registers/memory.

assembly

CopyEdit

XCHG AX, BX

Q.22 Use of STC and CMC instructions:

• STC: Set Carry Flag

• CMC: Complement Carry Flag

Q.23 Logical Instructions (any 4):

1. AND
2. OR

3. XOR

4. NOT

Q.24 Four string instructions:

1. MOVSB

2. CMPSB

3. LODSB

4. STOSB

Q.25 MOVSB instruction:

assembly

CopyEdit

MOVSB

• Moves byte from DS:SI to ES:DI, auto-increments pointers.

Q.26 Conditional JUMP instructions:

1. JZ – Jump if Zero

2. JNZ – Jump if Not Zero

3. JC – Jump if Carry

4. JNC – Jump if No Carry

You might also like