Assembly Language for Intel-Based Computers, 4 th Edition Unpacked and Packed Integers (c) Pearson Education, 2002. All rights reserved. You may modify.

Slides:



Advertisements
Similar presentations
MOV Instruction MOV destination, source ; copy source to dest. MOV A,#55H ;load value 55H into reg. A MOV R0,A ;copy contents of A into R0 ;(now A=R0=55H)
Advertisements

Assembly Language for Intel-Based Computers, 4 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and.
Introduction to Computer Engineering by Richard E. Haskell BCD Arithmetic Module M16.5 Section 10.4.
Assembly Language for x86 Processors 6th Edition
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, MUL Instruction The MUL (unsigned multiply) instruction.
Gursharan Singh Tatla 21-Nov-20101www.eazynotes.com.
8086 : INSTRUCTION SET By, Pramod Sunagar Assistant Professor
Assembly Language for Intel-Based Computers Chapter 15: BIOS-Level Programming (c) Pearson Education, All rights reserved. You may modify and.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 6: Conditional Processing (c) Pearson Education, All rights reserved. You may modify.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may modify.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 5 Arithmetic and Logic Instructions.
Assembly Language for Intel-Based Computers, 4th Edition
Assembly Language for Intel-Based Computers Chapter 2: IA-32 Processor Architecture Kip Irvine.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 5: Procedures (c) Pearson Education, All rights reserved. You may modify and copy.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may modify.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
Assembly Language for Intel-Based Computers, 4 th Edition Lecture 23: Finite State Machines, WHILE operator (c) Pearson Education, All rights reserved.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may modify.
Assembly Language for Intel-Based Computers
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 3: Assembly Language Fundamentals (c) Pearson Education, All rights reserved. You.
MUL Instruction (Unsigned Multiply) Multiplies an 8-, 16-, or 32-bit operand by either AL, AX or EAX. MUL r/m8 MUL r/m16 MUL r/m32.
Assembly Language – Lab 5
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 2: IA-32 Processor Architecture (c) Pearson Education, All rights reserved. You.
The 8051 Microcontroller and Embedded Systems
Assembly Language for x86 Processors 7th Edition
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 3: Assembly Language Fundamentals Assembling, Linking and Running Programs Example Programs.
Binary Arithmetic & Data representation
Flag Control instructions CLC clear carry flag CF = 0 STC set carry flag CF= 1 CMC complement carry flag [CF] CF.
Assembly Language for x86 Processors 7 th Edition Chapter 1: Basic Concepts (c) Pearson Education, All rights reserved. You may modify and copy this.
ASCII and BCD Arithmetic Chapter 11 S. Dandamudi.
Chapter four – The 80x86 Instruction Set Principles of Microcomputers 2015年10月19日 2015年10月19日 2015年10月19日 2015年10月19日 2015年10月19日 2015年10月19日 1 Chapter.
Chapter 19 Number Systems. Irvine, Kip R. Assembly Language for Intel-Based Computers, Translating Languages English: Display the sum of A times.
Arithmetic Flags and Instructions
1 IKI10230 Pengantar Organisasi Komputer Kuliah no. 05.b: Arithmetic Operations Sumber: 1. Paul Carter, PC Assembly Language 2. Hamacher. Computer Organization,
Assembly Language for Intel-Based Computers Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may modify and copy.
CT215: Assembly Language Programming
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 4: Data Transfers, Addressing, and Arithmetic Lecture 15: ADD, SUB, NEG and how they.
ECE 353 Introduction to Microprocessor Systems Michael G. Morrow, P.E. Week 6.
Assembly Language for x86 Processors 6th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may modify and copy.
Irvine, Kip R. Assembly Language for Intel-Based Computers 6/e, Signed Integers The highest bit indicates the sign. 1 = negative, 0 = positive.
Chapter 7: Integer Arithmetic. 2 Chapter Overview Shift and Rotate Instructions Shift and Rotate Applications Multiplication and Division Instructions.
Irvine, Kip R. Assembly Language for Intel-Based Computers. Chapter 7: Integer Arithmetic Slides to Accompany Assembly Language for Intel-Based Computers,
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 7: Integer Arithmetic (c) Pearson Education, All rights reserved. You may.
Assembly Language for x86 Processors 7th Edition
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 5: Procedures Lecture 19: Procedures Procedure’s parameters (c) Pearson Education, 2002.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 13: 16-Bit MS-DOS Programming Interrupts (c) Pearson Education, All rights reserved.
ECE 353 Introduction to Microprocessor Systems Michael J. Schulte Week 6.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 2: IA-32 Processor Architecture (c) Pearson Education, All rights reserved. You.
Assembly Language for Intel-Based Computers, 4 th Edition Lecture 22: Conditional Loops (c) Pearson Education, All rights reserved. You may modify.
Assembly Language for x86 Processors 6th Edition
Data Representation Binary Numbers Binary Addition
Assembly Language for Intel-Based Computers, 5th Edition
Assembly Language for x86 Processors 7th Edition
Assembly Language for Intel-Based Computers, 5th Edition
4.2 Arithmetic Instructions
INSTRUCTION SET OF 8086 PAWAN KUMAR SINGH.
Assembly Language for Intel-Based Computers, 4th Edition
X86’s instruction sets.
Chapter 4: Instructions
Microprocessor and Assembly Language
Multiplication and Division Instructions
ADDITION Register Addition. ADD AX,BX AX=AX+BX 2. Immediate Addition.
Assembly Language for Intel-Based Computers, 4th Edition
Assembly Language for Intel-Based Computers, 4th Edition
Chapter 5 Arithmetic and Logic Instructions
Presentation transcript:

Assembly Language for Intel-Based Computers, 4 th Edition Unpacked and Packed Integers (c) Pearson Education, All rights reserved. You may modify and copy this slide show for your personal use, or for use in the classroom, as long as this copyright statement, the author's name, and the title are not changed. Chapter corrections (Web)Assembly language sources (Web)Chapter correctionsAssembly language sources Slides prepared by Kip R. Irvine Revision date: 07/11/2002 Modified 2006, Dr. Nikolay Metodiev Sirakov Kip R. Irvine

Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, ASCII and Packed Decimal Arithmetic Unpacked BCD ASCII Decimal AAA Instruction AAS Instruction AAM Instruction AAD Instruction Packed Decimal Integers DAA Instruction DAS Instruction

Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Unpacked BCD Binary-coded decimal (BCD) numbers use 4 binary bits to represent each decimal digit A number using unpacked BCD representation stores a decimal digit in the lower four bits of each byte For example, 5,678 is stored as the following sequence of hexadecimal bytes:

Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, ASCII Decimal A number using ASCII Decimal representation stores a single ASCII digit in each byte For example, 5,678 is stored as the following sequence of hexadecimal bytes:

Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, AAA Instruction The AAA (ASCII adjust after addition) instruction adjusts the binary result of an ADD or ADC instruction. It makes the result in AL consistent with ASCII digit representation. The Carry value, if any ends up in AH Example: Add '8' and '2' mov ah,0 mov al,'8'; AX = 0038h add al,'2'; AX = 006Ah aaa; AX = 0100h (adjust result) or ax,3030h; AX = 3130h = '10'

Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, AAS Instruction The AAS (ASCII adjust after subtraction) instruction adjusts the binary result of an SUB or SBB instruction. It makes the result in AL consistent with ASCII digit representation. It places the Carry value, if any, in AH Example: Subtract '9' from '8' mov ah,0 mov al,'8'; AX = 0038h sub al,'9'; AX = 00FFh aas; AX = FF09h (adjust result) pushf; save Carry flag or al,30h; AX = FF39h (AL = '9') popf; restore Carry flag

Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, AAM Instruction The AAM (ASCII adjust after multiplication) instruction adjusts the binary result of a MUL instruction. The multiplication must have been performed on unpacked decimal numbers. mov bl,05h; first operand mov al,06h; second operand mul bl ; AX = 001Eh aam; AX = 0300h

Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, AAD Instruction The AAD (ASCII adjust before division) instruction adjusts the unpacked decimal dividend in AX before a division operation.data quotient BYTE ? remainder BYTE ?.code mov ax,0307h ; dividend aad ; AX = 0025h mov bl,5 ; divisor div bl ; AX = 0207h mov quotient,al mov remainder,ah

Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Packed Decimal Integers Packed BCD stores two decimal digits per byte For example, 12,345,678 can be stored as the following sequence of hexadecimal bytes: There is no limit on the number of bytes you can use to store a BCD number. Financial values are frequently stored in BCD format, to permit high precision when performing calculations.

Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, DAA Instruction The DAA (decimal adjust after addition) instruction converts the binary result of an ADD or ADC operation to packed decimal format. The value to be adjusted must be in AL Example: calculate BCD mov al,35h add al,48h ; AL = 7Dh daa ; AL = 83h (adjusted)

Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, DAS Instruction The DAS (decimal adjust after subtraction) instruction converts the binary result of a SUB or SBB operation to packed decimal format. The value must be in AL Example: subtract BCD 48 from 85 mov al,85h sub al,48h; AL = 3Dh das ; AL = 37h (adjusted)

Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, The End