Microprocessor I, Spring 2007 Lab 2: Assembling and executing instructions with DEBUG software Due on 03/02/2007, 12:30pm EST

Similar documents
LABORATORY 1: EXPLORING THE SOFTWARE ARCHITECTURE OF THE MICROPROCESSOR

Computer Organization and Assembly Language CSC-210

FACULTY OF ENGINEERING LAB SHEET

FACULTY OF ENGINEERING LAB SHEET

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

Course Syllabus of Microprocessor I (Fall 2006)

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

Addressing Modes on the x86

Chapter 3: Addressing Modes

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

Chapter Four Instructions Set

MICROPROCESSOR TECHNOLOGY

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

Ex : Write an ALP to evaluate x(y + z) where x = 10H, y = 20H and z = 30H and store the result in a memory location 54000H.

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

Philadelphia University Student Name: Student Number:

Q1: Multiple choice / 20 Q2: Memory addressing / 40 Q3: Assembly language / 40 TOTAL SCORE / 100

EEM336 Microprocessors I. Addressing Modes

EEM336 Microprocessors I. Data Movement Instructions

Chapter Three Addressing Mode MOV AX, BX

Experiment N o 3 Segmentation and Addressing Modes

EC 333 Microprocessor and Interfacing Techniques (3+1)

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

Assembly Language Lab #5

Code segment Stack segment

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

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

ADVANCE MICROPROCESSOR & INTERFACING

16.317: Microprocessor Systems Design I Fall 2013

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

Programming in Assembler. Laboratory manual. Exercise 3

Computer Architecture 1 ح 303

Chapter 5. Real-Mode 80386DX Microprocessor Programming 1 Part 2. The 80386, 80486, and Prentium Processors,Triebel Prof. Yan Luo, UMass Lowell 1

EXPERIMENT 1. FAMILIARITY WITH DEBUG, x86 REGISTERS and MACHINE INSTRUCTIONS

THE UNIVERSITY OF TRINIDAD & TOBAGO

Experiment 3 3 Basic Input Output

Assembling, Linking and Executing 1) Assembling: .obj obj .obj.lst .crf Assembler Types: a) One pass assembler:

Arithmetic Instructions

Experiment N o 1. 1 Introduction to Assembly Language Programming

EC 333 Microprocessor and Interfacing Techniques (3+1)

E CpE185 Laboratory Fall Introduction to Debug

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

EE 314 Spring 2003 Microprocessor Systems

LAB 3: Programming in Assembly Language

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

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

Q1: Multiple choice / 20 Q2: Data transfers and memory addressing

Lecture 8: Control Structures. Comparing Values. Flags Set by CMP. Example. What can we compare? CMP Examples

INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

BAHAR DÖNEMİ MİKROİŞLEMCİLER LAB3 FÖYÜ

ORG ; TWO. Assembly Language Programming

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.

8086 programming Control Flow Instructions and Program Structures

Q1: Multiple choice / 20 Q2: Memory addressing / 40 Q3: Assembly language / 40 TOTAL SCORE / 100

Logic Instructions. Basic Logic Instructions (AND, OR, XOR, TEST, NOT, NEG) Shift and Rotate instructions (SHL, SAL, SHR, SAR) Segment 4A

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

Intel 8086: Instruction Set

Section 001 & 002. Read this before starting!

9/25/ Software & Hardware Architecture

LABORATORY 8: USING BIOS ROUTINES FOR KEYBOARD INPUT AND DISPLAY OUTPUT

Basic Execution Environment

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

Arithmetic and Logic Instructions And Programs

Experiment N o 3. Segmentation and Addressing Modes

CS401 Assembly Language Solved Subjective MAY 03,2012 From Midterm Papers. MC

16.317: Microprocessor Systems Design I Spring 2014

CS/ECE/EEE/INSTR F241 MICROPROCESSOR PROGRAMMING & INTERFACING MODULE 4: 80X86 INSTRUCTION SET QUESTIONS ANUPAMA KR BITS, PILANI KK BIRLA GOA CAMPUS

1-Operand instruction types 1 INC/ DEC/ NOT/NEG R/M. 2 PUSH/ POP R16/M16/SR/F 2 x ( ) = 74 opcodes 3 MUL/ IMUL/ DIV/ DIV R/M

CS401 Assembly Language Solved MCQS From Midterm Papers

Section 001. Read this before starting!

SECTION 3 ASSEMBLY LANGUAGE PROGRAMMING

Name (10) # Student. Student. 2017, Microprocessors 1 / 11

Program controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions.

CC411: Introduction To Microprocessors

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

CONTENTS. 1. Display a Message Display a one Digit Number Accept a Character from keyboard and display the character 4

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

PHY4635/5635 Spring Lecture 8: Program Control Instructions

Assembler Programming. Lecture 2

Computer Architecture and System Software Lecture 07: Assembly Language Programming

x86 Assembly Tutorial COS 318: Fall 2017

EC-333 Microprocessor and Interfacing Techniques

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

ECpE 185 Laboratory Hand Assembly Fall 2006

UNIVERSITY OF CALIFORNIA, RIVERSIDE

INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

SORTING OF AN ARRAY USING 8086 MICROPROCESSOR

16.317: Microprocessor Systems Design I Fall 2013

PESIT Bangalore South Campus

Computer Science Final Examination Wednesday December 13 th 2006

A4 Sample Solution Ch3

Babu Madhav Institute of Information Technology, UTU

Q1: Define a character string named CO_NAME containing "Internet Services" as a constant?

Lesson 1. Fundamentals of assembly language

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

Week /8086 Microprocessor Programming I

Assembler Programming. Lecture 10

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

Computer Organization & Assembly Language Programming. CSE 2312 Lecture 15 Addressing and Subroutine

Transcription:

16.317 Microprocessor I, Spring 2007 Lab 2: Assembling and executing instructions with DEBUG software Due on 03/02/2007, 12:30pm EST Reference: Walter A. Triebel and Avtar Singh, Lab Manual to Accompany the 8088 and 8086 Microprocessors, Prentice Hall, ISBN 0-13-012843-0. Objective Learn how to: 1. Assemble instructions into the memory of PC. 2. Execute an instruction to determine the operation it performs. 3. Verify the operation of data transfer and arithmetic instructions. Part 1: Practice 8086 Emulator You need to practice a 8086 Emulator, emu8086, by reproducing the examples in the text book. It is helpful to read carefully the explanations along with the examples. Specifically, you need to practice the following examples: Loading, verifying and saving machine code Example 4.24 till page 130 (page 127-130) Executing instructions and tracing programs Example 4.26 (page 136) To learn how to use emu8086 tool, please refer to the following web site. http://www.emu8086.com/assembly_language_tutorial_assembler_reference/referen ce.html Part 2: Assignment Note: You need to use emu8086 to do the following assignments. You need to show your screen print-out to the TA to check off. Make sure you re your print-out captures all the steps. Answer ALL the questions in your report. Data transfer instructions I Using emu8086 to assemble the instructions (a) MOV AX,BX (b) MOV AX,AAAA (c) MOV AX,[BX] (d) MOV AX,[4] (e) MOV AX,[BX+SI] (f) MOV AX,[SI+4] Prof. Yan Luo, UMass Lowell Page 1/6

(g) MOV AX,[BX+SI+4] Initializing the internal registers of the 80x86 as follows: (AX) = 0000H (BX) = 0001H (CX) = 0002H (DX) = 0003H (SI) = 0010H (DI) = 0020H (BP) = 0030H Verify the initialization by displaying the new content of registers Fill all memory locations in the range DS:00 through DS:1F with 00H and the initialize the word storage location that follow: (DS:0001H) = BBBBH (DS:0004H) = CCCCH (DS:0011H) = DDDDH (DS:0014H) = EEEEH (DS:0016H) = FFFFH Trace the execution of the instructions (a) through (f). Explain the execution of each instruction, including addressing mode, physical address for memory addressing mode, value in AX. Data transfer instructions II Step 6 Step 7 Step 8 Assemble the instruction MOV SI, [0ABC] to memory at address CS:100 and verify loading of the instruction. How many bytes does the instruction take up? Initialize the word of memory starting at DS:0ABC with the value FFFFH Clear the SI register, verify by displaying its content. Trace the execution. Describe the operation performed by the instruction Assemble the instruction MOV WORD PTR [SI], ABCD into memory at address CS:100 and then verify loading of the instruction. How many bytes does it take? Initialize SI register with the value 0ABCH Clear the word of memory starting at DS:0ABC Trace the execution. Describe the operation performed by the instruction Arithmetic instructions Step 6 Assemble the instruction ADC AX, [0ABC] to memory at address CS:100 and verify loading of the instruction. How many bytes does the instruction take up? Initialize the word of memory starting at DS:0ABC with the value FFFFH Initialize AX with the value 0001H. Verify by displaying register contents. Clear the carry flag Trace the execution. Describe the operation performed by the instruction Does a carry occur? Flag-control instructions Prof. Yan Luo, UMass Lowell Page 2/6

Assemble the instruction sequence LAHF MOV BH, AH AND BH, 1FH AND AH, 0E0H MOV [200H], BH SAHF Into memory at address CS:100 and then verify loading of the instruction. How many bytes do they take? Initialize the byte of memory starting at DS:200 with the value 00H Clear register AX and BX Display the current state of flags, make sure the status flags equal NG, ZR, AC, PE and CY Trace the execution. Describe the operation performed by each instruction. What value is read out of the flags register? What value is saved in memory? What value is reloaded into flags register? Compare instructions Assemble the instruction sequence MOV BX, 1111H AND AX, 0BBBBH CMP BX, AX Into memory at address CS:100 and then verify loading of the instruction. How many bytes do they take? Clear register AX and BX. Display the current state of flags Trace the execution. Describe the operation performed by each instruction. What value is read out of the flags register? What value is saved in memory? What value is reloaded into flags register? What are the status flags before and after the compare instruction was Jump instructions You need to download two files (L5P3.LST and L5P3.EXE) from the course webpage at http://faculty.uml.edu/yluo/teaching/microprocessori/umlrocks/l5p3.lst http://faculty.uml.edu/yluo/teaching/microprocessori/umlrocks/l5p3.exe Download the files in one of your file folders open the source listing in file L5P3.LST. What is the starting address offset from CS: for the first instruction (PUSH DS) and the last instruction (RET)? Load the run module L5P3.EXE with emu8086 Verify loading of the program by unassembling the contents of the current code segment for the offset range found in Prof. Yan Luo, UMass Lowell Page 3/6

Step 6 Execute the program according to the instructions that follow a. GO from address CS:00 to CS:5 b. Load the number whose factorial is to be calculated (N=3) into register DX c. Clear the memory storage location DS:0000 for the value of factorial (FACT) d. GO from address CS:5 to CS:10, what is the state of the zero flag? e. Execute from the JZ instruction with a TRACE command, Was the jump taken? f. GO from address CS:12 to CS:16, What is the current value of AL? g. Execute the JMP instruction with a TRACE command Was the jump taken? What is the address of the next instruction to be h. GO from address CS:E to CS:10. What is the state of the zero flag? i. Execute the JZ instruction with a TRACE command. Was the jump taken? j. GO from address CS:12 to CS:16, What is the current value of AL? k. Execute the JMP instruction with a TRACE command Was the jump taken? What is the address of the next instruction to be l. GO from address CS:E to CS:10. What is the state of the zero flag? m. Execute the JZ instruction with a TRACE command. Was the jump taken? n. GO from address CS:12 to CS:16, What is the current value of AL? o. Execute the JMP instruction with a TRACE command Was the jump taken? What is the address of the next instruction to be p. GO from address CS:E to CS:10. What is the state of the zero flag? q. Execute the JZ instruction with a TRACE command. Was the jump taken? What is the instruction to be executed next? r. GO to CS:1B. What is the final value in AL? At what address is the value in AL stored in memory as FACT? s. Display the value stored for FACT in memory Quit from emu8086. Subroutine instructions You need to download one file (L5P4.EXE) from the course webpage at http://faculty.uml.edu/yluo/teaching/microprocessori/umlrocks/l5p4.exe Load the file L5P4.EXE with emu8086 Verify the loading of the program by unassembling the contents of the current code segment. Execute the instructions as follows. a. Single step from address CS:00 to CS:5. What instruction is to be executed next? Prof. Yan Luo, UMass Lowell Page 4/6

b. Load the numbers that follow for use by the arithmetic subroutine. (AX) = -32 = FFE0H (BX) = 27 = 001BH (CX) = 10 = 000AH (DX) = 200 = 00C8H c. Execute the call instruction with a TRACE command. What instruction is to be executed next? d. Single step to address CS:10. What is the sum in DX? e. Check the value of the last word pushed to the stack f. Run the program to completion. What is the final value in DX? How did the contents of DX become this value? Exit emu8086. Check off Demonstrate the files you saved (in example 4.24) to the TA. Get TA s signature on the screen print-out you obtained. Attach your screen print-out to your report. Report format Your report needs to follow the format below. Lab # and title: Student Name: Partner s Name: Lab Purpose: <It is usually the objective of the lab.> Lab Content: < Answer the questions in lab specification. Describe what you do in the lab, e.g. what commands you practiced. It has to be at least one page with 11pt font size. Try to organize and summarize the lab in itemized lists.> Difficulties: < state what difficulties you encountered in the lab and how you managed to solve it. If not, what have you tried? > Conclusion and Suggestions: Prof. Yan Luo, UMass Lowell Page 5/6

Grading Student Name Student ID Lab Two Rubrics Partners can share screen capture or program print-out, however, each student MUST submit his/her own report. Duplicated reports (including both parties) are considered cheating, which result in a ZERO in the lab, reduction in letter grade for the course, grade of F for the course, and/or university administrative penalties. Item Criteria Full Points Actual Points Check off Check off with TA 40 Data transfer Print-out or screen capture of the 10 I/II Arithmetic Print-out or screen capture of the 10 Flag control Print-out or screen capture of the 10 Compare Print-out or screen capture of the 10 Jump Print-out or screen capture of the 10 Subroutine Print-out or screen capture of the 10 TOTAL 100 Prof. Yan Luo, UMass Lowell Page 6/6