Midterm Exam #2 Answer Key

Similar documents
Objectives. Saving Interrupt Vectors. Writing a Custom Interrupt Handler. Examples of use of System functions for Input-Output and Interrupts

ORG ; TWO. Assembly Language Programming

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

CG2007 Microprocessor systems.

Week /8086 Microprocessor Programming II

PHY4635/5635 Spring Lecture 8: Program Control Instructions

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

Intel x86 instruction set architecture

COE 205 Lab Manual Experiment N o 12. Experiment N o Using the Mouse

PESIT Bangalore South Campus

db "Please enter up to 256 characters (press Enter Key to finish): ",0dh,0ah,'$'

The Stack. Lecture 15: The Stack. The Stack. Adding Elements. What is it? What is it used for?

UNIVERSITY OF CALIFORNIA, RIVERSIDE

Section 001. Read this before starting!

Basic characteristics & features of 8086 Microprocessor Dr. M. Hebaishy

SHEET-2 ANSWERS. [1] Rewrite Program 2-3 to transfer one word at a time instead of one byte.

Computer Architecture and System Software Lecture 06: Assembly Language Programming

Chapter 3. Assembly Language Programming with 8086

Topics Introduction to Microprocessors. Chapter 5 Macros and modules. What is macro? How to use macro? (I) How to use macro?

Q. State and Explain steps involved in program development. [w-08, w-10, s-12, w-11]

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

Northern India Engineering College, Delhi (GGSIP University) PAPER I

EE2007 Microprocessor systems.

Copyright 2000 by Barry B. Brey The CPU Scheduling Processes

Computer Architecture and System Software Lecture 07: Assembly Language Programming

Programming in Module. Near Call

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

A4 Sample Solution Ch3

EXPERIMENT TWELVE: USING DISK FILES

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

Video processing The INT instruction enables program to interrupt its own processing. Use INT instruction to handle inputs and outputs

CPU. IBM PC and compatible Memory Structure

BLDEA S V.P. DR. P.G. HALAKATTI COLLEGE OF ENGINEERING & TECHNOLOGY, VIJAYAPURA

PART - B (Answer all five units, 5 X 10 = 50 Marks)

THE UNIVERSITY OF TRINIDAD & TOBAGO

COMPUTER ENGINEERING DEPARTMENT

8086 ALP TOOLS (CH 2) CHAPTER 2

CC411: Introduction To Microprocessors

EC6504 MICROPROCESSOR AND MICROCONTROLLER

Intel 8086: Instruction Set


L1 Remember, L2 Understand, L3 - Apply, L4 Analyze, L5 Evaluate, L6 Create

Mr. Sapan Naik 1. Babu Madhav Institute of Information Technology, UTU

16-bit MS-DOS and BIOS Programming

Programmable Interval Timer CEN433 King Saud University Dr. Mohammed Amer Arafah

UMBC. contain new IP while 4th and 5th bytes contain CS. CALL BX and CALL [BX] versions also exist. contain displacement added to IP.

EC 333 Microprocessor and Interfacing Techniques (3+1)

reply db y prompt db Enter your favourite colour:, 0 colour db 80 dup(?) i db 20 k db? num dw 4000 large dd 50000

Assignment no:4 on chapter no :3 : Instruction set of 8086

WINTER 12 EXAMINATION Subject Code : Model Answer Page No : / N. a) Describe the function of SID and SOD pins of 8085 microprocessor

b) List the 16 Bit register pairs of 8085?(Any 2 pair, 1 Mark each) 2M Ans: The valid 16 bit register pair of 8085 are

EEM336 Microprocessors I. Data Movement Instructions

Objectives. ICT106 Fundamentals of Computer Systems Topic 8. Procedures, Calling and Exit conventions, Run-time Stack Ref: Irvine, Ch 5 & 8

The 80386SX Processor Bus and Real-Mode Instruction Set

Lecture 16: Passing Parameters on the Stack. Push Examples. Pop Examples. CALL and RET

.code. lea dx,msg2. Page 1/8. Problem 1: Programming in Assembly [25 Points]

Interface DAC to a PC. Control Word of MC1480 DAC (or DAC 808) 8255 Design Example. Engineering 4862 Microprocessors

THE VIRTUAL PC A TOOL FOR STUDYING HARDWARE AND SOFTWARE

16.317: Microprocessor Systems Design I Spring 2015

ELEC 242 Time Delay Procedure

RMV ELECTRONICS INC. Application Note:

Microprocessors (A) DOS Services

x86 architecture et similia

LABORATORY WORK NO. 7 FLOW CONTROL INSTRUCTIONS

MOV CX,80 MOV CX,100. For example, MOV DI, OFFSET TEXT_STRING ;DI points to the TEXT_STRING in the extra segment ; Byte to be scanned in AL

Interrupt Services. Which Way is Best? Characteristics. Direct in, out. BIOS Average Average DOS Most Least

Lecture 13: I/O I/O. Interrupts. How?

BEng (Hons.) Telecommunications. BSc (Hons.) Computer Science with Network Security

EE 314 Spring 2003 Microprocessor Systems

Chapter 3: Addressing Modes

ELEC VIDEO BIOS ROUTINES

Assembly Language Lab # 12 Part A: Strings and Arrays Part B: Drawing Graphics Using INT 10h

LABORATORY WORK NO. 8 WORKING WITH MACROS AND LIBRARIES

Unit 5 DOS INTERRPUTS

Question Bank Unit-1

Tutorial Letter 103/3/2012 Computer Organization COS2621 Semesters 1 & 2

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

Week 11 Programmable Interrupt Controller

Experiment 8 8 Subroutine Handling Instructions and Macros

Summer 2003 Lecture 4 06/14/03

Microcomputer Architecture..Second Year (Sem.2).Lecture(2) مدرس المادة : م. سندس العزاوي... قسم / الحاسبات

CS-202 Microprocessor and Assembly Language

CSCI516: Program 1 - October 11, 2010 The Program is due: October 25, 2010 in the beginning of the class

UMM AL-QURA UNIVERSITY LAB MANUAL

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Electronics and Communication

GATE Exercises on Microprocessors

Computer Organization and Assembly Language CSC-210

Experiment N o 3 Segmentation and Addressing Modes

9/25/ Software & Hardware Architecture

EC-333 Microprocessor and Interfacing Techniques

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

Experiment 3 3 Basic Input Output

ECE 485/585 Microprocessor System Design

Transfer of Control. Lecture 10 JMP. JMP Formats. Jump Loop Homework 3 Outputting prompts Reading single characters

Week /8086 Microprocessor Programming I

UNIT 4. Modular Programming

8085 Microprocessor Architecture and Memory Interfacing. Microprocessor and Microcontroller Interfacing

Come and join us at WebLyceum

16.317: Microprocessor Systems Design I Fall 2013

Basic Assembly SYSC-3006

Transcription:

Midterm Exam #2 Answer Key Name: Student ID #: I have read and understand Washington State University s policy on academic dishonesty and cheating YOU Signed: Problem 1) Consider the following fragment of assembly code: src db 1,2,3,5,7,11,13,17,19,23,29,31 dst db 06Fh,06Dh,06Bh,069h,057h,045h, 043h,041h,03Dh,03Ah,038h,034hh count dw 4 add count,3 17+6+8 mov cx,count 8+6+4 xor bx,bx 3 mov di,offset dst 4 label1: mov dh,src[bx+1] 8+9+4 xor dh,dst[bx] 9+9+4 mov [bx+di],dh 9+8+4 inc bx 2 loop label1 17/5 label2: a) (10 Points): What will be the value in DX when control reaches label2? 52??h b) (10 Points) How many clock cycles will this code take to execute on an 8088? Instruction execution times are given in Appendix B, Page 641 of the text 31+18+3+4 + 7*(21+22+21+2+17) + 6*17 + 5 744 c) (5 Points) Assuming a CPU clock speed of 80 Mhz, how long will this code take to execute? 93 usec

Problem 2) Consider the following logical diagram of a decoder a) (15 points) Fill in the following table with 1 s, 0 s and X s to indicate the partial state of this decoder s truth table 2A 1 2A 0 1E 2E 2Y 3 2Y 2 2Y 1 2Y 0 0 0 X 0 1 1 1 0 0 1 X 0 1 1 0 1 1 0 X 0 1 0 1 1 1 1 X 0 0 1 1 1 X X X 1 1 1 1 1 b) (5 points) What is a common identity of this kind of device in the 74LSxxx nomenclature? 74LS139 c) (5 points) If a 74LS128 is commonly described as a 3 x 8 decoder, what would the description of this device be? A pair of 2 x 4 decoders

Problem 3) The following is a brief section of an assembly language program label1: add ax,[bx] dec cx jnz label1 label2: a) (10 points) Assemble the assembly language code into its corresponding machine code The address for label1 in memory will be 3E20:032Ch Your answer may be in either binary or hex ANSWER: 0000 0011 1000 0111 or 03 87h 0100 1001 or 49h 0111 0101 0010 1100 0000 0011 or 75 2C 03h b) (5 points) At what address in memory will label2 reside? Please write your answer in CS:IP format ANSWER: Since we are still in the same code segment, the CS component is unchanged The number of instruction bytes preceding label2 is 6 6 + 032Ch = 0332h Hence: 3E20:0332h

Problem 4) (40 Points) You are designing an 8088 based computer for a control application, and are designing part of the memory section For availability purposes, the system was designed with four 2KB 8-bit RAMs & one 8KB 8-bit ROM are identical in design to the 62256 memory chips except for the difference in capacity and the corresponding addressing Draw the logic necessary to decode the correct addresses and hook up all necessary address, data, and control signals to the memory chips You may include either 74LS138 or 74LS139 decoders in your solution Be sure to correctly distinguish I/O cycles from memory cycles Remember, the CS, RD, and WR inputs to the device are active low signals

Problem 5) (40 Points) Write a procedure in assembly language to count the number of times that EACH of the DOS Function Calls (INT 21h ) are performed You are to hook into the existing interrupt so that the operation of the DOS function call occurs prior to your update of the various counters Include the following: Data segment definition for fcncounts as a vector where the total count for each DOS function can be stored lines of code at the beginning of the main routine required to modify the interrupt vector table to point to your procedure lines of code at the end of the main routine for restoring the interrupt vector table to its original status The complete requested procedure You may assume the following: There are memory locations labeled intaddr where the code segment and offset of the original interrupt service routine may be stored Each DOS function will not be called more than 2 16-1 times by the main routine Calls to INT 21h for the getting/setting of the interrupt vector table at the beginning and end of the main routine may be ignored in the counts Answer: fcncntr proc fncounts dw 255 dup (?) mov ah,35h ;get int vector mov al,21h ;int vector index int 21h mov intaddr,ds ;save cs of int vector mov intaddr+2,dx ;save ip of int vector mov es, cs ;load current code seg mov bx, offset fcncntr ;load offset of procedure mov ah, 25h ;set int vector int 21h far pushf call word ptr intaddr ; perform call to original ISR push bx xor bx,bx mov bl,ah ; get DOS function number add bx,bx ; set up offset inc fcncounts[bx] ; count the function call pop bx iret ;return to interrupted routine fcncntr endp