A microprocessor is an electronic component that is used by a computer to do its work. It is a central processing unit on a single integrated circuit chip containing millions of very small components including transistors, resistors, and diodes that work together. Some microprocessors in the 20th century required several chips. Microprocessors help to do everything from controlling elevators to searching the Web. Everything a computer does is described by instructions of computer programs, and microprocessors carry out these instructions many millions of times a second. [1]
Microprocessors were invented in the 1970s for use in embedded systems. The majority are still used that way, in such things as mobile phones, cars, military weapons, and home appliances. Some microprocessors are microcontrollers, so small and inexpensive that they are used to control very simple products like flashlights and greeting cards that play music when you open them. A few especially powerful microprocessors are used in personal computers.
1. AAA (ASCII AdjustAfter Addition)
Syntax :-- AAA
• This instruction is used to convert the result in AL after the addition of unpacked
ASCII operands to unpacked decimal digits.
• The higher nibble of AL is filled with zeros.
• The instruction should be used after ADD and result is placed in the AL register.
• Before the execution of this instruction AH should be loaded with 00H.
• Flags affected : AF and CF.
Operation Performed :--
– If Lower nibble of AL<=9, or AF = 0 then
• AL = AL AND 0FH
– If Lower nibble of AL<=9 & AF = 1 or Lower nibble of AL>9 then
• AL = AL AND 0FH
• AL = AL + 06H
• AH = AH + 1
• AF = CF = 1
Note :-- The instruction does not give exact ASCII codes of the sum, but then can be obtained
by adding 3030 to AX.
• Example :--
– If AH = 0, AL = 38h , BL = 34h
• After ADD AL, BL ; AL 6C , AF =0
AAA ; AL 6C AND 0FH
; AL 0CH
;C>9, AL AL +06H
;AL 02
;AH 01
» AH = 01h AL = 02h
» Adding 3030H will give 31 32 ASCII result.
2. • AAS (ASCII AdjustAfter Subtraction )
Syntax :-- AAS
• This instruction is used to convert the result in AL after the subtraction of unpacked
ASCII operands to unpacked decimal digits..
• The higher nibble of AL is filled with zeros.
• The instruction should be used after SUB and result is placed in the AL register.
• Before the execution of this instruction AH should be loaded with 00H.
• Flags affected : AF and CF.
Operation Performed :--
– If Lower nibble of AL<=9, or AF = 0 then
• AL = AL AND AL 0FH
– If Lower nibble of AL<=9 & AF = 1 or Lower nibble of AL>9 then
• AL = AL AND AL 0FH
• AL = AL - 06H
• AH = AH - 1
• AF = CF = 1
Note :-- The instruction does not give exact ASCII codes of the difference, but then can be
obtained by adding 3030 to AX.
• Example1 :--
– If AH = 0, AL = 39h , BL = 35h
• After SUB AL, BL ; AL 04H , AF =0
AAS ; AL 04H AND 0FH
; AL 04H
; AH = 00h AL = 04h
» Adding 3030H will give 30 34 ASCII result.
3. • Example 2:--
– If AH = 0, AL = 35h , BL = 39h
• After SUB AL, BL ; AL FCH , AF =1
» AAS ; AL FCH AND 0FH
; AL 0CH
; C>9 AL AL -06
; AH 00 – 01
; AH FFH
; AL 04
AAM (ASCII AdjustAfter Multiplication)
Syntax :-- AAM
• This instruction is used to convert the product in AL after the multiplication into
unpacked BCD format.
• The higher nibble of multiplication operands is filled with zeros.
• The instruction should be used after MUL and result is placed in the AX register.
• The binary number in AL register is divided by 10 and quotient is stored in the register
AH, Remainder in AL.
• Flags affected : PF, SF and ZF
Operation Performed :--
• AL = AL MOD 10
• AH = AL / 10
• Example :--
1. If AH = 0, AL = 06h , BL = 08h
• After MUL BL ; AL 30H
AAM ; AL 30H MOD 10 (48/10)
; AL 08
; AH AL / 10 (48 /10)
; AH 04 Hence AH = 04h AL = 08h
4. AAD (ASCII AdjustBeforeDivision)
Syntax :-- AAD
• This instruction is used to convert the unpacked BCD digitS in AH and AL
to the equivalent binary number in the AL register.
• The higher nibble of AH and AL are filled with zeros.
• The instruction should be used before division instruction.
• The instruction will place the quotient in AL register and Remainder in
AH.
• Flags affected : PF, SF and ZF
Operation Performed :--
• AL = AH * 10 + AL
• AH = 00
• Example:--
1. If AH = 05, AL = 08 , BL = 07H
• After AAD ; AL 05 * 10 + 08
; AL 3AH
; AH 00H
DIV BL ; Quo 08H , Rem 02H
AH = 02h
AL = 08h