You are on page 1of 4

Philadelphia University Student Name:

Student Number:
Faculty of Engineering Serial Number:

Second Exam, First Semester: 2017/2018


Dept. of Computer Engineering
Course Title: Microprocessors Date: 27/12/2017
Course No: 0630313 Time Allowed: 50 minutes
Lecturer: Dr. Qadri Hamarsheh No. Of Pages: 4

Instructions:
 ALLOWED: pens and drawing tools (no red color).
 NOT ALLOWED: Papers, calculators, literatures and any handouts. Otherwise, it will lead to the non-approval of your
examination.
 Shut down Telephones, and other communication devices.
Please note:
 This exam paper contains 4 questions totaling 20 marks
 Write your name and your matriculation number on every page of the solution sheets.
 All solutions together with solution methods (explanatory statement) must be inserted in the labelled position on the
solution sheets.
 You can submit your exam after the first hour.
Basic notions and Familiar: The aim of the questions in this part is to evaluate the required minimal student knowledge and
skills. Answers in the pass category represent the minimum understanding of Assembly Language Fundamentals: Instructions,
Directives, Addressing Modes, and Conditional and Unconditional instructions, Pointers, and Arrays.

Question 1 Multiple Choices (5 marks)

Identify the choice that best completes the statement or answers the question.
1) Assume that the AX register contains the value 6521 H. What will be the contents of AX after
execution the instruction:
SUB AL, AH
a) 65BC H c) BC21 H
b) 4421 H d) 6544 H
2) Which of the following is an illegal 8086 instruction?
a) add ax, [cx] c) inc [si]
b) mov ax, [bx] d) aDd bx, [dx]
3) Let W be an array of Words, one of the following is a correct code to set the fifth element in W to
100.
a) mov [W+10], 100
b) mov [W+2*4], 100
c) mov [W+5], 100
d) None of the above
4) What does the NOT instruction do?
a) Two’s Complement b) One’s Complement
5) What will be the contents of register AL after the following has been executed
MOV BX, F78Ch
MOV AL, 7Eh
ADD AL, BL
a) 6A and carry flag is set c) 0A and carry flag is set
b) 6A and carry flag is reset d) 0A and carry flag is reset

1
Question 2 (8 marks)
a) Indicate which of the following instructions is wrong and state the reason. (3 marks)
Instruction answer Reason
INC CX, 2

SUB DS, 3H

MOV [1234H] , AX

add [esi+offset x], al

CMP DX

ADD [BX], 3H

b) What exactly will be displayed by the following assembly program? (2 marks)


INCLUDE Irvine32.inc
.DATA
X DWORD 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
.CODE
MAIN PROC
mov eax, X
call WriteHex
call CrLf
mov eax, [X]
call WriteHex
call CrLf
mov esi, 8
mov eax, X [esi]
call WriteHex
call CrLf
mov esi, OFFSET X
mov eax, [esi]
call WriteHex
call CrLf
EXIT
MAIN ENDP
END MAIN
Solution

2
c) Write down the value of each destination operand if the instruction is correct; assume that the offset
of the x1 is 0000. (3 marks)
.data
x1label LABEL WORD
x1 BYTE 79h,25h,02h,05h
x2 WORD 7654h,1203h
x3 DWORD 12345678h
.code
mov ax, x1label; ax = ------------
mov ax, WORD PTR [x1 +2] ; ax = ------------
mov bl, BYTE PTR x3; bl = ------------
mov bl, BYTE PTR [x2 +2] ; bl = ------------
mov ax, WORD PTR [x3 +2] ; ax = ------------
mov eax, DWORD PTR x2; eax = ------------
mov cx, offset x1 +3 ; cx = ------------
Familiar and Unfamiliar problems solving: the aim of the questions in this part is to evaluate that the student has some basic
knowledge of the key aspects of the lecture material and can attempt to solve familiar and unfamiliar problems of Assembly
Language Fundamentals: Instructions, Directives, Addressing Modes, Conditional and Unconditional instructions, Stack,
Pointers, Arrays and Procedures.

Question 3 (3 marks)

The 8 data bytes are stored from memory location E000H to E007H. Write 8086 Assembly Language code
to transfer the block of data to new location B001H to B008H using indirect addressing.

Solution

3
Question 4 (4 marks)

Write a program that displays a string "This line is displayed in color" in four different colors, using
the SetTextColor procedure from the Irvine library. (Any colors may be chosen)

Solution

Good Luck
4

You might also like