Philadelphia University Student Name: Student Number: Faculty of Engineering Serial Number: Final Exam, Second Semester: 2016/2017 Dept. of Computer Engineering Course Title: Microprocessors Date: 12/06/2017 Course No: 0630313 Time Allowed: 2 hours Lecturer: Dr. Qadri Hamarsheh No. Of Pages: 7 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 5 questions totaling 40 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: 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 IA-32 Processor Architecture, Assembly Language Fundamentals: Instructions, Directives, Identifiers, Defining Data, Symbolic Constants, Data Transfers, Addressing, and Arithmetic instructions Addressing Modes, Conditional and Unconditional instructions, Stack, Pointers, Arrays and Procedures. Question 1 Multiple Choices Identify the choice that best completes the statement or answers the question. 1) The 8086/8088 used two processing logical units which were known as: a) Segment and Offset Units b) Bus Interface Unit and Execution Unit c) Bus Unit and Execution Interface Unit d) ALU and Control Unit (10 marks) 2) What are the names of the 4 segment registers? a) Data, Index, Code, Stack b) Stack, Index, Extra, Code c) Stack, Extra, Code, Data d) Stack, Data, Base, Counter 3) Memory segmentation (partitioning) was necessary because the x86 registers were 16-bits and could not hold the 20-bit addresses of the main memory a) True b) False 4) In the following data definition, assume that List2 begins at offset 2000h. What is the offset of the third value (5)? List2 WORD 3, 4, 5, 6, 7 a) 2006h c) 2004h b) 2003h d) None of above 5) Which of the following is an invalid instruction? a) MOV AX, [BP] c) MOV AX, CS b) MOV DS, CS d) None of the above 1
6) Assume the following initial state for AX, BX, CX registers: AX BX CX 6521 H ABCD H 0105 H What are the flags after CMP AH, CL a) C=1, Z=0, S=1 c) C=0, Z=1, S=1 b) C=0, Z=1, S=0 d) C=0, Z=0, S=0 7) Given that the BL register contains b, the effect of the following instruction and BL, 1101 1111 is to a) clear bl c) store B in bl b) store 0010 0000 in bl d) leave bl unchanged 8) Given that the subprogram WriteChar displays the character in AL register, the effect of the following instructions: mov AL, c sub AL, 2 call WriteChar is to a) display 2 c) display 'c' b) display 'a' d) display a blank 9) The interrupt vector table (IVT) is located at addresses: a) 00000H 01024H c) 00000H 003FFH b) 00000H 000FFH d) FFF00H - FFFFFH 10) INT 21 service 01H is used to read character from standard input with echo. It returns the result in register. a) AL c) BH b) BL d) CL 2
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, Identifiers, Defining Data, Symbolic Constants, Data Transfers, Addressing, and Arithmetic instructions Addressing Modes, Conditional and Unconditional instructions, Stack, Pointers, Arrays and Procedures. Question 2 (9 marks) a) Explain 8086 flag register? (2.5 marks) b) Fill the following table that describes data-related operators and directives used in assembly language. (3 marks) Operator Usage and Description OFFSET PTR TYPE LENGTHOF SIZEOF LABEL 3
c) What is the use of Interrupt vector table of 8086 microprocessor, describe the IVT Format? (2 marks) d) Explain the following instructions: (1.5 marks) NEG LOOP SAHF 4
Question 3 (8 marks) a) What will be the final value of EAX in the following assembly code? (2.5 marks) L1: L2: mov eax, 0 mov ecx, 10 mov eax, 3 mov ecx, 5 add eax, 5 loop L2 loop L1 b) Write instruction(s) to perform the following tasks: (3.5 marks) Task mark 1. Invert the seventh bit in DX (note: the LSB is the first bit) 2. Set the 5 th and the 11 th bits in AX 3. 4. 5. Calculate the 2's complement of AX Jump to label 'HELP' if AX is even Three different instructions that will subtract 1 from register DX 1.5 marks c) Assume that we have the following data definitions: (2 marks) mybytes BYTE 10h, 20h, 30h, 40h mywords WORD 8Ah, 3Bh, 72h, 44h, 66h mydoubles DWORD 1, 2, 3, 4, 5 mypointer DWORD mydoubles Fill in the requested register values on the right side of the following instruction sequence: mov esi, OFFSET mybytes mov ax, [esi] ; AX =---------- mov eax, DWORD PTR mywords ; EAX =--------- mov esi, mypointer mov ax, [esi+2] ; AX =---------- mov ax, [esi-4] ; AX =---------- 5
Question 4 (6 marks) Write complete assembly language program that: Declares the following array of DWORD: 44h, FFh, 555, 11. Declares the following string "Assembly language is easy". Displays the content of the array and the string to standard output using DumpMem Procedure. Saves and restores the content of the used registers into the stack before and after calling. 6
Question 5 (7 marks) Write an Assembly Language program to compare two strings and display if they are equal. The program should: Use Real Mode Programming. Use Indirect Addressing Mode. Use Irvine16 library for output. Two strings must be assigned within the definition of the strings. Use EQU and $ operators to calculate the size of the string. Display the message "EQUAL" when the strings are equal and the message "NOT EQUAL" otherwise. DS must point to the segment address. Good Luck 7