MIC Paper Solution S22-22415
MIC Paper Solution S22-22415
MIC Paper Solution S22-22415
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
SUMMER – 2022 EXAMINATION
Subject Name: Microprocessor Model Answer 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.
An Correct
s diagram: 2
marks
Page No: 1 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
b) State any two difference between TEST and AND instructions. 2M
An Editor: The editor is a program which allows the user to enter and modify as well as 1 mark for each
s store a group of instructions or text under a file name. function
Assembler: The assembler is used to convert assembly language written by a user or a
program into a machine recognizable format.
Page No: 2 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
An .model small Correct
s .data program :2M
a db 06h
b db 12h
cends
.code
start:
mov ax,@data
mov ds,ax
mov al,a
mov bl,b
add al,bl
int 3
ends
end start
An An instruction in which 8 bit or 16 bit operand (data) is specified in instruction itself Definition :1M
s then the addressing mode of such instruction is called as immediate addressing mode.
Example:1M
Eg.
MOV AX,7120H
An The DAA (Decimal Adjust after Addition) instruction makes the result in Packed BCD Explanation
s from after BCD addition is performed. It works only on AL register. :2M
Page No: 3 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
An 1. DB – The DB directive is used to declare a BYTE type variable – A BYTE is Each assembler
s made up of 8 bits. directive 1
mark
Declaration examples:
Num1 DB 10h
Page No: 4 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
Num2 DB 37H
2. DW – The DW directive is used to declare a WORD type variable – A WORD
occupies 16 bits or (2 BYTE).
Declaration examples:
TEMP DW 1234h
3. DD – The DD directive is used to declare a double word which is made up of
32 bits =2 Word’s or 4 BYTE.
Declaration examples:
Dword1 DW 12345678h
4. EQU - This is used to declare symbols to which some constant value is
assigned Each time the assembler finds the given names in the program, it will
replace the name with the value or a symbol. The value can be in the range 0
through 65535 and it can be another Equate declared anywhere above or
below.
.Num EQU 100
5. SEGMENT: It is used to indicate the start of a logical segment. It is the name
given to the segment. Example: the code segment is used to indicate to the
assembler the start of logical segment.
6. PROC: (PROCEDURE) It is used to identify the start of a procedure. It follows
a name we give the procedure
After the procedure the term NEAR and FAR is used to specify the procedure
Example: SMART-DIVIDE PROC FAR identifies the start of procedure
named SMART-DIVIDE and tells the assembler that the procedure is far.
An DAS: Decimal Adjust after Subtraction: - This instruction converts the result of the Description 2
s subtraction operation of 2 packed BCD numbers to a valid BCD number. The marks
subtraction operation has to be only in the AL. If the lower nibble of AL is higher than
the value 9, this instruction will subtract 06 from the lower nibble of the AL. If the Example 2
output of the subtraction operation sets the carry flag or if the upper nibble is higher marks
than value 9, it subtracts 60H from the AL. This instruction modifies the CF, AF, PF,
SF, and ZF flags. The OF is not defined after DAS instruction. The instance is
following:
Example:
Page No: 5 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
An Diagram:2M
s
Explanation:2
M
The number of address lines in 8086 is 20, 8086 BIU will send 20bit address,
so as to access one of the 1MB memory locations.
The four segment registers actually contain the upper 16 bits of the starting
addresses of the four memory segments of 64 KB each with which the 8086 is
working at that instant of time
A segment is a logical unit of memory that may be up to 64 kilobytes. Starting
address will always be changing. It will not be fixed.
Note that the 8086 does not work the whole 1MB memory at any given time.
However, it works only with four 64KB segments within the whole 1MB memory.
Page No: 6 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
An .model small Program
s Code:4M
.data
A db 2222h
B db 1111h
Ends
.code
Mov ax,@data
Mov ds,ax
Mov AX,a
Mov BX,b
IMul BX
Int 03h
Ends
End
BLK DB 10h,40h,30h,60h
e db ?h
o db ?h
ends
.code
mov ax, @data
mov ds, ax
lea si, BLK
mov bl, 00h
mov bh, 00h
mov cl, 04h
up: mov al, [si]
ror al, 1
jc go
inc bl
jmp next
go: inc bh
next: inc si
dec cl
jnz up
mov e,bl
mov o,bh
int 3
ends
end
Page No: 7 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
d) Write a MACRO to perform 32 bit by 16 bit division of unsigned 4M
numbers
An .model small Program
s Code:4M
Div1 macro no1,no2
mov ax,no1
div no2
endm
.data
num1 dw 12346666h
num2 dw 2222h
.code
mov ax,@data
mov ds,ax
div1 num1,num2
ends
end
An Formation of a physical address:- Segment registers carry 16 bit data, which is also Describition:2
s known as base address. BIU attaches 0 as LSB of the base address. So now this M
address becomes 20-bit address. Any base/pointer or index register carry 16 bit offset.
Offset address is added into 20-bit base address which finally forms 20 bit physical Example:2M
address of memory location.
Page No: 8 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
Example
Assume DS= 2632H, SI=4567H
----------------------------
2A887H
Array db 02h,04h,06h,01h,05h
Ends
.code
Mov ds,ax
Mov cl,04h
Lea si,array
Mov al,[si]
Up : inc si
Page No: 9 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
Cmp al,[si]
Jnc next
Mov al,[si]
Next : dec cl
Jnz up
Int 03h
Ends
End start
START:
MOV AX,@DATA
MOV DS,AX
ENDS
Page No: 10 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
END ; end of program.
num1 db 13h
num2 db 12h
ends
.code
start:
mov ax,@data
mov ds,ax
call sub1
mov al,num1
mov bl,num2
sub al,bl
das
sub1 endp
mov ah,4ch
int 21h
ends
end start
end
Page No: 11 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
A recursive procedure is procedure which calls itself. This results in the procedure Re-entrant
call to be generated from within the procedures again and again. procedures:2M
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 procedure1And 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.
Page No: 12 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
a) (a) Calculate the physical address if: 6M
(i) CS 1200H and IP = DE00OH
(ii) SS = FFOOH and SP = 0123H
(iii) DS 1IFOOH and BX= IA00H for MOV AX, [BX]
An Physical address = segment address x 10H + offset address Each correct
s answer 2
(i) Physical address = CS X 10H + IP mark’s
= 1200H X 10H + DE00H
= 12000H + DE00H
= 1FE00H
(ii) Physical address = SS X 10H + SP
= FF00H X 10H + 0123H
= FF000H + 0123H
= FF123H
Assembler:
Linker:
It is a programming tool used to convert Object code (.OBJ) into executable (.EXE)
program. It combines, if requested, more than one separated assembled modules into
one executable module such as two or more assembly programs or an assembly
language with C program.
Page No: 13 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
Debugger:
Debugger is a program that allows the execution of program in single step mode
under the control
of the user. The errors in program can be located and corrected using a debugger.
Debugger generates .exe file.
a) Describe how string instructions are used to compare two strings with 6M
suitable example.
It compares a byte or word in one string with a byte or word in another string. SI holds
the offset of source and DI holds offset of destination strings. CX contains counter and
DF=0 or 1 to auto increment or auto decrement pointer after comparing one byte/word.
e.g.
Page No: 14 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
CMPS m8, m8 Compares byte at address DS: SI with
byte at
Page No: 15 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
ROL AX, CL
SHR BX, CL
MOV SS, AX
STR2 DB "world$"
DATA ENDS
CODE SEGMENT
MOV DS, AX
CMP AL,’$’
JE EXIT
INC SI
JMP NEXT
JE EXIT1
Page No: 16 | 17
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
(Autonomous)
(ISO/IEC - 27001 - 2013 Certified)
__________________________________________________________________________________________________
MOV [SI], AL
INC SI
INC DI
JMP UP
MOV [SI], AL
INT 21H
CODE ENDS
END START
Page No: 17 | 17