MIC EPA Notes
MIC EPA Notes
Microprocessor(22415) S.Y.Diploma:Sem 4
1(e) 2
3 (b) 4 3(b) 4 3(b) 4
3(c) 4 3(c) 4 3(d) 4
4 Assembly Language 4.(b) 4 4.(b) 4 1(e) 2
Programming 4.(d) 4 4.(c) 4 4.(b) 4
5.(c) 6 6.(c) 6 4.(c) 4
6.(c) 6
Total 22 Total 24 Total 24
1 (d 2 1© 2
1 (g) 2 2(a) 4 2(a) 4
5 Procedure and Macro 4.(a) 4 3(d) 4 3© 4
6.(c) 6 4.(d) 4 4.(d) 4
4.(e) 4 4.(e) 4
Total 12 Total 18 Total 18
Winter- Unit 1 Q.1 a State the functions of the following pins of 8086 microprocessor: 2
2024 (i) MN/MX (ii) READY 4
Q.2 b Explain concept pipelining in 8086. State the advantages of pipelining. (Any Two)
Q. 2 D Describe memory segmentation in 8086 and list its advantages. (Any Two).
4
Q Draw functional block diagram of 8086 microprocessor 4
Summer- Unit 1 Q.1 a List any four features of 8086 2
2024 Q.1 e Describe the model of assembly language programming. 2
Q.2 b Draw Flag register format of 8086 microprocessor and explain any two flag 4
Q.3a Describe the concept of pipelining in 8086.
Q.4 a Draw functional block diagram of 8086 microprocessor
4
Q.5 a Write the physical address generation process in 8086. 6
Calculate the physical address for given - (i) DS-73A2 Η SI-3216 H (ii) CS-7370 Η IP=561EH
Winter- Unit 1 Q.1 a State the use of MN/ MX and Test signal. 2
2023 Q.1 e Give any two advantages of pipelining in 8086. 2
Q.1 f Draw the format of flag register of 8O86 2
Q.2 C Write the function of following pins of 8086: 4
Winter- Unit 1 Q.1 a State the function of the following pins of 8086 microprocessor. (i) ALE (ii) DT/𝐑̅ 2
2022 Q.2 b what is memory segmentation? Explain it with reference to 8086 microprocessor 4
Q.3 aDescribe register organization of 8086 microprocessor 4
Q4 a Draw functional block diagram of 8086 microprocessor 4
.
6
Q5 a Define logical and effective address. Describe physical address generation process in 8086
microprocessor. Calculate physical address by taking suitable DS, CS and IP.
Winter- Unit 2 Q. 1c List assembly language programming tools 2
Q. 2C Explain assembly language program development steps..
2024 4
Summer- Unit 2 Q .1 c State the function of assembler. 2
2024 Q.2C Explain any two assembler directives with suitable example 4
Q.5 b Demonstrate in detail the program development steps in assembly language programming
6
Summer- Unit 2 1 c.List the program development steps for assembly language programming 2
2 c State the Assembler Directives used in 8086 and describe the function of any two
2023 4
Assembler directives: 1) DW 2) EQU 3) ASSUME 4) OFFSET 5) SEGMENT 6) EVEN
Winter- Unit 2 4
2022 2(c) Describe following assembler directives: (i) DB (i) EQU (ii) Segment (iv) Assume 6
Q5 b State the function of following assembly language programing tools
i) Assembler (ii) Linker (iii) Debugger
Winter- Unit 3 Q.1b What is role of XCHG instruction in assembly language program? 2
Q.1e Write algorithm to add two 8 bit BCD number
2024 Q1 g State the use of REP in string related instruction. W-24
2
Q. 2d What are the functions of CALL and RET instruction? Write syntax of CALL and RET 2
4
Summer- Unit 3 Q1 f List four machine control instruction 2
Q.1 g State use of DAA instruction in BCD addition.
2024 Q.2 d Indentify the addressing mode of the following instruction
2
i) MUL AL,BL ii) MOV DX,0040h iii) MOV BX,[SI] iv) MOV AX,[BX][SI] 4
Q.5C Write assembly language instructions of 8086 microprocessor to - (i) Add 100 H to contents of AX register. 4
(ii) Rotate the contents of AX towards left by 2 bits. (iii) Signed division of AX by BL.
Q.6 a Write the content of register BX after execution of instructions, MOV BX, 2050 H MOV CL, 05 Η SHL BX,
CL
Q.6 b Illustrate the use of any three branching instructions
Winter- Unit 3 Q.1 C Write any four-bit manipulation instructions of 8086. 2
2023 Q 1 d What is the use of AAM instruction with suitable example? 2
Q.2 a Describe the function of the following instructions: (i) DAA (ii) CMP (iii) ADC (iv) JNC
Q 3d Describe CALL and RET instructions with example.
4
Q4 e Explain any four addressing modes of 8086 4
4
6
Summer- Unit 3 Q1 b State the function of STC and CMC Instruction of 8086 2
2023 Q1 f State two examples of each, Immediate and based indexed Addressing modes. 2
Q6 a 6
Write an appropriate 8086 instruction to perform following operation :
(i) Rotate thc contents of BX Register towards right by 4 bits.
(ii) Rotate the contents of AX towards left by 2 bits.
(iii) Add 100 H to the contents of AX Register.
(iv) Transfer 1234 H to DX Register.
(v) Multiply AL by 08 H.
(vi) Signed division of BL and AL.
Q6 b Explain Addressing modes of 8086 with süitable example.
(i) MN/MX
(ii) READ
i) MN/MX:
When MN/MX pin is high, it operates in MIN mode and when low, 8086 operates in MAX
mode. For a small system in which only one 8086 microprocessor is employed as a CPU,
the system operates in MIN mode (Uniprocessor). While if more than one 8086 operate in
a system then it is said to operate in MAX mode (Multiprocessor).
ii) Ready: UNIT 1 8086 16-BIT MICROPROCESSOR
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.
(i) Ready: - This is an acknowledgment signal from the slower I/O devices or memory. When high, it indicates that the device is ready
to transfer data, else the microprocessor is in the wait state.
(ii) ALE:- Address Latch Enable. ALE is provided by the microprocessor to latch the address into the 8282 or 8283 address latch. It is an
active high (1) pulse during T1 of any bus cycle. ALE signal is never floated, is always integer. –
(iii) TEST’ :This is an acknowledgment signal from the slower I/O devices or memory. When high, it indicates that the device is ready to
transfer data, else the microprocessor is in the wait state.
(iv) DEN : Data enable. This pin is provided as an output enable for the 8286/8287 in a minimum system which uses transceiver. DEN is
active low (0) during each memory and input-output access and for INTA cycles.
Q. Draw and explain model of Assembly Language Programming : (W-23) 4 Marks
Q. Describe memory segmentation in 8086 and list its advantages W-23 ,S-23,W-22 W-24
Segmentation is the process in which the main memory of the computer is logically
divided into different segments and each segment has its own base address. It is basically
used to enhance the speed of execution of the computer system, so that the processor is
able to fetch and execute the data from the memory easily and fast.
Need for Segmentation –
The Bus Interface Unit (BIU) contains four 16 bit special purpose registers (mentioned
below) called as Segment Registers.
Effective Address or Offset Address: The offset for a memory operand is called the operand's effective address or EA. It is an unassigned 16 bit
number that expresses the operand's distance in bytes from the beginning of the segment in which it resides. In 8086 we have base registers
and index registers.
Generation of 20 bit physical address in 8086:-
1. Segment registers carry 16 bit data, which is also known as base address.
2. BIU appends four 0 bits to LSB of the base address. This address becomes 20-bit address.
3. Any base/pointer or index register carries 16 bit offset.
4. Offset address is added into 20-bit base address which finally forms 20 bit physical address of memory location
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 of data
DUP (Duplicate) - The DUP directive tells the assembler to duplicate an expression a given number of times.
Declaration example: 4 DUP(2) is equivalent to 2, 2, 2, 2.
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
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.
(ii) Linker - A linker is a program that combines object file created by the assembler with other object files and link libraries and
produces a single executable program
Example - TLINK for TASM, LINK.EXE and LINK32.EXE for MASM
(iii) Debugger - A debugger is a program that allows you to trace the execution of a program and examine the content of registers and
memory
Example - Turbo Debugger for TASM, CodeView for MASM
Q.List the program development steps for assembly language programming. S-23 2 Marks S-24 4M
1. Defining the problem
2. Algorithm
3. Flowchart
4. Initialization checklist
5. Choosing instructions
6. Converting algorithms to assembly language program
Assembler directives:
1) DW
2) EQU
3) ASSUME
4) OFFSET
5) SEGMENT
6) EVEN
Function of any two:
1) DW (DEFINE WORD):
The DW directive is used to tell the assembler to define a variable of type word or to
reserve storage locations of type word in memory. The statement MULTIPLIER DW
437AH, for example, declares a variable of type word named MULTIPLIER, and
initialized with the value 437AH when the program is loaded into memory to be run.
2) 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.
Example:
Data SEGMENT
Num1 EQU 50H
Num2 EQU 66H
1. MOV AX, 100H moves the value 100H into the AX register. ADD AX, 100H adds the value 100H to the contents of the AX register
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
Let's break down the instructions and determine the content of register BX after executing
them:
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.
- 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
Q. Write any four-bit manipulation instructions of 8086 w-23 2 Marks
This instruction is used to make sure the result of adding two packed BCD numbers is 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 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
Let AL = 88 BCD, and BL = 49 BCD
ADD AL, BL AL = D1H; AF = 1, add 06H to AL
DAA AL = D7H; upper nibble > 9, add 60H to AL
AL = 37 BCD, CF = 1
2) CMP: Compare
This instruction compares the source operand, which may be a register or an immediate
data or a memory location, with a destination operand that may be a register or a memory
location.
Example: -
CMP BX, 0100H
CMP AX, 0100H
CMP [5000H], 0100H
CMP BX, [SI]
Ans.
(i) MUL AL, 05H
(ii) MOV DS, 1234H
(iii) ADD AX, BX
(iv) IDIV BL
(v) ROL AX, 4
(vi) MOV SP, FF00H
Q. Explain with example any three Shift and any three Rotate instructions. [W’23] 6marks
Ans.
Shift instructions are SHL, SHR, and SAR
SHL – SHL stands for shift logic left.
This instruction LEFT-Shifts the bits of destination.
MSB shifted into the CARRY. LSB gets a 0.
Bits are shifted 'count' number of times.
If count = 1, it is directly specified in the instruction.
If count > 1. it has to be given in CL Register.
Destination: Register, Memory Location.
Example : SHL BL, 1
It suggests that left-shift BL bits once
Assume that,
Before operation,
BL = 00110011 and CF = 1
After Operation,
ROL- This instruction stands for Rotate Left without carry flag. The contents of the operand (register or memory location) are rotated left bit-
wise by some number of positions depending on the count value.
The below shows the operation ROL instruction with count value 2.
ROR- This instruction stands for Rotate Right without carry flag. The contents of the operand are rotated right bit-wise by some number of
positions depending on the count value.
The ROR instruction rotates the bits towards the right side. Since this instruction rotates the bits right, the least significant bit (LSB) is moved
into the carry flag (CF) as well as into the most significant bit (MSB) position.
The below shows the operation ROR instruction with count value 2.
During the rotation the least significant bit (LSB) is moved to carry flag, and the carry flag is moved into the most significant bit (MSB).
The below shows the operation RCR instruction with count value 2.
1. JZ/JE Label
Transfer execution control to address ‘Label’, if ZF=1.
2. JNZ/JNE Label
Transfer execution control to address ‘Label’, if ZF=0
3. JS Label
Transfer execution control to address ‘Label’, if SF=1.
4. JNS Label
Transfer execution control to address ‘Label’, if SF=0.
5. JO Label
Transfer execution control to address ‘Label’, if OF=1.
6. JNO Label
Transfer execution control to address ‘Label’, if OF=0.
7. JNP Label
Transfer execution control to address ‘Label’, if PF=0.
8. JP Label
Transfer execution control to address ‘Label’, if PF=1.
9. JB Label
Transfer execution control to address ‘Label’, if CF=1.
Q.State two examples of each, Immediate and based indexed Addressing modes. S-23 2M
Q Write an assembly language instruction of 8086 microprocessor to i) Divide the content of AX register by 50H. ii) Rotate the
content of BX register by 4-bit towards left W-22 2M
DATA SEGMENT
ARRAY DB 01H, 02H, 03H, 04H, 05H, 06H, 07H, 08H, 09H, 10H
LARGEST DB 00H
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
MOV AX,4CH
INT 21H
CODE ENDS
END START
Q Using Macro write an ALP to solve P = X2 + Y2 , where X and Y are 8 bit Numbers. S-24 4M
.MODEL SMALL
PROG MACRO a,b
MOV al,a
DATA SEGMENT
ARRAY DB 15H,05H,08H,78H,56H
DATA ENDS
CODE SEGMENT
START:ASSUME CS:CODE,DS:DATA
MOV DX,DATA
MOV DS,DX
MOV BL,05H
STEP1: MOV SI,OFFSET ARRAY
.model small
.data
num dw 1232H
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
CODE SEGMENT
START:
ASSUME CS: CODE, DS : DATA
MOV DX, DATA
MOV DS,DX
LEA SI, STRG
MOV CL,00H
MOV AL,'$'
NEXT: CMP AL,[SI]
JZ EXIT
ADD CL,01H
INC SI
JMP NEXT
EXIT: MOV LEN,CL
MOV AH,4CH
INT 21H
CODE ENDS
DATA SEGMENT
BYTE DB 9BH
NONE DB?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX, DATA
MOV DS,AX
MOV AL, BYTE
MOV BL,00H
MOV CL,08H
UP: ROL AL, 1
JNC DN
INC BL
DN: DEC CL
JNZ UP
MOV NONE.BL
INT 3
CODE ENDS
END START
Q. Write an ALP for concatenation of two strings. Draw flow chart and assume suitable data. [W’23] 4Marks
Ans.
ALP –
DATA SEGMENT
STR1 DB "hello$"
STR2 DB "world$"
DATA ENDS
CODE SEGMENT
START: ASSUME CS: CODE, DS:DATA
MOV AX,@ DATA
MOV DS, AX
NXT:
INC SI
LOOP UP
MOV LARGEST_NUMBER, BL
Q. Write an ALP to transfer 10 bytes of data from one memory location to another, also draw the flow chart of the same.
Ans S-23 6 marks
Flowchart -
Q. Write an assembly language program to Count No. of 1 's in a 16-bit number.S-23 4 marks
Ans.
DATA SEGMENT
WORD DW 889BH
NONE DW?
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
START: MOV AX, DATA
MOV DS, AX
MOV BX, WORD
MOV DX, 0000H
MOV CL, 10H
UP: ROL BX, 1
JNC DN
INC DX
DN: DEC CL
JNZ UP
MOV CX, DX
Q. Draw flow chart and write assembly language program to reverse the word in string.
Ans.
Program:
DATA SEGMENT
STRB DB 'GOOD MORNING$'
REV DB 0FH DUP(?)
DATA ENDS
CODE SEGMENT
START:ASSUME CS:CODE,DS:DATA
MOV DX,DATA
MOV DS,DX
MODEL SMALL
.DATA
NUM1 DB 86H
Procedure: A procedure is group of instructions that usually performs one task. It is a reusable section of a software program which is stored in memory once
but can be used as often as necessary. A procedure can be of two types. 1) Near Procedure 2) Far Procedure Syntax :-
Procedure can be defined as
Procedure_name PROC
Procedure_name
ENDP
For Example
Addition PROC near
Addition END
Q. Differentiate between Procedure and Macro [W’23]
Ans.
Procedure Macro
Procedures are used for large group of instructions to be repeated Macros are used for small group of instructions to be repeated.
Object code is generated only once in memory. Object code is generated every time the macro is called.
CALL & RET instructions are used to call procedure and return from Macro can be called just by writing its name.
procedure.
Length of the object file is less Object file becomes lengthy
Directives PROC & ENDP are used for defining procedure. MACRO and ENDM are used for defining MACRO
Directives More time is required for its execution Less time is required for it’s execution
Procedure can be defined as Macro can be defined as
Q. Write an ALP for Z = (P + Q) * (R + S) using MACRO. Draw flow chart of the same. [W’23]
DATA SEGMENT
P DB 04H
Q DB 02H
R DB 01H
S DB 02H
Z DW ?
DATA ENDS
Flowchart :
Recursive procedures:
An active procedure that is invoked from within itself or from within another active procedure is a recursive procedure.
Such an invocation is called recursion. A procedure that is invoked recursively must have the RECURSIVE attribute specified in the PROCEDURE
statement.
MACRO:
Small sequence of the codes of the same pattern are repeated frequently at different places which perform the same operation on the different
data of same data type, such repeated code can be written separately called as Macro.
Syntax:
MACRO_NAME MACRO[ARG1,ARG2,…..ARGN)
…..
ENDM
Example:
MYMACRO MACRO P1, P2, P3 ; Macro definition with arguments
MOV AX, P1
MOV BX, P2
MOV CX, P3
ENDM ; Indicates end of macro.
DATA SEGMENT
DATA ENDS
CODE SEGMENT
START: ASSUME CS:CODE, DS:DATA
MOV AX,DATA
MOV DS,AX
MYMACRO 1, 2, 3 ; macro call
MYMACRO 4, 5, DX
MOV AH,4CH
INT 21H
data segment
a dw 0202h
b dw 0408h
c dw ?
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov ax,a
mov bx,b
add ax,bx
mov c,ax
int 03h
code ends
end start
QDefine MACRO with its syntax S-23 2M S-24
Macro: A MACRO is group of small instructions that usually performs one task. It is a
QCompare procedure and Macro based on (i) Length of code (ii) Calling method (iii) Generation of object code (iv) Passing parameter w-24