Multiplication and Division

Slides:



Advertisements
Similar presentations
Program.(08) Write a program Divide 5 by 2 and display answer value and remainder value. 1 Store 5 into AL 2 Store BL into 2 3Divide AL Into BL 4Store.
Advertisements

DOS and BIOS Interrupts DOS and BIOS interrupts are used to perform some very useful functions, such as displaying data to the monitor, reading data from.
Introduction to Computer Engineering by Richard E. Haskell BCD Arithmetic Module M16.5 Section 10.4.
COMP 2003: Assembly Language and Digital Logic
Introduction to Computer Engineering by Richard E. Haskell Multiplication and Division Instructions Module M16.4 Section 10.4.
NEG Instruction Change operand content into two’s complement (negative value) and stored back into its operand mov bl, b neg bl; bl = mov.
Writing and reading files. Creating a file on a disk Get a file handle from system Use INT 21H function 3C to create a directory entry for the file Use.
Department of Computer Science and Software Engineering
Assembly Language Lecture 9
1 Multiplication, Division, and Numerical Conversions Chapter 6.
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, MUL Instruction The MUL (unsigned multiply) instruction.
Stack Memory H H FFFFF H FFFFE H SS 0105 SP 0008 TOS BOS BOS = FFFF = 1104F H H 1104F H.
The 8086 Assembly Programming Data Allocation & Addressing Modes
Assembly 02. Outline mov Command Registers Memory EFLAGS Arithmetic 1.
Shift and Rotate Instructions
Chapter 4 Basic Instructions. 4.1 Copying Data mov Instructions mov (“move”) instructions are really copy instructions, like simple assignment statements.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#8) By Dr. Syed Noman.
Program.-(4)* Write a program for input two integer number with message and display their sum. Algorithm steps Algorithm steps 1.Display message for input.
Assembly Language – Lab 5
Khaled A. Al-Utaibi  Introduction  Arithmetic Instructions  Basic Logical Instructions  Shift Instructions  Rotate Instructions.
1/2002JNM1 Positional Notation (Hex Digits). 1/2002JNM2 Problem The 8086 has a 20-bit address bus. Therefore, it can access 1,048,576 bytes of memory.
Flag Control instructions CLC clear carry flag CF = 0 STC set carry flag CF= 1 CMC complement carry flag [CF] CF.
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,
Types of Registers (8086 Microprocessor Based)
ASCII and BCD Arithmetic Chapter 11 S. Dandamudi.
Microprocessors Monday, Apr. 13 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
The x86 PC Assembly Language, Design, and Interfacing By Muhammad Ali Mazidi, Janice Gillespie Mazidi and Danny Causey © 2010, 2003, 2000, 1998 Pearson.
Arithmetic Flags and Instructions
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 4 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Assembly Language for Intel-Based Computers Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may modify and copy.
Click to add Title Comunicación y Gerencia Click To add Subtitle Click to add Text Fundamentals of Assembly Language.
10H Interrupt. Option 0H – Sets video mode. Registers used: – AH = 0H – AL = Video Mode. 3H - CGA Color text of 80X25 7H - Monochrome text of 80X25 Ex:
Review of Assembly language. Recalling main concepts.
The Assemble, Unassemble commands of the debugger: U Command for converting machine code language source Equivalent machine code instructions Equivalent.
Introduction Arithmetic instructions are used to perform arithmetic operation such as Addition Subtraction Multiplication Division These operations can.
Microprocessor & Assembly Language Arithmetic and logical Instructions.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Multiplication and Division instructions Dr.Hadi AL Saadi.
Addressing Modes Instruction – Op-code – Operand Addressing mode indicates a way of locating data or operands. – Any instruction may belong to one or more.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Instruction set Architecture
Format of Assembly language
Microprocessor Systems Design I
Multiplication and Division Instructions
CS-401 Computer Architecture & Assembly Language Programming
Microprocessor Lab CSL1543 0:0:2
4.2 Arithmetic Instructions
INSTRUCTION SET OF 8086 PAWAN KUMAR SINGH.
Arithmetic Instructions
Defining Types of data expression Dn [name] expression Dn [name]
X86’s instruction sets.
Introduction to Assembly Language
Chapter 4: Instructions
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Microprocessor and Assembly Language
8086 Registers Module M14.2 Sections 9.2, 10.1.
اصول اساسی برنامه نویسی به زبان اسمبلی
Symbolic Instruction and Addressing
Multiplication and Division Instructions
Symbolic Instruction and Addressing
EECE.3170 Microprocessor Systems Design I
UNIT-II Assembly Language Programs Involving Logical
Chapter 6 –Symbolic Instruction and Addressing
Multiplication and Division Instructions
Multiplication and Division Instructions
CS-401 Computer Architecture and Assembly Language Programming
Chapter 8: Instruction Set 8086 CPU Architecture
Division instruction.
Presentation transcript:

Multiplication and Division Assembly Language

Multiplication Use of AX and DX is necessary Byte × Byte Word × Word Word × Byte

Byte × Byte One of the operand must be in AL Second can be register/memory Result in AX Example-1 MOV AL, 25H MOV BL, 65H MUL BL MOV myresult, AX

Example-2 MOV AL, DATA1 MUL DATA2 MOV myresult, AX

Word × Word One of the operand must be in AX Second can be register/memory Result in DXAX Example-1 DATA3 DW 2387H DATA4 DW 2F79H result 1 DW 2DUP(?) MOV AX, DATA3 MUL DATA4 MOV RESULT1, AX ;store lower result MOV RESULT1+2, DX ;store higher result

Word × Byte Similar to word × word AL contains the byte operand AH must be zero DATA5 DB 6BH DATA6 DW 12C3H Result3 DW 2DUP(?) MOV AL,DATA5 SUB AH,AH MUL DATA6 MOV [BX], offset result3 MOV [BX], AX MOV [BX]+2, DX

Unsigned Multiplication Summary Operand 1 Operand 2 Result Byte x byte AL Reg/memory AX Word x word DX:AX Word x byte AL=byte, AH=0

Unsigned Division Summary Multiplication Numerator Denominator Quotient Remainder Byte / byte AL=byet, AH=0 Reg/memory AL AH Word / word AX=word,DX=0 AX DX Word / byte AX=word Double word/word DXAX= double word

Byte/Byte Denominator can not be immediate Example-1 MOV AL,DATA SUB AH,AH DIV 10 MOV AL, DATA1 DIV DATA2 MOV quot, AL MOV remain, AH

Word/Word MOV AX,10050 SUB DX,DX MOV BX,100 DIV BX MOV quot, AX MOV remain,DX

Word/Byte MOV AX, 2055 MOV CL, 100 DIV CL MOV quot, AL MOV remain, AH