Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

XXXXX: (Autonomous)

Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
SUMMER – 2024 EXAMINATION
Model Answer – Only for the Use of RAC Assessors

Subject Name:Microprocessors Subject Code: 22415


Important Instructions to examiners: XXXXX
1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme.
2) The model answer and the answer written by candidate may vary but the examiner may try to assess the
understanding level of the candidate.
3) The language errors such as grammatical, spelling errors should not be given more Importance (Not applicable for
subject English and Communication Skills.
4) While assessing figures, examiner may give credit for principal components indicated in the figure. The figures
drawn by candidate and model answer may vary. The examiner may give credit for any equivalent figure drawn.
5) Credits may be given step wise for numerical problems. In some cases, the assumed constant values may vary and
there may be some difference in the candidate’s answers and model answer.
6) In case of some questions credit may be given by judgement on part of examiner of relevant answer based on
candidate’s understanding.
7) For programming language papers, credit may be given to any other program based on equivalent concept.
8) As per the policy decision of Maharashtra State Government, teaching in English/Marathi and Bilingual (English +
Marathi) medium is introduced at first year of AICTE diploma Programme from academic year 2021-2022. Hence if
the students in first year (first and second semesters) write answers in Marathi or bilingual language (English
+Marathi), the Examiner shall consider the same and assess the answer based on matching of concepts with model
answer.

Q. Sub Answer Marking


No. Q. Scheme
N.

1 Attempt any FIVE of the following: 10 M

a) List any four features of 8086. 2M

Ans 1) It has a 16 bit data bus ½ M each


2) 8086 has a 20 bit address lines can access up to.(220=1MBmemory locations).
3) It provides 14 16-bit registers.
AX,BX,CX,DX,CS,SS,DS,ES,BP,SP,SI,DI,IP & FLAG REGISTER.

4) It has multiplexed address and data bus AD0-AD15 and A16 –A19.
5) It can prefetches up to 6 instruction bytes from memory and queues them in order to
speed up instruction execution.
6) Interrupts:-8086 has 256 vectored interrupts.
7) Provides separate instructions for string manipulation.
8) Operating clock frequencies 5MHz, 8MHz, 10MHz.

9) It requires +5V power supply.

Page No: 1 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
10) A 40 pin dual in line package.
b) List any two addressing modes of 8086 with example. 2M

Ans 1. Immediate addressing mode: MOV AX,67D3H 1 M each


2. Register addressing mode MOV AX,CX
3. Direct addressing mode MOV CL,[2000H]

4. Register Indirect addressing mode MOV AX, [BX]


5. Indexed addressing mode MOV AX,[SI]
6. Based Indexed addressing mode: MOV AX, [BX][SI]
7. Register relative addressing mode: MOV AX, [BX+50H]
8. Base Relative Indexed addressing mode: MOV AX, [BX+SI+50H]

c) State the function of assembler. 2M

Ans Assembler: The assembler is used to convert assembly language written by a user or a 2 M for
program into a machine recognizable format explanation

Example - MASM, TASM, NASM, GNU Assembler

d) Define Macro with Syntax. 2M

Ans Macro: A MACRO is group of small instructions that usually performs one task. It is a 1 M for
definition
Reusable section of a software program. A macro can be defined anywhere in a program
1 M for
Using directive MACRO &ENDM. Syntax

Syntax: MACRO-name

MACRO [ARGUMENT 1,……….ARGUMENT N]

-----2

ENDM

e) Describe the model of assembly language programming. 2M

Ans The Following Figure is a model for the 8086. In general, each register has a special 2 M for
function correct
explanation

Page No: 2 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________

In the programming model there are –

4 General Purpose registers(Data Registers)

4 Segment registers

2 Pointer registers

2 Index registers

1 Instruction Pointer register

1 Flag register

f) List four machine control instruction. 2M

Ans STC − Used to set carry flag CF to 1. ½ M for


each
CLC − Used to clear/reset carry flag CF to 0. instruction

CMC − Used to put complement at the state of carry flag CF.

STD − Used to set the direction flag DF to 1.

CLD − Used to clear/reset the direction flag DF to 0

g) State use of DAA instruction in BCD addition. 2M

Ans 1) DAA: Decimal adjust after addition 02 M for


correct
This instruction is used to make sure the result of adding two packed BCD numbers is explanation

Adjusted to be a legal BCD number. The result of the addition must be in AL for DAA to

work correctly. If the lower nibble in AL after an addition is greater than 9 or AF was set

Page No: 3 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
by the addition, then the DAA instruction will add 6 to the lower nibble in AL. If the

result in the upper nibble of AL in now greater than 9 or if the carry flag was set by the

addition or correction, then the DAA instruction will add 60H to AL.

Let AL = 59 BCD, and BL = 35 BCD

ADD AL, BL AL = 8EH; lower nibble > 9, add 06H to AL

DAA AL = 94 BCD, CF = 0

2. Attempt any THREE of the following: 12 M

a) Differentiate between Near and FAR procedure call (any four points). 4M

Ans 01 M for
each point

b) Draw Flag register format of 8086 microprocessor and explain any two 4M
flags.

Page No: 4 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
Ans Diagram -
2 M,

Explanation-
2M

C-Carry Flag : It is set when carry/borrow is generated out of MSB of result. (i.e D7 bit
for 8- bit operation, D15 bit for a 16 bit operation).

P-Parity Flag This flag is set to 1 if the result contains even number of 1’s otherwise it is
reset.

AC-Auxiliary Carry Flag This is set if a carry is generated out of the lower nibble, (i.e.
From D3 to D4 bit)to the higher nibble

Z-Zero Flag This flag is set if the result is zero after performing ALU operations.
Otherwise it is reset.

S-Sign Flag This flag is set if the MSB of the result is equal to 1 after performing ALU
operation, otherwise it is reset.

O-Overflow Flag This flag is set if an overflow occurs, i.e. if the result of a signed
operation is large enough to be accommodated in destination register.

Control Flags T-Trap Flag If this flag is set, the processor enters the single step execution
mode

I-Interrupt Flag it is used to mask (disable) or unmask(enable)the INTR interrupt.

D-Direction flag is used to auto increment or auto decrement string

When set ,string will be auto decremented

When reset, string will be auto incremented


c) Explain any two assembler directives with suitable example. 4M

Ans DB (Defined Byte) – The DB directive is used to declare a BYTE -2-BYTE variable. A 2 M each

Page No: 5 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
BYTE is made up of 8 bits.

Declaration example:

Byte1 DB 10H

Byte2 DB FFH

DW(Defined Word) – The DW directive is used to declare a WORD type variable – A


WORD occupies 16 bits or (2 BYTE).

Declaration examples: Word DW 1234h

SEGMENT - The SEGMENT directive is used to indicate the start of a logical segment.
Preceding the SEGMENT directive is the name you want to give the segment.

Declaration example: The statement CODE SEGMENT indicates to the assembler the
start of a logical segment called CODE. The SEGMENT and ENDS directive are used to
“bracket” a logical segment containing code or data

DUP (Duplicate) - This directive can be used to generate multiple bytes or words with
known as well as un-initialized values.

eg TABLE DW 100 DUP(0) ; Create array of 100 words all contains data 0

EQU (EQUATE) - EQU is used to give a name to some value or symbol. Each time the
assembler finds the given name in the program, it replaces the name with the value or
symbol you equated with that name.

Declaration example:

Data SEGMENT

Num1 EQU 50H

Num2 EQU 66H

Data ENDS

Numeric value 50H and 66H are assigned to Num1 and Num2

ASSUME: Assume directive is used to tell Assembler the name of the logical segment it
should use for the specified segment.

Page No: 6 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
Example:-Assume CS: CODE, DS: DATA

END (End of Program) - The END directive marks the end of an ALP. The statement
after the directive END will be ignored by the assembler.

d) Identify the addressing mode of the following instruction 4M

i) MUL AL,BL ii) MOV DX,0040h

iii) MOV BX,[SI] iv) MOV AX,[BX][SI]

Ans i. MUL AL,BL - register addressing mode 01 M for


each
ii. MOV DX,0040h- Immediate addressing mode addressing
mode
iii. MOV BX,[SI]-index addressing mode

iv. MOV AX,[BX][SI]- Base index addressing mode

3. Attempt any THREE of the following: 12 M

a) Describe the concept of pipelining in 8086. 4M

Ans • In 8086, pipelining is the technique of overlapping instruction fetch and execution 02 M for
mechanism. diagram
• To speed up program execution, the BIU fetches as many as six instruction bytes
ahead of time from memory. The size of instruction prefetching queue in 8086 is 6 02 M for
bytes. explanation
• While executing one instruction other instruction can be fetched. Thus it avoids
the waiting time for execution unit to receive other instruction.
• BIU stores the fetched instructions in a 6 level deep FIFO . The BIU can be
fetching instructions bytes while the EU is decoding an instruction or executing an
instruction which does not require use of the buses.
• When the EU is ready for its next instruction, it simply reads the instruction from
the queue in the BIU.
• This is much faster than sending out an address to the system memory and waiting
for memory to send back the next instruction byte or bytes.
• This improves overall speed of the processor.

Page No: 7 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________

b) Write an ALP for 8086 to multiply two 16 bit signed numbers. 4M

Ans .Data 04 M for


NUM1 DB -12H correct
NUM2 DB -31H program
.Code
START:
MOV AX, @DATA
MOV DS,AX
MOV AL, NUM1
MOV BL, NUM2
IMUL NUM2
MOV AH, 4CH
INT 21H
ENDS
END

c) Write an ALP for 8086 to find largest number from an array of 10 numbers. 4M

Ans DATA SEGMENT 04 M for


ARRAY DB 01H, 02H, 03H, 04H, 05H, 06H, 07H, 08H, 09H, 10H correct
LARGEST DB 00H program
DATA ENDS
CODE SEGMENT
START:
ASSUME CS:CODE,DS:DATA
MOV DX,DATA
MOV DS,DX
MOV CX,09H
MOV SI ,OFFSET
ARRAY MOV AL,[SI]
UP: INC SI
CMP AL,[SI]
JNC NEXT
MOV AL,[SI]
NEXT: DEC CX
JNZ UP
MOV LARGEST,AL
Page No: 8 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
MOV AX,4CH
INT 21H
CODE ENDS
END START

d) Using Macro write an ALP to solve P = X2 + Y2 , where X and Y are 8 bit 4M


Numbers.

Ans .MODEL SMALL 04 M for


PROG MACRO a,b correct
MOV al,a program
MUL al
MOV bl,al
MOV al,b
MUL al
ADD al,bl
ENDM
.DATA
x DB 02H
y DB 03H
p DB DUP()
.CODE
START:
MOV ax,data
MOV ds,ax
PROG x, y
MOV p,al
MOV ah,4Ch
Int 21H
END

4. Attempt any THREE of the following: 12 M

a) Draw functional block diagram of 8086 microprocessor. 4M

Page No: 9 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
Ans 04 M for
correct
diagram

b) Write an ALP to sort 10 numbers in an array in descending order. 4M

Ans DATA SEGMENT 04 M for


ARRAY DB 15H,05H,08H,78H,56H correct
DATA ENDS program
CODE SEGMENT
START:ASSUME CS:CODE,DS:DATA
MOV DX,DATA
MOV DS,DX
MOV BL,05H
STEP1: MOV SI,OFFSET ARRAY
MOV CL,04H
STEP: MOV AL,[SI]
CMP AL,[SI+1]
JNC DOWN
XCHG AL,[SI+1]
XCHG AL,[SI]
DOWN:ADD SI,1
LOOP STEP
DEC BL
Page No: 10 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
JNZ STEP1
MOV AH,4CH
INT 21H
CODE ENDS
END START

c) Write an ALP to check given 16 bit number is odd or even. 4M

Ans .model small 04 M for


.data correct
num dw 1232H program
odd dw 0
even dw 0
.code
entrypoint:
mov ax,@data
mov ds,ax
mov ax,num
ror ax,1
jnc dn
rol ax,1
mov odd,ax
jmp exit
dn: rol ax,1
mov even,ax
exit:ends
end
d) Write an ALP using procedure for performing the operation 4M

Z =(A + B) * (C + D)

Ans Procedure For Addition 04 M for


SUM PROC NEAR correct
ADD AL,BL program
RET
SUM ENDP
DATA SEGMENT
NUM1 DB 10H
NUM2 DB 20H
NUM3 DB 30H
NUM4 DB 40H
RESULT DB?
DATA ENDS
CODE SEGMENT
ASSUME CS: CODE,DS:DATA
START:MOV AX,DATA
MOV DS,AX
MOV AL,NUM1
MOV BL,NUM2
CALL SUM
Page No: 11 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
MOV CL,AL
MOV AL, NUM3
MOV BL,NUM4
CALL SUM
MUL CL
MOV RESULT,AX
MOV AH,4CH
INT 21H
CODE ENDS
END

e) Explain re-entrant and recursive procedure with schematic diagram.

Ans 1)Recursive procedure: A recursive procedure is procedure which calls itself. This 02 M for
results in the procedure call to be generated from within the procedures again and again. each
The recursive procedures keep on executing until the termination condition is reached. procedure
The recursive procedures are very effective to use and to implement but they take a large
amount of stack space and the linking of the procedure within the procedure takes more
time as well as puts extra load on the processor.

2) Re-entrant procedures: In some situation it may happen that Procedure 1 is called


from main program Procrdure2 is called from procedure1 and procedure1 is again called
from procdure2. In this situation program execution flow re-enters in the procedure1.
These types of procedures are called re-entrant procedures. A procedure is said to be re-
entrant, if it can be interrupted, used and re-entered without losing or writing over
anything.

Page No: 12 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________

5. Attempt any TWO of the following: 12 M

a) Write the physical address generation process in 8086. Calculate the physical 6M
address for given -

(i) DS-73A2 Η SI-3216 H

(ii) CS-7370 Η IP=561EH

Ans Formation of a physical address: - Segment registers carry 16-bit data, which is also Physical
known as base address. BIU attaches 0 as LSB of the base address. So now this address address
becomes 20- bit address. Any base/pointer or index register carry 16 bits offset. Offset generation
address is added into 20-bit base address which finally forms 20-bit physical address of 04M
memory location.
Each
example 01
M

Given

1. DS = 73A2 H and SI = 3216 H


Appending 4 zeros to the DS register

Physical Address = 73A20 + 3216 = 76C36 H

2. CS = 7370 H and IP = 561E H

Appending 4 zeros to the CS register

Physical Address = 73700 + 561E = 78D1E H

b) Demonstrate in detail the program development steps in assembly language 6M


programming.

Ans Program Development Steps: Listing of


steps - 2 M
Major steps in developing an assembly language program.

• Defining the Problem


Explanation
Page No: 13 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
• Representing program operations of each step
• Finding the right instructions - 1M
• Writing a program

1. Defining the problems

• Find out the problem.


For example: Sensing temperature, detecting fire, detecting smock, decoder-encoder,
Intelligent machine controller etc.

2. Representing program operations

• Formula or sequence of operations used to solve a programming problem is called as the


algorithm.
• There are two ways of representing algorithms:
-
Flowchart
Structured programming and pseudo code

3. Finding the right instructions

• Instructions in 8086 are mainly divided into following categories


• Data Transfer Instructions
• Arithmetic Instruction
• Bit manipulation Instruction
• String Instruction
• Program execution transfer Instruction
• Processor control Instruction

4. Writing a program

• We need to do the following steps to write the program effectively:


-
INITIALIZATION INSTRUCTIONS: used to initialize various parts of the program like
segment registers, flags and programmable port devices.
-
STANDARD PROGRAM FORMAT: it’s a tabular format containing ADDRESS, DATA
OR CODE, LABELS, MNEM, OPERAND(S) and COMMENTS as the columns.
c) Write assembly language instructions of 8086 microprocessor to - 6M

(i) Add 100 H to contents of AX register.

(ii) Rotate the contents of AX towards left by 2 bits.

(iii) Signed division of AX by BL.

Ans 1. MOV AX, 100H moves the value 100H into the AX register. Each Sub
question –
ADD AX, 100H adds the value 100H to the contents of the AX register. 2M

Page No: 14 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
After executing these instructions, the AX register will contain the result of the
addition.

2. MOV CL, 2 moves the value 2 into the CL register, specifying that we want to
rotate the contents of AX by 2 bits.

ROL AX, CL rotates the contents of the AX register leftwards by the number of
bits specified in CL.

After executing these instructions, the contents of the AX register will be rotated
leftwards by 2 bits.

3. MOV BL, divisor ; Load the divisor value into the BL register.

IDIV BL ; Perform signed division of AX by BL

6. Attempt any TWO of the following: 12 M

a) Write the content of register BX after execution of instructions, 6M

MOV BX, 2050 H

MOV CL, 05 Η

SHL BX, CL

Ans Let's break down the instructions and determine the content of register BX after executing Each Sub
them: question -
2M

1. `MOV BX, 2050H`: This instruction moves the value 2050H (which is 0000 0010 0000
0100 in binary) into the BX register.

2. `MOV CL, 05H`: This instruction moves the value 05H (which is 0000 0101 in binary)
into the CL register.

3. `SHL BX, CL`: This instruction shifts the contents of the BX register to the left by the
number of bits specified in the CL register. In this case, CL contains 5, so the contents of
BX will be shifted left by 5 bits.

After shifting left by 5 bits:


- The two leftmost bits (which are 00) will be shifted out and discarded.

Page No: 15 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
- The rightmost 16 - 5 = 11 bits will be filled with zeros.

So, after executing these instructions, the content of register BX will be: 0000 0000 0000
0000, which is equivalent to 0H in hexadecimal.

b) Illustrate the use of any three branching instructions. 6M

Ans Three branching instructions commonly used in assembly language programming for the Each
8086 microprocessors, along with their purposes and examples: instruction-
2M

1. **JMP (Jump)**:
- Purpose: JMP allows unconditional branching to a specified memory address.
- Example:
JMP target_label
...

target_label:
; Instructions to execute after the jump.
- Explanation: This instruction unconditionally transfers control to the memory
location specified by the target label. It's commonly used for implementing loops,
switching between different sections of code, or implementing unconditional jumps in the
program flow.

2. **JE (Jump if Equal)**:


- Purpose: JE jumps to a specified memory address if the Zero Flag (ZF) is set,
indicating that the result of the previous operation was equal.
- Example:
CMP AX, BX ; Compare AX and BX
JE equal_label ; Jump if AX and BX are equal.
```
- Explanation: If the comparison of AX and BX yields equality, the Zero Flag (ZF) is
set. JE then jumps to the specified label. It's commonly used in conditional statements to
implement branching based on equality conditions.

Page No: 16 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
3. **JG (Jump if Greater)**:
- Purpose: JG jumps to a specified memory address if the Sign Flag (SF) is equal to the
Overflow Flag (OF) and the Zero Flag (ZF) is not set.
- Example:
CMP AX, BX ; Compare AX and BX
JG greater_label ; Jump if AX > BX
- Explanation: If AX is greater than BX, the Jump if Greater (JG) instruction will jump
to the specified label. This instruction is typically used in conditional statements to
implement branching based on comparison results.

These instructions are fundamental for controlling program flow in assembly language
programming on the 8086 microprocessors, allowing for conditional and unconditional
branching based on specific conditions or requirements.

c) Write an ALP to add the series of 5 numbers. 6M

Ans ALP to add the series of 5 numbers. Logic – 2 M


MODEL SMALL Instructions
.DATA -2M
NUM1 DB 10H,20H,30H,40H,50H
RESULT DB 00H Program
CARRY DB 00H Flow - 2 M
ENDS
.CODE
START: MOV AX,@DATA
MOV DS, AX
MOV CL,05H
MOV SI, OFFSET NUM1
UP:MOV AL,[SI]
ADD RESULT, AL
JNC NEXT
INC CARRY
NEXT: INC SI
LOOP UP
MOV AH,4CH
INT 21H
ENDS
END START

Page No: 17 | 18
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________

Page No: 18 | 18

You might also like