0% found this document useful (0 votes)
77 views5 pages

8086 Detailed Answers

The document provides detailed instructions and explanations for various operations using the 8086 microprocessor, including initializing the stack, rotating registers, string operations, and the functions of CALL and RET instructions. It also covers specific assembly language instructions for arithmetic operations, shifting, and moving data into registers. Additionally, it explains the effects of certain instructions on register values and flags.
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)
77 views5 pages

8086 Detailed Answers

The document provides detailed instructions and explanations for various operations using the 8086 microprocessor, including initializing the stack, rotating registers, string operations, and the functions of CALL and RET instructions. It also covers specific assembly language instructions for arithmetic operations, shifting, and moving data into registers. Additionally, it explains the effects of certain instructions on register values and flags.
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

ALL INDIA SHRI SHIVAJI MEMORIAL SOCIETYS POLYTECHNIC PUNE

Department of Computer Engineering

8086 MICROPROCESSOR DETAILED ANSWERS

Q.1. Write appropriate instructions to perform the following operations:

(a) Initialize stack at 42000H:

To initialize the stack segment at address 42000H, we divide the address into segment:offset form.

The segment part can be taken as 4200H, assuming offset as 0000H.

Instructions:

MOV AX, 4200H

MOV SS, AX

MOV SP, 0000H

Explanation:

- AX is loaded with 4200H.

- SS (Stack Segment) is initialized with AX.

- SP (Stack Pointer) is initialized to 0000H to point to the beginning of the stack.

(b) Rotate register BX right 4 times:

To rotate BX right by 4 bits, we use the ROR (Rotate Right) instruction in a loop.

MOV CL, 04H

ROR BX, CL

Explanation:
- CL holds the number of bit positions to rotate.

- ROR (Rotate Right) instruction rotates the bits of BX towards the right through the Carry flag.

Q.2. Describe any two string operation instructions with their functions and syntax.

1. MOVSB (Move String Byte):

- Function: Moves a byte from the string location pointed to by DS:SI to ES:DI.

- Syntax: MOVSB

- Operation: [ES:DI] [DS:SI]; then SI and DI are updated based on DF (Direction Flag).

2. CMPSB (Compare String Byte):

- Function: Compares bytes in source and destination strings.

- Syntax: CMPSB

- Operation: Compares [DS:SI] with [ES:DI] and updates flags accordingly.

Q.3. What are the functions of CALL and RET instructions? Write syntax of CALL and RET.

CALL:

- Function: CALL is used to transfer program control to a procedure.

- Syntax: CALL procedure_name

- Operation: It pushes the address of the next instruction on the stack and jumps to the procedure.

RET:

- Function: RET is used to return control from a procedure to the calling program.

- Syntax: RET

- Operation: It pops the return address from the stack and transfers control back.
Q.4. What will be content of register BX and CF flag after the execution of instructions?

MOV BX, 050H

MOV CL, 05H

SHL BX, CL

Execution:

- BX = 0050H = 0000 0000 0101 0000

- SHL BX, 05H shifts bits left 5 times.

After shifting:

0000 0000 0101 0000 << 5 = 1010 0000 0000 = 0xA000

Result:

- BX = A000H

- CF = Last bit shifted out = 0 (Since the bit in position 11 was 0)

Q.5. Explain the following instructions of 8086.

(i) DAA (Decimal Adjust after Addition):

- Used to adjust the result of addition operation to valid BCD (Binary Coded Decimal) number.

- Syntax: DAA

- Example:

MOV AL, 99H

ADD AL, 01H

DAA

Result: AL = 00H with Carry

(ii) XLAT (Translate byte to AL using table):


- Uses the value in AL as an index to a lookup table at DS:BX.

- Syntax: XLAT

- Operation: AL [BX + AL]

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

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

SHL AL, 1

SHL AL, 1

(ii) Move 2000H into CS register:

This is not directly possible. You must use a FAR JMP or segment manipulation with stack.

Alternative:

MOV AX, 2000H

PUSH AX

MOV AX, OFFSET label

PUSH AX

RETF

label:

Q.7. Write assembly language instructions of 8086 microprocessor to:

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

MOV BL, 50H

DIV BL

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


MOV CL, 04H

ROL BX, CL

Q.8. Write the content of AL register and status of carry and auxiliary carry flag after execution:

MOV AL, 99H

ADD AL, 01H

DAA

Step-by-step:

- AL = 99H

- ADD 01H AL = 9AH

- DAA adjusts AL to valid BCD AL = 00H, CF = 1, AF = 1

Q.9. Write an instruction of 8086 to perform following operations.

(i) Shift BX register 3 bits toward left:

MOV CL, 03H

SHL BX, CL

(ii) Move 1234H into DS register:

MOV AX, 1234H

MOV DS, AX

(Continued...)

You might also like