FACULTY OF ENGINEERING LAB SHEET

Similar documents
FACULTY OF ENGINEERING LAB SHEET

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

Experiment 3 3 Basic Input Output

ADVANCE MICROPROCESSOR & INTERFACING

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

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

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

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

Experiment N o 8. String Handling Instructions

Computer Organization and Assembly Language CSC-210

EEM336 Microprocessors I. Data Movement Instructions

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

Experiment #5. Using BIOS Services and DOS functions Part 1: Text-based Graphics

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

Chapter 3: Addressing Modes

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

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

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

Experiment #2. Addressing Modes and Data Transfer using TASM

EC 333 Microprocessor and Interfacing Techniques (3+1)

8086 programming Control Flow Instructions and Program Structures

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.

Intel 8086: Instruction Set

THE UNIVERSITY OF TRINIDAD & TOBAGO

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

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

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

8086 INSTRUCTION SET

ORG ; TWO. Assembly Language Programming

LABORATORY WORK NO. 8 WORKING WITH MACROS AND LIBRARIES

LAB 3: Programming in Assembly Language

INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

PESIT Bangalore South Campus

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

Programming in Assembler. Laboratory manual. Exercise 3

Computer Architecture 1 ح 303

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

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

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

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

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

EEM336 Microprocessors I. Addressing Modes

CS-202 Microprocessor and Assembly Language

Computer Architecture and System Software Lecture 06: Assembly Language Programming

Code segment Stack segment

Lesson 1. Fundamentals of assembly language

TUTORIAL. Emulador Emu8086 do. Microprocessador 8086

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

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

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

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

INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

UNIT 4. Modular Programming

IBM PC Hardware CPU 8088, Pentium... ALU (Arithmetic and Logic Unit) Registers. CU (Control Unit) IP.

9/25/ Software & Hardware Architecture

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

Babu Madhav Institute of Information Technology, UTU

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

Philadelphia University Student Name: Student Number:

Computer Architecture and System Software Lecture 04: Floating Points & Intro to Assembly

LABORATORY 1: EXPLORING THE SOFTWARE ARCHITECTURE OF THE MICROPROCESSOR

Lab 2: Introduction to Assembly Language Programming

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

Week /8086 Microprocessor Programming I

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

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

EC 333 Microprocessor and Interfacing Techniques (3+1)

Arithmetic Instructions

Intel x86 instruction set architecture

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

1. Introduction to Assembly Language

Computer Architecture and System Software Lecture 07: Assembly Language Programming

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

EXPERIMENT NINE DEVELOPING MACRO SEQUENCES

Lecture (08) x86 programming 7

Experiment 8 8 Subroutine Handling Instructions and Macros

Signed number Arithmetic. Negative number is represented as

SORTING OF AN ARRAY USING 8086 MICROPROCESSOR

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

Basic Execution Environment

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

US06CCSC04: Introduction to Microprocessors and Assembly Language UNIT 3: Assembly Language Instructions II

Chapter 4: Data Movement Instructions. 4 1 MOV Revisited

UNIVERSITY OF CALIFORNIA, RIVERSIDE

Hands on Experience for Faculty in Laboratories Phase I JNTUK, Kakinada

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

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

Data Movement Instructions

Assembly Language Lab #5

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

COMPUTER ENGINEERING DEPARTMENT

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

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

EC-333 Microprocessor and Interfacing Techniques

EE2007 Microprocessor systems.

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

Philadelphia University Student Name: Student Number:

Summer 2003 Lecture 4 06/14/03

The registers(di,si) are automatically incremented or decremented depending on the value of the direction flag:

String Processing. Chapter 9 S. Dandamudi

Transcription:

FACULTY OF ENGINEERING LAB SHEET ADVANCED MICROPROCESSORS ECE TRIMESTER (0/0) AM: Real- Mode Programming AM: Protected- Mode Programming *Note: On-the-spot evaluation may be carried out during or at the end of the experiment. Students are advised to read through this lab sheet before doing experiment. Your performance, teamwork effort, and learning attitude will count towards the marks.

AM: Real-Mode Programming ECE: Advanced Microprocessors Time: hours Components: Lab Exercises and Assessment Objective: To identify the x assembly instructions for arithmetic operations, program flow control and string operations, To examine the basic assembly instructions in real-mode programming of x processors. To analyze real-mode assembly programs using EMU0 emulator. To develop real-mode assembly programs for arithmetic operations.. Introduction The Intel 0, was a -bit microprocessor introduced by Intel in 9. As the original implementation of the -bit extensions to the 0 architecture, the 0 instruction set, programming model, and binary encodings are still the common denominator for all -bit x processors. This is termed x, IA-, or the i- architecture. The 0 could correctly execute most code intended for earlier -bit x processors such as the 0 and 0 that were ubiquitous in early PCs. Following the same tradition, modern -bit x processors are able to run most programs written for older processors, all the way back to the -bit 0. The 0 featured three operating modes: real mode, protected mode and virtual mode. The protected mode which debuted in the was extended to allow the to address up to GB of memory. The all new virtual 0 mode (or VM) made it possible to run one or more real mode programs in a protected environment, although some programs were not compatible. In this experiment, we will study the real-mode operation of the x processor via a software emulator known as EMU0. Real mode is characterized by a 0-bit segmented memory address space (giving just over MB of addressable memory) and unlimited direct software access to all memory and I/O addresses and peripheral hardware. Nevertheless, real mode provides no support for memory protection, multitasking, or code privilege levels. This experiment is divided into four parts. The first part introduces the arithmetic instructions available under the real-mode operation. The second part focuses on the control flow instructions. Next, the string processing instructions are examined in the third part. The last part involves an assessment to evaluate students understanding of the instructions that have been discussed in this lab session. Throughout the experiment, students should refer to the documentation and tutorials available via EMU0 to learn about the x assembly instructions as well as the emulator itself. Page of

. Experiment ECE: Advanced Microprocessors Experiment. In this part, we will identify the x arithmetic instructions and examine a program which will perform the following arithmetic operations: * 0 9 0 0 0 0 0. Launch the EMU0 emulator. Choose New and specify COM template.. Using the assembler editor, enter the following codes:. Start emulation by clicking the emulate button on the toolbar. A new emulator window will appear.. Single-step the program codes by pressing the single step button on the toolbar of the emulator window, check and record down the contents of AX and BX registers in Table. for the corresponding instruction.. Repeat step () above for each instruction to complete Table.. Experiment. In this example, we will develop a program to perform the following arithmetic operations: -9 0 * ( 0 0 ) + 0 0. Develop an assembly language program to perform the above arithmetic operations (record down the program in Table.).. Use only registers AL and BL for multiplication as well as the arithmetic instructions before multiplication.. Use AX and/or BX after the multiplication.. Enter the program into the assembler editor in EMU0. Emulate the program by pressing the emulate button on the toolbar.. In the emulator window, single-step the program codes by pressing the single step button on the toolbar.. Each time after single-stepping, observe and record down the contents of AX and BX registers in Table.. [Note: Use IMUL for multiplication of signed numbers] Page of

ECE: Advanced Microprocessors Experiment. In this experiment, we will program the trainer to continuously write AH to the memory locations starting from DS:000H to DS:00FH. In this case, the same instructions will be repeated and the CMP and JNE instructions are used to check whether the stopping criterion is encountered (i.e. until AH has been written into memory location at DS:00FH ).. Enter the following program codes into the assembler editor of EMU0.. Emulate the program by pressing the emulate button on the toolbar.. In the emulator window, select view memory on the pull down menu. A Random Access Memory window will pop out.. Type DS:000 in the address field, click the update button and observe the memory contents shown in the Random Access Memory window.. Press the run button to execute the program and observe the memory contents shown on the Random Access Memory.. Once the program has been executed, a dialog box will pop out, stating that PROGRAM HAS RETURNED CONTROL TO THE OPERATING SYSTEM.. Close the dialog box by pressing the OK button.. Answer the questions for Experiment. in the Answer Sheet. Experiment. In this experiment, we will write a program to store a series of 0 ascending data at memory location starting from DS:000H. In this case, 0 will be written into memory location at DS:000H, 0 will be written into DS:00H, 0 will be written into DS:00H, so on and so forth. In this case, the LOOP instruction is used to monitor the stopping criterion (i.e. 0 data have been written).. Enter the following program codes into the assembler editor of EMU0. 9. Emulate the program by pressing the emulate button on the toolbar. Page of

ECE: Advanced Microprocessors. In the emulator window, invoke the Random Access Memory window by following Step in Experiment... Type DS:000 in the address field and click the update button.. Press the run button in the emulator window to execute the program and observe the memory contents shown in the Random Access Memory window.. Answer the questions for Experiment. in the Answer Sheet. Experiment The x microprocessors are equipped with special instructions to handle string operations. In this experiment, we will explore the use of string processing instruction in real-mode operation. The program below will prompt the user to enter a -digit passcode. The user passcode is then compared with the preset passcode. If the passcodes are not the same, the program will ask the user for another passcode. This will be repeated until the user has entered the matching passcode. In this case, the compare string instruction (CMPSB) is used to compare the elements of both passcodes (strings) in order to determine whether they are the same or different.. Enter the following program codes into the assembler editor of EMU0. INCLUDE EMU0.INC GETC MACRO P ; define a user macro MOV AH, INT H MOV [P], AL ENDM 9 0 9 0 ORG 00H START: PRINT 'ENTER PASSCODE: ' MOV CX, ; characters LEA DI, USERCODE ; load address (offset) of USERCODE to DI RPT: GETC DI ; get a character & store at [DI] INC DI ; increment DI to next address PUTC '*' ; print an * LOOP RPT ; decrement CX & jump to RPT if CX 0 PUTC 0AH ; print a new line character PUTC 0DH ; print a carriage return character MOV CX, ; compare characters MOV AX, DS ; AX=DS MOV ES, AX ; ES=AX=DS LEA SI, PASSCODE ; load address (offset) of PASSCODE to SI LEA DI, USERCODE ; load address (offset) of USERCODE to DI REPE CMPSB ; repeat until CX=0 or USERCODE PASSCODE JE EXIT ; if USERCODE=PASSCODE, jump to EXIT PRINTN 'WRONG PASSCODE!' ; else print error message JMP START ; jump to START EXIT: PRINTN 'CORRECT PASSCODE.' RET 9 PASSCODE DB '' USERCODE DB DUP (?) ; preset passcode ; user passcode (reserve bytes) Page of

ECE: Advanced Microprocessors. Emulate the program by pressing the emulate button on the toolbar.. In the emulator window, select view variables on the pull down menu. A variables window will pop out.. Two variables (PASSCODE and USERCODE) will be shown in the variables window.. For each of these variables, change the elements to and show as to ascii.. Press the run button in the emulator window to execute the program.. An emulator screen window will pop out.. Enter a passcode and observe the USERCODE variable shown in the variables window. (Hints: enter a wrong passcode first before entering the correct passcode) 9. Answer the questions for Experiment in the Answer Sheet.. References. Wikipedia. (00). Intel 0 [Online]. Available: http://en.wikipedia.org/wiki/0. Walter A. Triebel, "The 0, 0, and Pentium Microprocessor: Hardware, Software, and Interfacing", Prentice-Hall.. EMU0 Documentation and Tutorials. Important Note: Lab Assessment will be carried out during the lab session. It is the student's responsibility to complete the given tasks and report to the lab instructors for assessment. (End) Page of

ECE: Advanced Microprocessor Marking Scheme for AM Experiment.. Complete the following table: Table. Instruction AX BX. Using a calculator, calculate the answer for the above arithmetic operations: Is it the same as the final answer in the AX register?.. [ marks] Experiment.. Complete the following table: Table. Instruction AX BX. Using a calculator, calculate the answer for the above arithmetic operations: Is it the same as the final answer in the AX register?.. If Line of the program codes is changed from IMUL BL to MUL BL, what is the final answer in the AX register?. Is it correct? Why? [ marks] Experiment. Experiment. Experiment [9 marks] [ marks] [0 marks] Page of