Marking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313)

Similar documents
Marking Scheme. Examination Paper. Module: Microprocessors (630313)

Marking Scheme. Examination Paper. Module: Microprocessors (630313)

Code segment Stack segment

Marking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313)

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

Intel 8086 MICROPROCESSOR ARCHITECTURE

Philadelphia University Student Name: Student Number:

Faculty of Engineering Student Number:

Module 3 Instruction Set Architecture (ISA)

Introduction to IA-32. Jo, Heeseung

INTRODUCTION TO IA-32. Jo, Heeseung

Intel 8086 MICROPROCESSOR. By Y V S Murthy

Basic Execution Environment

8086 INTERNAL ARCHITECTURE

Lecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86

Complex Instruction Set Computer (CISC)

Lecture 5:8086 Outline: 1. introduction 2. execution unit 3. bus interface unit

Microprocessor and Assembly Language Week-5. System Programming, BCS 6th, IBMS (2017)

Faculty of Engineering Computer Engineering Department Islamic University of Gaza Assembly Language Lab # 2 Assembly Language Fundamentals

9/25/ Software & Hardware Architecture

ADVANCE MICROPROCESSOR & INTERFACING

The x86 Architecture

EC 333 Microprocessor and Interfacing Techniques (3+1)

Microprocessor. By Mrs. R.P.Chaudhari Mrs.P.S.Patil

Introduction to Microprocessor

We can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,...

MICROPROCESSOR PROGRAMMING AND SYSTEM DESIGN

Lab 6: Conditional Processing

Arithmetic Instructions

Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee

EC-333 Microprocessor and Interfacing Techniques

Lab 4: Basic Instructions and Addressing Modes

Internal architecture of 8086

icroprocessor istory of Microprocessor ntel 8086:

COMPUTER ENGINEERING DEPARTMENT

Chapter 3: Addressing Modes

Intel 8086: Instruction Set

Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB

Signed number Arithmetic. Negative number is represented as

PESIT Bangalore South Campus

Lecture 5: Computer Organization Instruction Execution. Computer Organization Block Diagram. Components. General Purpose Registers.

We will first study the basic instructions for doing multiplications and divisions

UNIT 2 PROCESSORS ORGANIZATION CONT.

SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013)

A Presentation created By Ramesh.K Press Ctrl+l for full screen view

Philadelphia University Student Name: Student Number:

Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB. Lab # 8. Conditional Processing

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 5: Procedures. Chapter Overview. The Book's Link Library

Assembler Programming. Lecture 2

Conditional Processing

X86 Addressing Modes Chapter 3" Review: Instructions to Recognize"

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

The Microprocessor and its Architecture

Assembly Language. Dr. Esam Al_Qaralleh CE Department Princess Sumaya University for Technology. Overview of Assembly Language

complement) Multiply Unsigned: MUL (all operands are nonnegative) AX = BH * AL IMUL BH IMUL CX (DX,AX) = CX * AX Arithmetic MUL DWORD PTR [0x10]

Microprocessors ( ) Fall 2010/2011 Lecture Notes # 15. Stack Operations. 10 top

Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB

Hardware and Software Architecture. Chapter 2

Q1: Multiple choice / 20 Q2: Protected mode memory accesses

Assembly Language for Intel-Based Computers, 4 th Edition

Lab 5: Input/Output using a Library of Procedures

The Instruction Set. Chapter 5

Addressing Modes on the x86

Assembly Language Each statement in an assembly language program consists of four parts or fields.

CC411: Introduction To Microprocessors

Chapter 2 COMPUTER SYSTEM HARDWARE

Summer 2003 Lecture 4 06/14/03

6/20/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

US06CCSC04: Introduction to Microprocessors and Assembly Language UNIT 1: Assembly Language Terms & Directives

Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD /12/2014 Slide 1

6/17/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

Ex: Write a piece of code that transfers a block of 256 bytes stored at locations starting at 34000H to locations starting at 36000H. Ans.

UMBC. A register, an immediate or a memory address holding the values on. Stores a symbolic name for the memory location that it represents.

3.1 DATA MOVEMENT INSTRUCTIONS 45

Chapter 2: The Microprocessor and its Architecture

INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

CSC 2400: Computer Systems. Towards the Hardware: Machine-Level Representation of Programs

EEM336 Microprocessors I. Addressing Modes

Lab 3: Defining Data and Symbolic Constants

CS401 Assembly Language Solved MCQS From Midterm Papers

Scott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998

EEM336 Microprocessors I. The Microprocessor and Its Architecture

Chapter Four Instructions Set

Inline Assembler. Willi-Hans Steeb and Yorick Hardy. International School for Scientific Computing

Machine-level Representation of Programs. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University


Islamic University Gaza Engineering Faculty Department of Computer Engineering ECOM 2125: Assembly Language LAB. Lab # 10. Advanced Procedures

Defining and Using Simple Data Types

Computer Architecture 1 ح 303

CSC 8400: Computer Systems. Machine-Level Representation of Programs

MODE (mod) FIELD CODES. mod MEMORY MODE: 8-BIT DISPLACEMENT MEMORY MODE: 16- OR 32- BIT DISPLACEMENT REGISTER MODE

Basic Assembly SYSC-3006

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

Assembly Language Programming

SYSC3601 Microprocessor Systems. Unit 2: The Intel 8086 Architecture and Programming Model

SOEN228, Winter Revision 1.2 Date: October 25,

Libraries and Procedures

8088/8086 Programming Integer Instructions and Computations

Moodle WILLINGDON COLLEGE SANGLI (B. SC.-II) Digital Electronics

Transcription:

Philadelphia University Faculty of Engineering Marking Scheme Examination Paper Department of CE Module: Microprocessors (630313) Final Exam Second Semester Date: 02/06/2018 Section 1 Weighting 40% of the module total Lecturer: Coordinator: Internal Examiner: Dr. Qadri Hamarsheh Dr. Qadri Hamarsheh Dr. Naser Halasa

Marking Scheme Microprocessors (630313) The presented exam questions are organized to overcome course material, the exam contains 6 questions; all questions are compulsory requested to be answered. Thus, the student is permitted to answer any question out of the existing ones in this section. Marking Assignments The following scheme shows the marks assignments for each question. They show also the steps for which a student can get marks along the related procedure he/she achieves. Question 1This question is attributed with 25 points if answered properly 1) One of the following microprocessors has a built in math co-processor in a single chip 8086 80286 c) 80386 d) 80486 2) The operands, source and destination in an instruction cannot be register, register memory location, register c) memory location, memory location d) immediate data, register 3) The register which has a special role in multiply and divides operations is --------------- AX BX c) CX d) DX 4) Which directive is used when defining BCD numbers? QWORD FWORD c) TBYTE d) DWORD 5) The TEXTEQU directive allows a constant to be redefined at any point in a program at run time. True False 6) The instruction TEST is most similar to---------- OR AND c) XOR d) NOT 7) Number of the times the instruction sequence below will loop before coming out of loop is MOV AL, 00h A1: INC AL JNZ A1 0 1 c) 255 d) 256 8) Given that the BL register contains B, which of the following instructions will change BL so that it contains 'b' and BL, 0010 0000 or BL, 0010 0000 c) or BL, 1101 1111 d) and BL, 1101 1111 Assume the following same initial processor state to answer questions (9), and (10) below. Treat each part individually. AX BX CX DX 6521 H ABCD H 0105 H 876F H C A Z S P O 1 0 1 0 0 0 FLAGS 9) What will be the contents of AX after SUB AL, AH 65BC H BC21 H c) 4421 H d) 6544 H 10) What are the flags after CMP AH, CL C=1, Z=0, S=1 C=0, Z=1, S=0 c) C=0, Z=0, S=0 d) C=0, Z=1, S=1

Question 2 This question is attributed with 16 points if answered properly Ñ Instruction Answer c) 1) SUB AL, Arr_Byte V 2) mov DS, Arr_DwordSIZE I 3) Name Byte 100 dup(?) V 4) mov Arr_Byte, Arr_Dword I 5) ADD [BX], 3H I mov esi, OFFSET Arr_Bytes mov ax, [esi] ; a. AX = 2010h b. EAX =003B008Ah mov eax, DWORD PTR Arr_Words ; mov esi, Ptr_DoubleWords mov ax, [esi+2] ; c. AX =0 mov ax, [esi+6] ; d. AX =0 mov ax, [esi-4] ; e. AX =0044h EAX = 10020000 d) e) Or AX, 0FF00h edx = 00004321h Question 3 This question is attributed with 20 points, if answered properly. (12 points) Registers of Microprocessor 8086 Intel 16-bit registers AX is used for the accumulator because it is favored by the CPU for arithmetic operations. BX is used for base addressing register hold the address of a procedure or variable. Three other registers with this ability are SI, DI and BP. The BX register can also perform arithmetic and data movement. CX is used for counter loop operations. These instructions automatically repeat and decrement CX. DX is used to point out data in I/O operations DX register has a special role in multiply and divide operation. 1. Segment Registers: the CPU contain four segment registers, used as base location for program instruction, and for the stack. CS (Code Segment): The code segment register holds the base address of all executable instructions (code) in a program. DS (Data Segment): the data segment register is the default base location for variables. SS (Stack Segment): the stack segment register contain the base location of the stack. ES (Extra Segment): The extra segment register is an additional base location for memory variables. 2. Index registers: index registers contain the offset of data and instructions. The term offset refers to the distance of a variable, label, or instruction from its base segment. The index registers are: BP (Base Pointer): the BP register contain an assumed offset from the stack segment register, as does the stack pointer. SP (Stack Pointer): the stack pointer register contain the offset of the top of the stack. The stack pointer and the stack segment register combine to form the complete address of the top of the stack.

SI (Source Index): This register takes its name from the string movement instruction DI (Destination Index): the DI register acts as the destination for string movement instruction. 3. Status and Control register: IP (Instruction Pointer): The instruction pointer register always contain the offset of the next instruction to be executed within the current code segment. The instruction pointer and the code segment register combine to form the complete address of the next instruction. Flag Registers and bit fields CF, the Carry Flag: This flag is set whenever there is a carry out, either from d7 after an 8-bit operation or from d15 after a 16-bit data operation. if the sum of 71 and 99 where stored in the 8-bit register AL, the result cause the carry flag to be 1. The flag values = 1 = carry, 0 = no carry. PF, the Parity Flag: After certain operations, the parity of the result s low-order byte is checked. If the byte has an even number of 1s, the parity flag is set to 1; otherwise, it is cleared. This flag is used by the OS to verify memory integrity and by communication software to verify the correct transmission of data. AF, the Auxiliary Carry Flag: If there is a carry from d3 to d4 (or borrow from bit 4 to bit 3) of an operation this bit is set to 1, otherwise cleared (set to 0). ZF, the Zero Flag: The ZF is set to 1 if the result of the arithmetic or logical operation is zero; otherwise, it is cleared (set to 0). SF, the Sign Flag: MSB is used as the sign bit of the binary representation of the signed numbers. After arithmetic or logical operations the MSB is copied into SF to indicate the sign of the result. The flag values 1=negative, 0 = positive OF, the Overflow Flag: This flag is set whenever the result of a signed number operation is too large, causing the high-order bit to overflow into the sign bit. The flag values 1 = overflow, 0 = no overflow. TF, the Trap Flag: When this flag is set it allows the program to single step, meaning to execute one instruction at a time. Used for debugging purposes. The flag values are 1 = on, 0 = off. IF, Interrupt Enable Flag: This bit is set or cleared to enable or disable only the external interrupt requests as keyboard, disk drive, and the system clock timer. The flag values are 1= enable, 0 = disable. DF, the Direction Flag: This bit is used to control the direction of the string operations and used for block data transfer instructions, such as MOVS, CMPS, SCAS, it selects increment or decrement mode for the DI and/or SI registers. (8 points) CMP (Comparison): The comparison instruction (CMP) is a subtraction that changes only the flag bits; the destination operand never changes. A comparison is useful for checking the entire contents of a register or a memory location against another value. A CMP is normally followed by a conditional jump instruction, which tests the condition of the flag bits, The destination and source operands can be unsigned or signed CMP destination, source CMP AL,[DI] LAHF transfers the rightmost 8 bits of the flag-register into the AH register (the SF, ZF, AF, PF, and CF). XCHG: This exchanges contents of a register with contents of any other register or memory location.this can exchange either byte or word, etc. This cannot exchange segment registers or memory-to-memory data. This can use any addressing-mode except immediate addressing. XCHG instruction, using the 16-bit AX register with another 16-bit register, is the most efficient exchange. XCHG AL,[DI] TEST: The TEST instruction performs the AND operation. The difference is that the AND instruction changes the destination operand, while the TEST instruction does not. A TEST only affects the condition of the flag register, which indicates the result of the test. Test AX, BX

Question 4 This question is attributed with 10 points, if answered properly. BH = 20 DH = 99 Question 5 This question is attributed with 11 points, if answered properly. The complete code for this question as the following: c) call Clrscr mov eax, 500 call Delay call DumpRegs (3 points) (4 points).data arrayd DWORD 1000h,2000h,3000h mov esi, OFFSET arrayd ; starting OFFSET mov ecx, LENGTHOF arrayd ; number of units in dwordval mov ebx, TYPE arrayd ; size of a doubleword call DumpMem ; display memory call Crlf ; new line (4 points).data prompt1 BYTE "Enter a 32-bit signed integer: ",0 mov edx,offset prompt1 call WriteString call Crlf ; new line call ReadInt ; input the integer call WriteInt ; display in signed decimal call Crlf call WriteHex ; display in hexadecimal call Crlf call WriteBin ; display in binary call Crlf

Question 6 This question is attributed with 18 points, if answered properly. ;locate procedure ; Receives: esi = string address ; ecx = string size ; AL = character to be located ; Returns: ebx = position of found character OR negative value (-1) locate PROC USES ecx jecxz notfound mov ebx,1 L1: cmp AL, [esi] ; string character = search character? je found ; yes? found character inc esi ; no? point to next string character inc ebx loop L1 notfound: mov ebx, -1 ; if not found then ebx = -1 found: ret ; if found, si = element address locate ENDP Locate_Charater.asm Title locate (search) a character in a given string Locate_Charater.asm.Model flat, stdcall.data str Byte 'Enter the string' char Byte 'm' msg1 Byte " character found at position ", 0 msg2 Byte " character not found ",0 Main Proc Mov ecx, lengthof str Mov esi, Offset str Mov al, char Call locate (3 points) cmp ebx, -1 je notfound Mov edx, Offset msg1 call WriteString Mov eax, ebx call WriteDec call crlf jmp Quit notfound: Mov dx, Offset msg2 call WriteString call crlf Quit: Exit Main ENDP End Main (4 points)