SlideShare una empresa de Scribd logo
1 de 30
ASCII ADJUST AND
DECIMAL ADJUST




                   1
INSTRUCTIONS
   AAA - ASCII Adjust After Addition
   AAS - ASCII Adjust After Subtraction
   AAM - ASCII Adjust After Multiply
   AAD - ASCII Adjust Before Division
   DAA - Decimal Adjust for Addition
   DAS - Decimal Adjust for Subtraction



                                           2
INTRODUCTION
The PC supports BCD format,
Uses of BCD
   1)No loss of precision
   2)Simpler to perform arithmetic
   operation on small values from keyboard
BCD can be stored in two way:
   Unpacked BCD
   Packed BCD
                                             3
Unpacked BCD Data
Unpacked BCD representation contains only
One decimal digit per byte. The digit is
stored in the least significant 4 bits; the
most significant 4 bits are not relevant to
the value of the represented number.

Example: Representing 1527
              01 05 02 07h

                                              4
Packed BCD Data
Packed BCD representation packs two
Decimal digits into a single byte.

Example: Representing 1527
                   15 27h




                                      5
ASCII Adjust After Addition
  Adjusts the result of the addition of two
unpacked BCD values to create a unpacked
BCD result.

Operation 1:
In AL
If rightmost nibble is >9 (ie)A to F
         Or AuxilaryFlag=1
ADD 6 to rightmost nibble
                                              6
Operation 2:
Clear left nibble form AL.

Operation 3:
In AH
ADD 1

Operation 4:
Set Carry and AuxilaryCarry
                              7
.model small
.data
   b1 dw 38h
   b2 dw 34h
.code
   mov ax,@data
   mov ds,ax
   mov ax,b1   ;moving unpacked BCD into ax
   mov bx,b2   ;moving unpacked BCD into bx
   add ax,bx
   aaa         ;adjusting unpacked BCD after addition
   or ax,3030h
   end


                                                        8
ASCII Adjust After Subtraction
  Adjusts the result of the subtraction of two
unpacked BCD values to create a unpacked BCD
result.

Operation 1:
  a)AAS checks the rightmost nibble in AL
  b)If rightmost nibble is >9 (ie)A to F
         Or AuxilaryFlag=1
  c)Then Subtract 6 from rightmost nibble

                                                 9
Operation 2:
Clear left nibble in AL.

Operation 3:
Subtracts 1 from AH

Operation 4:
Set Carry and AuxilaryCarry

                              10
Example :
d1 contains 34h , d2 contains 38h of byte
  type
                  Ax            AF
Mov AL, d1 ;        0034
Sub AL, d2;           00fc           1
AAS ;               ff06            1
  since the rightmost digit of AL is c ,
  subtract 6 from AL
 Subtract 1 from ah, set AF and CF flags

 The answer is -4, is ff06 in 10’s

  complement                                11
.model small
.data
b1 dw 38h
b2 dw 34h
.code
mov ax,@data
mov ds,ax
mov ax,b1      ;moving unpacked BCD into ax
mov bx,b2      ;moving unpacked BCD into bx
sub ax,bx
aas            ;adjusting unpacked BCD after subtraction
or ax,3030h
end


                                                           12
ASCII Adjust After Multiplication
    For multiplication and Division of ASCII
    numbers require that the numbers first be
    converted into unpacked BCD format.
    Before Multiplication First clear the leftmost
    nibble in each Byte.
   After Multiplication
   AAM performs the following operations
        1) Divides AL value by 10 (0AH)
        2) Stores Quotient in AH
        3) Store Remainder in AL
                                                      13
Example:
AL contains 35H and CL contains 39H
Instruction    comment          AX     CL
and CL, 0Fh; Convert CL to 09    0035 39
and AL,0Fh; Convert AL to 05     0005 09
mul CL;      Multiply AL by CL   002D
AAM ;        Convert to unpacked 0405
              BCD
Or AX,3030h; covert to ASCII      3435


                                            14
   Mul operation generates 45 (002Dh) in
    AX

   AAM divides this value by 10, so quotient
    of 04 in AH and remainder of 05 in AL

   OR instruction converts the unpacked
    BCD to
    ASCII format
                                                15
.model small
.data
b1 dw 39h ; 9 in ASCII Format
b2 dw 35h ; 5 in ASCII Format
.code
mov ax,@data
mov ds,ax
mov ax,b1 ;AX=0039h
and AL,0fh ;AX=0009h
mov bx,b2 ;BX=0035h
and bl,0fh ;BX=0005h
mul bx      ;AX=002Dh
aam
or ax,3030h
end

                                16
ASCII Adjust Before Division
   AAD allows for a 2-Byte Dividend in AX. The
    divisor can be only a single Byte(0-9)
    Before Division First clear the leftmost nibble in
    each Byte.
   Operations done by AAD instruction
           1) AAD multiplies the AH by 10(0Ah).
           2) Then adds the product to AL and clears
    the AH
   After AAD , division is performed.


                                                          17
Example:
AX contains 3238 (28) - Dividend
CL contains 37 (07) – Divisor
Instruction      comment             AX   CL
and CL,0Fh;     convert to unpacked 3238 07
                 BCD
and AX,0F0Fh; convert to unpacked 0208 07
                 BCD
AAD;             convert to binary  001C
div CL;          divide by 7        0004

                                               18
   AAD multiplies the AH by 10(0Ah)
   Adds the product 20(14h) to the AL and
    clears
     the AH
    The result is 001Ch, is hex
    representation of decimal 28
    Then division is performed.
    Remainder stored in AH, Quotient stored
    in AL

                                               19
model small
.data
b1 dw 3238h ; 28 in ASCII Format
b2 db 37h ; 7 in ASCII Format
.code
mov ax,@data
mov ds,ax
mov ax,b1 ;AX=3238h
and ax,0f0fh ;AX=0208h
mov cl,b2 ;CL=37h
and cl,0fh ;CL=07h
aad ; AX= 001c
div cl ; AX=0004
or ax,3030h; AX=3034
end

                                   20
Decimal Adjust
  To adjust the result of packed BCD
numbers which stored in AL.

DAA - Decimal Adjust for Addition
DAS - Decimal Adjust for Subtraction




                                       21
Decimal Adjust for Addition
DAA performs the following operations:
 Operation 1:
If AL is >9 (ie) A to F
 or AuxilaryCarry=1 then
ADD 6 to AL
Set AuxilaryCarry=1


                                         22
Operation 2:
If AL contains value > 99
    or Carry=1 then
ADD 60 to AL and set Carry =1

   Otherwise
AuxilaryCarry=0 ,carry=0

                                23
AL contains   45h
BL contains   45h
Instruction   Comment             AL
ADD AL,BL     ; AL=AL+BL             8Ah
DAA           ; Adjust packed BCD   90h
                addition


                                           24
   DAA checks the rightmost nibble of AL, it
    is A so add 6 to AL
    Now AL = 90




                                                25
.model small
.data
    d1 dw 45h ;moving 45 as packed BCD
    d2 dw 45h ;moving 45 as packed BCD
.code
    mov ax,@data
    mov ds,ax
    mov ax,d1
    mov bx,d2
    add ax,bx
    daa       ;adjusting the packed BCD after addition
    end




                                                         26
Decimal Adjust for Subtraction
Operations performed by DAS :
If AL is >9 (ie) A to F
      or AuxilaryCarry=1 then
Subtract 6 from AL
Set Carry=1

Otherwise
AuxilaryCarry=0 ,carry=0


                                  27
AL contains 80h
BL contains 49h
Instruction  Comment            AL
SUB AL,BL ; AL=AL-BL               37h
DAS           ; Adjust packed BCD   31h
              Subtraction


                                      28
.model small
.data
    d1 dw 57h
    d2 dw 48h
.code
    mov ax,@data
    mov ds,ax
    mov ax,d1 ;moving 45 as packed BCD
    mov bx,d2 ;moving 45 as packed BCD
    sub ax,bx
    das       ; adjusting the packed BCD after subraction
    end



                                                            29
THANK U


          30

Más contenido relacionado

La actualidad más candente

Chapter 6 Flow control Instructions
Chapter 6 Flow control InstructionsChapter 6 Flow control Instructions
Chapter 6 Flow control Instructionswarda aziz
 
Assembly language 8086
Assembly language 8086Assembly language 8086
Assembly language 8086John Cutajar
 
Representation of numbers and characters
Representation of numbers and charactersRepresentation of numbers and characters
Representation of numbers and characterswarda aziz
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 80869840596838
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-pptjemimajerome
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086saurav kumar
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...Bilal Amjad
 
Text Mode Programming in Assembly
Text Mode Programming in AssemblyText Mode Programming in Assembly
Text Mode Programming in AssemblyJaveria Yaqoob
 
Assembly language
Assembly language Assembly language
Assembly language Usama ahmad
 
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...warda aziz
 
advancsed microprocessor and interfacing
advancsed microprocessor and interfacingadvancsed microprocessor and interfacing
advancsed microprocessor and interfacing@zenafaris91
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Bilal Amjad
 
Solution manual of assembly language programming and organization of the ibm ...
Solution manual of assembly language programming and organization of the ibm ...Solution manual of assembly language programming and organization of the ibm ...
Solution manual of assembly language programming and organization of the ibm ...Tayeen Ahmed
 
Microprocessor 8086 instructions
Microprocessor 8086 instructionsMicroprocessor 8086 instructions
Microprocessor 8086 instructionsRavi Anand
 
Interfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessorInterfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessorVikas Gupta
 
Microprocessor 8086 instruction description
Microprocessor 8086 instruction descriptionMicroprocessor 8086 instruction description
Microprocessor 8086 instruction descriptionDheeraj Suri
 
Logical Instructions used in 8086 microprocessor
Logical Instructions used in 8086 microprocessorLogical Instructions used in 8086 microprocessor
Logical Instructions used in 8086 microprocessorRabin BK
 

La actualidad más candente (20)

Chapter 6 Flow control Instructions
Chapter 6 Flow control InstructionsChapter 6 Flow control Instructions
Chapter 6 Flow control Instructions
 
Assembly language 8086
Assembly language 8086Assembly language 8086
Assembly language 8086
 
Representation of numbers and characters
Representation of numbers and charactersRepresentation of numbers and characters
Representation of numbers and characters
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
 
Assembly 8086
Assembly 8086Assembly 8086
Assembly 8086
 
Addressing modes of 8086
Addressing modes of 8086Addressing modes of 8086
Addressing modes of 8086
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 10 ( Arrays and ...
 
Text Mode Programming in Assembly
Text Mode Programming in AssemblyText Mode Programming in Assembly
Text Mode Programming in Assembly
 
Assembly language
Assembly language Assembly language
Assembly language
 
8086 String Instructions.pdf
8086 String Instructions.pdf8086 String Instructions.pdf
8086 String Instructions.pdf
 
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...
Chap 8 The stack and introduction to procedures & Chapter 9 multiplication an...
 
advancsed microprocessor and interfacing
advancsed microprocessor and interfacingadvancsed microprocessor and interfacing
advancsed microprocessor and interfacing
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
 
Solution manual of assembly language programming and organization of the ibm ...
Solution manual of assembly language programming and organization of the ibm ...Solution manual of assembly language programming and organization of the ibm ...
Solution manual of assembly language programming and organization of the ibm ...
 
Microprocessor 8086 instructions
Microprocessor 8086 instructionsMicroprocessor 8086 instructions
Microprocessor 8086 instructions
 
Interfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessorInterfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessor
 
Microprocessor 8086 instruction description
Microprocessor 8086 instruction descriptionMicroprocessor 8086 instruction description
Microprocessor 8086 instruction description
 
8086 memory segmentation
8086 memory segmentation8086 memory segmentation
8086 memory segmentation
 
Logical Instructions used in 8086 microprocessor
Logical Instructions used in 8086 microprocessorLogical Instructions used in 8086 microprocessor
Logical Instructions used in 8086 microprocessor
 

Similar a Ascii adjust & decimal adjust

Bcd arithmetic instructions
Bcd arithmetic instructionsBcd arithmetic instructions
Bcd arithmetic instructionsDr. Girish GS
 
Bcd and ascii arithmetic instructions
Bcd and ascii arithmetic instructionsBcd and ascii arithmetic instructions
Bcd and ascii arithmetic instructionsDr. Girish GS
 
Ascii arithmetic instructions
Ascii arithmetic instructionsAscii arithmetic instructions
Ascii arithmetic instructionsDr. Girish GS
 
Instruction 4.pptx
Instruction 4.pptxInstruction 4.pptx
Instruction 4.pptxHebaEng
 
microcomputer architecture - Arithmetic instruction
microcomputer architecture - Arithmetic instructionmicrocomputer architecture - Arithmetic instruction
microcomputer architecture - Arithmetic instructionramya marichamy
 
15CS44 MP & MC Module 2
15CS44 MP & MC Module  215CS44 MP & MC Module  2
15CS44 MP & MC Module 2RLJIT
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Jay Patel
 
15CS44 MP &MC Module 3
15CS44 MP &MC Module 315CS44 MP &MC Module 3
15CS44 MP &MC Module 3RLJIT
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086Vijay Kumar
 
Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)AmitPaliwal20
 

Similar a Ascii adjust & decimal adjust (20)

Mod-2.pptx
Mod-2.pptxMod-2.pptx
Mod-2.pptx
 
Al2ed chapter11
Al2ed chapter11Al2ed chapter11
Al2ed chapter11
 
Bcd arithmetic instructions
Bcd arithmetic instructionsBcd arithmetic instructions
Bcd arithmetic instructions
 
Bcd and ascii arithmetic instructions
Bcd and ascii arithmetic instructionsBcd and ascii arithmetic instructions
Bcd and ascii arithmetic instructions
 
Ascii arithmetic instructions
Ascii arithmetic instructionsAscii arithmetic instructions
Ascii arithmetic instructions
 
Module 2 (1).pptx
Module 2 (1).pptxModule 2 (1).pptx
Module 2 (1).pptx
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Instruction 4.pptx
Instruction 4.pptxInstruction 4.pptx
Instruction 4.pptx
 
Arithmetic instrctions
Arithmetic instrctionsArithmetic instrctions
Arithmetic instrctions
 
microcomputer architecture - Arithmetic instruction
microcomputer architecture - Arithmetic instructionmicrocomputer architecture - Arithmetic instruction
microcomputer architecture - Arithmetic instruction
 
Chap3 8086 artithmetic
Chap3 8086 artithmeticChap3 8086 artithmetic
Chap3 8086 artithmetic
 
8086 ins2 math
8086 ins2 math8086 ins2 math
8086 ins2 math
 
Chapter 3 8086 ins2 math
Chapter 3 8086 ins2 mathChapter 3 8086 ins2 math
Chapter 3 8086 ins2 math
 
15CS44 MP & MC Module 2
15CS44 MP & MC Module  215CS44 MP & MC Module  2
15CS44 MP & MC Module 2
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051
 
arithmetic ins in 8051
arithmetic ins in 8051arithmetic ins in 8051
arithmetic ins in 8051
 
8086 instruction set
8086  instruction set8086  instruction set
8086 instruction set
 
15CS44 MP &MC Module 3
15CS44 MP &MC Module 315CS44 MP &MC Module 3
15CS44 MP &MC Module 3
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)Instructionsetof8086 180224060745(3)
Instructionsetof8086 180224060745(3)
 

Más de Tech_MX

Virtual base class
Virtual base classVirtual base class
Virtual base classTech_MX
 
Theory of estimation
Theory of estimationTheory of estimation
Theory of estimationTech_MX
 
Templates in C++
Templates in C++Templates in C++
Templates in C++Tech_MX
 
String & its application
String & its applicationString & its application
String & its applicationTech_MX
 
Statistical quality__control_2
Statistical  quality__control_2Statistical  quality__control_2
Statistical quality__control_2Tech_MX
 
Stack data structure
Stack data structureStack data structure
Stack data structureTech_MX
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application Tech_MX
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applicationsTech_MX
 
Set data structure 2
Set data structure 2Set data structure 2
Set data structure 2Tech_MX
 
Set data structure
Set data structure Set data structure
Set data structure Tech_MX
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating SystemTech_MX
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Tech_MX
 
Motherboard of a pc
Motherboard of a pcMotherboard of a pc
Motherboard of a pcTech_MX
 
More on Lex
More on LexMore on Lex
More on LexTech_MX
 
MultiMedia dbms
MultiMedia dbmsMultiMedia dbms
MultiMedia dbmsTech_MX
 
Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)Tech_MX
 
Memory dbms
Memory dbmsMemory dbms
Memory dbmsTech_MX
 

Más de Tech_MX (20)

Virtual base class
Virtual base classVirtual base class
Virtual base class
 
Uid
UidUid
Uid
 
Theory of estimation
Theory of estimationTheory of estimation
Theory of estimation
 
Templates in C++
Templates in C++Templates in C++
Templates in C++
 
String & its application
String & its applicationString & its application
String & its application
 
Statistical quality__control_2
Statistical  quality__control_2Statistical  quality__control_2
Statistical quality__control_2
 
Stack data structure
Stack data structureStack data structure
Stack data structure
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
 
Spss
SpssSpss
Spss
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
 
Set data structure 2
Set data structure 2Set data structure 2
Set data structure 2
 
Set data structure
Set data structure Set data structure
Set data structure
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating System
 
Parsing
ParsingParsing
Parsing
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)
 
Motherboard of a pc
Motherboard of a pcMotherboard of a pc
Motherboard of a pc
 
More on Lex
More on LexMore on Lex
More on Lex
 
MultiMedia dbms
MultiMedia dbmsMultiMedia dbms
MultiMedia dbms
 
Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)
 
Memory dbms
Memory dbmsMemory dbms
Memory dbms
 

Último

Top Rated Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...
Top Rated  Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...Top Rated  Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...
Top Rated Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...Call Girls in Nagpur High Profile
 
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...ritikasharma
 
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur EscortsCall Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
Call Girl Nashik Saloni 7001305949 Independent Escort Service NashikCall Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
Call Girl Nashik Saloni 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
VIP Call Girls Nagpur Megha Call 7001035870 Meet With Nagpur Escorts
VIP Call Girls Nagpur Megha Call 7001035870 Meet With Nagpur EscortsVIP Call Girls Nagpur Megha Call 7001035870 Meet With Nagpur Escorts
VIP Call Girls Nagpur Megha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Russian Escorts Agency In Goa 💚 9316020077 💚 Russian Call Girl Goa
Russian Escorts Agency In Goa  💚 9316020077 💚 Russian Call Girl GoaRussian Escorts Agency In Goa  💚 9316020077 💚 Russian Call Girl Goa
Russian Escorts Agency In Goa 💚 9316020077 💚 Russian Call Girl Goasexy call girls service in goa
 
Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...
Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...
Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...Riya Pathan
 
Top Rated Kolkata Call Girls Khardah ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
Top Rated Kolkata Call Girls Khardah ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...Top Rated Kolkata Call Girls Khardah ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
Top Rated Kolkata Call Girls Khardah ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...ritikasharma
 
Independent Sonagachi Escorts ✔ 8250192130 ✔ Full Night With Room Online Book...
Independent Sonagachi Escorts ✔ 8250192130 ✔ Full Night With Room Online Book...Independent Sonagachi Escorts ✔ 8250192130 ✔ Full Night With Room Online Book...
Independent Sonagachi Escorts ✔ 8250192130 ✔ Full Night With Room Online Book...Riya Pathan
 
Call Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
Call Girl Nashik Amaira 7001305949 Independent Escort Service NashikCall Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
Call Girl Nashik Amaira 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...noor ahmed
 
👙 Kolkata Call Girls Shyam Bazar 💫💫7001035870 Model escorts Service
👙  Kolkata Call Girls Shyam Bazar 💫💫7001035870 Model escorts Service👙  Kolkata Call Girls Shyam Bazar 💫💫7001035870 Model escorts Service
👙 Kolkata Call Girls Shyam Bazar 💫💫7001035870 Model escorts Serviceanamikaraghav4
 
Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448ont65320
 
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...Apsara Of India
 
Dakshineswar Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Se...
Dakshineswar Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Se...Dakshineswar Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Se...
Dakshineswar Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Se...aamir
 
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...rahim quresi
 
Call Girl Service Belur - 7001035870 with real photos and phone numbers
Call Girl Service Belur - 7001035870 with real photos and phone numbersCall Girl Service Belur - 7001035870 with real photos and phone numbers
Call Girl Service Belur - 7001035870 with real photos and phone numbersanamikaraghav4
 
Verified Trusted Call Girls Tambaram Chennai ✔✔7427069034 Independent Chenna...
Verified Trusted Call Girls Tambaram Chennai ✔✔7427069034  Independent Chenna...Verified Trusted Call Girls Tambaram Chennai ✔✔7427069034  Independent Chenna...
Verified Trusted Call Girls Tambaram Chennai ✔✔7427069034 Independent Chenna... Shivani Pandey
 

Último (20)

Top Rated Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...
Top Rated  Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...Top Rated  Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...
Top Rated Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...
 
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
 
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur EscortsCall Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
 
Call Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
Call Girl Nashik Saloni 7001305949 Independent Escort Service NashikCall Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
Call Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
 
Goa Call Girls 9316020077 Call Girls In Goa By Russian Call Girl in goa
Goa Call Girls 9316020077 Call Girls  In Goa By Russian Call Girl in goaGoa Call Girls 9316020077 Call Girls  In Goa By Russian Call Girl in goa
Goa Call Girls 9316020077 Call Girls In Goa By Russian Call Girl in goa
 
VIP Call Girls Nagpur Megha Call 7001035870 Meet With Nagpur Escorts
VIP Call Girls Nagpur Megha Call 7001035870 Meet With Nagpur EscortsVIP Call Girls Nagpur Megha Call 7001035870 Meet With Nagpur Escorts
VIP Call Girls Nagpur Megha Call 7001035870 Meet With Nagpur Escorts
 
Russian Escorts Agency In Goa 💚 9316020077 💚 Russian Call Girl Goa
Russian Escorts Agency In Goa  💚 9316020077 💚 Russian Call Girl GoaRussian Escorts Agency In Goa  💚 9316020077 💚 Russian Call Girl Goa
Russian Escorts Agency In Goa 💚 9316020077 💚 Russian Call Girl Goa
 
Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...
Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...
Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...
 
Call Girls Chirag Delhi Delhi WhatsApp Number 9711199171
Call Girls Chirag Delhi Delhi WhatsApp Number 9711199171Call Girls Chirag Delhi Delhi WhatsApp Number 9711199171
Call Girls Chirag Delhi Delhi WhatsApp Number 9711199171
 
Top Rated Kolkata Call Girls Khardah ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
Top Rated Kolkata Call Girls Khardah ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...Top Rated Kolkata Call Girls Khardah ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
Top Rated Kolkata Call Girls Khardah ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
 
Independent Sonagachi Escorts ✔ 8250192130 ✔ Full Night With Room Online Book...
Independent Sonagachi Escorts ✔ 8250192130 ✔ Full Night With Room Online Book...Independent Sonagachi Escorts ✔ 8250192130 ✔ Full Night With Room Online Book...
Independent Sonagachi Escorts ✔ 8250192130 ✔ Full Night With Room Online Book...
 
Call Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
Call Girl Nashik Amaira 7001305949 Independent Escort Service NashikCall Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
Call Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
 
↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Behala ⟟ 8250192130 ⟟ High Class Call Girl In...
 
👙 Kolkata Call Girls Shyam Bazar 💫💫7001035870 Model escorts Service
👙  Kolkata Call Girls Shyam Bazar 💫💫7001035870 Model escorts Service👙  Kolkata Call Girls Shyam Bazar 💫💫7001035870 Model escorts Service
👙 Kolkata Call Girls Shyam Bazar 💫💫7001035870 Model escorts Service
 
Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448
 
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
 
Dakshineswar Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Se...
Dakshineswar Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Se...Dakshineswar Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Se...
Dakshineswar Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Se...
 
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...
 
Call Girl Service Belur - 7001035870 with real photos and phone numbers
Call Girl Service Belur - 7001035870 with real photos and phone numbersCall Girl Service Belur - 7001035870 with real photos and phone numbers
Call Girl Service Belur - 7001035870 with real photos and phone numbers
 
Verified Trusted Call Girls Tambaram Chennai ✔✔7427069034 Independent Chenna...
Verified Trusted Call Girls Tambaram Chennai ✔✔7427069034  Independent Chenna...Verified Trusted Call Girls Tambaram Chennai ✔✔7427069034  Independent Chenna...
Verified Trusted Call Girls Tambaram Chennai ✔✔7427069034 Independent Chenna...
 

Ascii adjust & decimal adjust

  • 2. INSTRUCTIONS  AAA - ASCII Adjust After Addition  AAS - ASCII Adjust After Subtraction  AAM - ASCII Adjust After Multiply  AAD - ASCII Adjust Before Division  DAA - Decimal Adjust for Addition  DAS - Decimal Adjust for Subtraction 2
  • 3. INTRODUCTION The PC supports BCD format, Uses of BCD 1)No loss of precision 2)Simpler to perform arithmetic operation on small values from keyboard BCD can be stored in two way: Unpacked BCD Packed BCD 3
  • 4. Unpacked BCD Data Unpacked BCD representation contains only One decimal digit per byte. The digit is stored in the least significant 4 bits; the most significant 4 bits are not relevant to the value of the represented number. Example: Representing 1527 01 05 02 07h 4
  • 5. Packed BCD Data Packed BCD representation packs two Decimal digits into a single byte. Example: Representing 1527 15 27h 5
  • 6. ASCII Adjust After Addition Adjusts the result of the addition of two unpacked BCD values to create a unpacked BCD result. Operation 1: In AL If rightmost nibble is >9 (ie)A to F Or AuxilaryFlag=1 ADD 6 to rightmost nibble 6
  • 7. Operation 2: Clear left nibble form AL. Operation 3: In AH ADD 1 Operation 4: Set Carry and AuxilaryCarry 7
  • 8. .model small .data b1 dw 38h b2 dw 34h .code mov ax,@data mov ds,ax mov ax,b1 ;moving unpacked BCD into ax mov bx,b2 ;moving unpacked BCD into bx add ax,bx aaa ;adjusting unpacked BCD after addition or ax,3030h end 8
  • 9. ASCII Adjust After Subtraction Adjusts the result of the subtraction of two unpacked BCD values to create a unpacked BCD result. Operation 1: a)AAS checks the rightmost nibble in AL b)If rightmost nibble is >9 (ie)A to F Or AuxilaryFlag=1 c)Then Subtract 6 from rightmost nibble 9
  • 10. Operation 2: Clear left nibble in AL. Operation 3: Subtracts 1 from AH Operation 4: Set Carry and AuxilaryCarry 10
  • 11. Example : d1 contains 34h , d2 contains 38h of byte type Ax AF Mov AL, d1 ; 0034 Sub AL, d2; 00fc 1 AAS ; ff06 1  since the rightmost digit of AL is c , subtract 6 from AL  Subtract 1 from ah, set AF and CF flags  The answer is -4, is ff06 in 10’s complement 11
  • 12. .model small .data b1 dw 38h b2 dw 34h .code mov ax,@data mov ds,ax mov ax,b1 ;moving unpacked BCD into ax mov bx,b2 ;moving unpacked BCD into bx sub ax,bx aas ;adjusting unpacked BCD after subtraction or ax,3030h end 12
  • 13. ASCII Adjust After Multiplication  For multiplication and Division of ASCII numbers require that the numbers first be converted into unpacked BCD format.  Before Multiplication First clear the leftmost nibble in each Byte.  After Multiplication  AAM performs the following operations 1) Divides AL value by 10 (0AH) 2) Stores Quotient in AH 3) Store Remainder in AL 13
  • 14. Example: AL contains 35H and CL contains 39H Instruction comment AX CL and CL, 0Fh; Convert CL to 09 0035 39 and AL,0Fh; Convert AL to 05 0005 09 mul CL; Multiply AL by CL 002D AAM ; Convert to unpacked 0405 BCD Or AX,3030h; covert to ASCII 3435 14
  • 15. Mul operation generates 45 (002Dh) in AX  AAM divides this value by 10, so quotient of 04 in AH and remainder of 05 in AL  OR instruction converts the unpacked BCD to ASCII format 15
  • 16. .model small .data b1 dw 39h ; 9 in ASCII Format b2 dw 35h ; 5 in ASCII Format .code mov ax,@data mov ds,ax mov ax,b1 ;AX=0039h and AL,0fh ;AX=0009h mov bx,b2 ;BX=0035h and bl,0fh ;BX=0005h mul bx ;AX=002Dh aam or ax,3030h end 16
  • 17. ASCII Adjust Before Division  AAD allows for a 2-Byte Dividend in AX. The divisor can be only a single Byte(0-9)  Before Division First clear the leftmost nibble in each Byte.  Operations done by AAD instruction 1) AAD multiplies the AH by 10(0Ah). 2) Then adds the product to AL and clears the AH  After AAD , division is performed. 17
  • 18. Example: AX contains 3238 (28) - Dividend CL contains 37 (07) – Divisor Instruction comment AX CL and CL,0Fh; convert to unpacked 3238 07 BCD and AX,0F0Fh; convert to unpacked 0208 07 BCD AAD; convert to binary 001C div CL; divide by 7 0004 18
  • 19. AAD multiplies the AH by 10(0Ah)  Adds the product 20(14h) to the AL and clears the AH  The result is 001Ch, is hex representation of decimal 28  Then division is performed.  Remainder stored in AH, Quotient stored in AL 19
  • 20. model small .data b1 dw 3238h ; 28 in ASCII Format b2 db 37h ; 7 in ASCII Format .code mov ax,@data mov ds,ax mov ax,b1 ;AX=3238h and ax,0f0fh ;AX=0208h mov cl,b2 ;CL=37h and cl,0fh ;CL=07h aad ; AX= 001c div cl ; AX=0004 or ax,3030h; AX=3034 end 20
  • 21. Decimal Adjust To adjust the result of packed BCD numbers which stored in AL. DAA - Decimal Adjust for Addition DAS - Decimal Adjust for Subtraction 21
  • 22. Decimal Adjust for Addition DAA performs the following operations: Operation 1: If AL is >9 (ie) A to F or AuxilaryCarry=1 then ADD 6 to AL Set AuxilaryCarry=1 22
  • 23. Operation 2: If AL contains value > 99 or Carry=1 then ADD 60 to AL and set Carry =1 Otherwise AuxilaryCarry=0 ,carry=0 23
  • 24. AL contains 45h BL contains 45h Instruction Comment AL ADD AL,BL ; AL=AL+BL 8Ah DAA ; Adjust packed BCD 90h addition 24
  • 25. DAA checks the rightmost nibble of AL, it is A so add 6 to AL  Now AL = 90 25
  • 26. .model small .data d1 dw 45h ;moving 45 as packed BCD d2 dw 45h ;moving 45 as packed BCD .code mov ax,@data mov ds,ax mov ax,d1 mov bx,d2 add ax,bx daa ;adjusting the packed BCD after addition end 26
  • 27. Decimal Adjust for Subtraction Operations performed by DAS : If AL is >9 (ie) A to F or AuxilaryCarry=1 then Subtract 6 from AL Set Carry=1 Otherwise AuxilaryCarry=0 ,carry=0 27
  • 28. AL contains 80h BL contains 49h Instruction Comment AL SUB AL,BL ; AL=AL-BL 37h DAS ; Adjust packed BCD 31h Subtraction 28
  • 29. .model small .data d1 dw 57h d2 dw 48h .code mov ax,@data mov ds,ax mov ax,d1 ;moving 45 as packed BCD mov bx,d2 ;moving 45 as packed BCD sub ax,bx das ; adjusting the packed BCD after subraction end 29
  • 30. THANK U 30