You are on page 1of 2

University of Duhok Midterm exam

College of Engineering Second semester


ECE department Course: Microprocessors
2nd year students Date : 19 / 4 / 2022
Time allowed: 70 Minutes

Q1. (20 %) Write an assembly language program to compute number of successful in a class of 50 students.
.MODEL small
.STACK 100H
.DATA
A DB 12h, 26h, 33h, 40h, 35h, ....
B DB ?
.CODE
START: MOV AX, SEG A
MOV DS, AX
MOV SI, OFFSET A
MOV CX, 0032h
XOR AX, AX
NEXT : MOV AL, [SI]
CMP AL, 32h
JC NEXT2
INC AH
NEXT2 INC SI
LOOP NEXT
MOV B, AH
MOV AH, 4Ch
INT 21h
END START

Q2. (10 %) If CS = 1111 and IP = 0100, determine logical, physical, segment, and offset addresses.
Logical address 1111:0100
Segment address 1111
Offset address 0100
Physical address 1111 * 16 + 0100 = 11210

Q3. (10 %) Explain briefly the function and components of 8086 execution unit .
EU execute instruction received from IQ
ALU performs arithmetic and logic operations
Eight registers
Control unit

Q4. (10 %) What are the differences between JMP and CALL instructions?
JMP CALL
Target address inside/outside main program outside main program
Return address no yes
Type unconditional and conditional unconditional
Q5. (15 %) Show the error in following instructions and fix it:

1. MOV CS, 1A00 cannot move data directly to segment register


MOV AX, 1A00
MOV CS, AX
2. MUL F0 operand cannot be immediate
MOV BL, F0
MUL BL
3. INC [SI] operand size not defined
use byte ptr or word ptr

Q6. (10 %) Draw block diagram of the circuit to demultiplex address/data bus.

Q7. (10 %) Why learning assembly language is necessary?

1. Produce small size program which can be run faster than compiler-based generated code.
2. Allows direct access to hardware.
3. Helps to understand of how computers work.

Q8. (15 %) What is the function of following instructions:

1. TEST apply AND operation without saving the result in destination


2. SCASB compare AL with memory location indexed by ES:DI and auto increment/decrement DI
3. SAR shift content of operand right

You might also like