Philadelphia University Student Name: Student Number: Faculty of Engineering Serial Number: Final Exam, First Semester: 2017/2018 Dept. of Computer Engineering Course Title: Microprocessors Date: 30/01/2018 Course No: 0630313 Time Allowed: 2 hours Lecturer: Dr. Qadri Hamarsheh No. Of Pages: 6 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. (10 marks) 1) The first processor that includes Virtual Memory in the Intel microprocessor family was: a) 4004 c) Pentium Pro b) 80286 d) 80486 2) If SS = 90A3H, then the range of physical addresses for the stack segment is: a) 00000H 090A3H c) 090A3 190A2H b) 90A30H 9FA30H d) 90A30 A0A2FH 3) The special output bits in the adder/subtractor circuitry (like OF) are maintained in what register? a) EFLAGS c) EIP b) EBP d) ESP 4) Which directive is used when defining 64-bit IEEE long reals? a) REAL4 c) REAL64 b) REAL8 d) REAL 5) The instruction, CMP to compare source and destination operands it performs a) Addition c) Subtraction b) Division d) Multiplication 1
6) The instruction that loads effective address formed by destination operand into the specified source register is a) LES c) LDS b) LEA d) LAHF 7) What does the NEG instruction do? a) Two s Complement b) One s Complement 8) Given that BL contains B the effect of the following code OR BL, 0010 0000 ADD BL, 2 is to a) clear BL c) store b in BL b) store 0110 0001 in BL d) store d in BL 9) The instructions that are used to call a subroutine (procedure) from a main program and return to the main program after execution of called function are a) JMP,IRET c) CALL,JMP b) CALL,RET d) JMP,RET 10) Which of the following instructions changes the CS register: a) INT 21h c) INC CS b) MOV CS, DS d) CS cannot be changed 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 (7 marks) a) Explain Memory Models that can be used in assembly language. (3 marks) 2
b) List four types of the memory addressing modes used in Intel Microprocessor. (2 marks) c) What is the use of Interrupt vector table of 8086 microprocessor and describe the IVT Format? (2 marks) 3
Question 3 (10 marks) a) Write assembly code to do the following: (4 marks) i) Write a single instruction using 16-bit operands that clears the high 8 bits of AX and does not change the low 8 bits. ii) Write a single instruction using 16-bit operands that set the high 8 bits of AX and does not change the low 8 bits. iii) Write instructions that jump to label L1 when the unsigned integer in DX is less than or equal to the integer in CX. iv) Write an instruction that moves the first two bytes in the array named (A1) to the AX register. The resulting value will be 2010h. A1 BYTE 10h, 20h, 30h, 40h b) Use the following data declarations. (3 marks).data X1 DWord 1234ff3bh, 3456cfdeh X2 Byte Enter Your Name, 0 Indicate whether or not each of the following assembly code is valid: Ñ Instruction Answer 1) MOV DS, BX 2) test AL, X2 3) add eip, X1 4) MOV ES,DS 5) sub si,di 6) cmp 75,EAX 4
c) Use the following data declarations. (3 marks).data valw LABEL WORD val DWORD 01234567h TABLE DB 14, 15, 22, 45 ; Vector DWORD 01234567h,15 vec1 WORD 0,1,2,3,4,5 WORD 6,7,8,9,10,11 vec2 DWORD 0,1,2,3,4,5, 6,7,8,9,10,11 Fill in the contents of the specified registers in the following code:.code mov ax,valw ; ax= --------------- MOV CL, TABLE[2] ; CL = --------------- mov al,type Vector; al= --------------- mov eax,lengthof vec1 ; eax= --------------- mov ebx,lengthof vec2 ; ebx= --------------- mov ebx,sizeof vec2 ; ebx= --------------- Question 4 a) Consider the following Boolean expression: while (Avg >= Std) do begin Avg := Avg - 1; Std := Std + 1; end; Write an assembly language code to implement the above expression. Assume that all variables are declared and of type WORD. (3 marks) (1.5 marks) b) The array Name of 33 bytes is assumed to contain string of ASCII characters. Check it to see if it contains the 'A' character and go to location HasAchar if it does. (1.5 marks) 5
Question 5 (10 marks) Write a complete assembly program to do the following: a) Create an array of 16 randomly ordered integers using Irvine library's Random32 procedure. b) Create procedure named Swap that exchanges the values of two 32-bit integers. c) Using the Swap procedure from Section b as a tool, write a loop that exchanges each consecutive pair of integers in the array. d) Display the array before and after the exchange (swap) using Irvine library's DumpMem procedure, use suitable messages for this step. Assume that protected Addressing-mode is used. Use indexing addressing memory mode. Good Luck 6