Microprocessor Lab CSL1543 0:0:2

Slides:



Advertisements
Similar presentations
There are two types of addressing schemes:
Advertisements

Assembly Programming Notes for Practical2 Munaf Sheikh
Department of Computer Science and Software Engineering
MASM CODEVIEW TUTORIALS
The 8086 Assembly Programming Data Allocation & Addressing Modes
Assembly 02. Outline mov Command Registers Memory EFLAGS Arithmetic 1.
Multiplication and Division
Assembly Language – Lab 5
Chapter 2 Software Tools and Assembly Language Syntax.
1/2002JNM Edit, Assemble, Link & Debug. 1/2002JNM Files Created.
ICS312 Set 4 Program Structure. Outline for a SMALL Model Program Note the quiz at the next lecture will be to reproduce this slide.MODEL SMALL.586 ;
Chapter 1: Basic Concepts
PC-technology MASM and Inline Code in C. PC-Teknik © CAAK2 MASM and Inline Code in C Some things to think about –Which size has the register you use AX,
Debug and Assembler By, B.R.Chandavarkar Lect. COMP Department NITK, Surathkal.
Introduction to 8086 Assembly Language Assembly Language Programming University of Akron Dr. Tim Margush.
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 4 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Click to add Title Comunicación y Gerencia Click To add Subtitle Click to add Text Fundamentals of Assembly Language.
Assembly Programming Notes for Practical 1
Assembly Language programming
In Class Program Write, assemble and test a program: –Use the DB directive to define the following list of numbers and name it array: 31h, 32h, 33h, 34h.
Review of Assembly language. Recalling main concepts.
Microprocessor & Assembly Language Arithmetic and logical Instructions.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
1 Chapter 1: Introduction Appendix A: Binary and Hexadecimal Tutorial Assembly Language for Intel-Based Computers, 3rd edition Kip R. Irvine.
Assembly language programming
Instruction set Architecture
Format of Assembly language
Assembly Language programming
Additional Assembly Programming Concepts
ADDRESSING MODES.
16.317: Microprocessor System Design I
Microprocessor and Assembly Language
EEM336 Microprocessors Laboratory Orientation
Microprocessor and Assembly Language
Assembly Language Programming Part 2
ADDRESSING MODES.
CS-401 Computer Architecture & Assembly Language Programming
(The Stack and Procedures)
Arithmetic Instructions
Defining Types of data expression Dn [name] expression Dn [name]
Symbolic Instruction and Addressing
Introduction to Assembly Language
Chapter 4: Instructions
BIC 10503: COMPUTER ARCHITECTURE
Assembly Programming Notes for Practical 1 1.
Microprocessor and Assembly Language
Microprocessor Lab CSL1543 0:0:2
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
(Array and Addressing Modes)
(The Stack and Procedures)
Microprocessor Lab CSL1543 0:0:2
Symbolic Instruction and Addressing
(Array and Addressing Modes)
CSC235 - Visual Studio Tutorial
CNET 315 Microprocessor & Assembly Language
INTRODUCTION ABOUT ASSEMBLY
University of Gujrat Department of Computer Science
University of Gujrat Department of Computer Science
Microprocessor and Assembly Language
Scripts In Matlab.
Assembler Directives end label end of program, label is entry point
Computer Architecture and System Programming Laboratory
Chapter 6 –Symbolic Instruction and Addressing
(The Stack and Procedures)
Chapter 8: Instruction Set 8086 CPU Architecture
Introduction to 8086 Assembly Language
Computer Architecture and System Programming Laboratory
(Array and Addressing Modes)
Presentation transcript:

Microprocessor Lab CSL1543 0:0:2 Week 1 : Introduction

Steps for Executing an ALP An assembly language program(ALP) has to be executed after these steps. (a) Creation of the source file. (b) Assembling the source file into object file. (c) Linking the object file to create executable. Department of CSE, MSRIT

Steps for Executing an ALP Creation of the source file: Edit the program using a text editor. MS-DOS includes such an editor. type EDIT at the DOS prompt. Once the DOS editor is open, the program can be typed and saved. It is absolutely necessary that this file be saved with an .ASM extension. Eg: firstprog.ASM This tells the assembler that such a file is an assembly language source program. Department of CSE, MSRIT

Steps for Executing an ALP (b) Assembling the source file into object file: MASM(Microsoft Macro Assembler) is used. To assemble a source file, the following command has to be given (at the DOS prompt). MASM/ZI firstprog.ASM where firstprog is the name of the source file. This command uses the option ZI. There now exists a file named firstprog.OBJ, where firstprog is the name of the source file and .OBJ tells that this is an Object file. Department of CSE, MSRIT

Steps for Executing an ALP (c) Linking the object file to create executable: The last is the linking which is used to create an executable file from the object file. The executable file is the one that can be run. The linking is done by typing (at DOS prompt) LINK/CO firstprog.OBJ where firstprog is the name of the source file. This command uses CO as an option. Department of CSE, MSRIT

Steps for Executing an ALP Now we have an executable file myfile.exe which can be run or executed in any of the following three ways: (i) Directly run the executable file at DOS prompt. (ii) Run the executable file using the debug tool. (iii) Run the executable file using the CV tool. Department of CSE, MSRIT

Steps for Executing an ALP (b) Run the executable file using the debug tool: This method enables to execute the program one instruction at a time. After each instruction has been executed, we can view memory/register contents or continue execution. Type DEBUG firstprog.exe to start. To execute an instruction press F10 key this executes the next instruction and pauses. At the left edge of the screen, you see a > symbol with the cursor blinking next to it. Type the following ?location: where location is either a register name (AX ,BX ,etc) or a memory location that you have defined (VALUE 1 , RESULT etc). will display the memory contents or register data Department of CSE, MSRIT

Steps for Executing an ALP c)Using the CV tool: This tool is the most effective to use while executing the program CV stands for CodeView. Type CV firstprog where firstprog is the name of the source file . This will open the CodeView tool. A listing of source file along with line numbers can be seen. Pressing F1O will execute one instruction at a time (single stepping). A window at the right hand side appears showing the contents of each register as the execution progresses. Pressing the F5 key will run the program all at once till the last instruction. At the bottom a short window appears with the > symbol. Here D commands can be typed to view the memory dump, memory locations and watches etc. For a complete set of commands the help section can be consulted. Department of CSE, MSRIT

Steps for Executing an ALP Department of CSE, MSRIT

8086 Register set Department of CSE, MSRIT

Assembler Directives .DATA directive This directive is used to define data segment necessary for our program. Data can be of different types like byte, word, double word or quad They can be declared using directives as follows: DB – Define Byte DW – Define Word DD – Define Double Word DQ – Define Quad Word DT – Define Ten Bytes Department of CSE, MSRIT

MOV Instruction MOV REG, memory memory, REG REG, REG memory, immediate REG, immediate SREG, memory memory, SREG REG, SREG SREG, REG Copy operand2 to operand1. Algorithm: operand1 = operand2 Ex: Mov AX,BX ;Copy contents of BX to AX Mov si,00h ;load Si with 00h Department of CSE, MSRIT

ADD Instruction ADD REG, memory memory, REG REG, REG memory, immediate REG, immediate Algorithm: operand1 = operand1 + operand2 Department of CSE, MSRIT

SUB Instruction SUB REG, memory memory, REG REG, REG memory, immediate REG, immediate Algorithm: operand1 = operand1 - operand2 Department of CSE, MSRIT

MUL Instruction MUL REG / Memory Unsigned multiply. Multiply the contents of REG/Memory with contents of AL register. Algorithm: When operand is a byte: AX = AL * operand. When operand is a word: (DX: AX) = AX * operand Department of CSE, MSRIT

DIV Instruction DIV REG / Memory Unsigned divide. Algorithm:   DIV  REG / Memory Unsigned divide. Algorithm: when operand is a byte: AL = AX / operand AH = remainder (modulus) when operand is a word: AX = (DX AX) / operand DX = remainder (modulus) Department of CSE, MSRIT

Program to add 2 16-bit numbers .MODEL SMALL .DATA N1 DW 0009H N2 DW 0002H RES DW 4 DUP (0) .CODE START: MOV AX, @DATA MOV DS, AX MOV AX, N1 MOV BX, N2 MOV DX, 0000H ADD AX, BX JNC LAB1 INC DX LAB1: MOV RES, AX MOV RES+2, DX MOV AH, 04CH INT 21H END START Department of CSE, MSRIT