SlideShare a Scribd company logo
1 of 19
(4)
INST. OPERANDS FUNCTION
ADD
D.OPERAND,S.OPERAND
REG, memory
memory, REG
REG, REG
memory, immediate
REG, immediate
FUNCTION:
D.OPERAND = D.OPERAND + S.OPERAND
ADC
O, S, Z, A, C & P FLAGS are Affected
Example:
MOV AL, 6
ADD AL, -3
FUNCTION:
D.OPERAND = D.OPERAND + S.OPERAND + CF
Example:
MOV AL, 6
ADC AL, -3
MOV BH, 26
ADD BH, 77 ; BH = 103
; CF = 0, ZF = 0
; OF = 0
(103 < 128, sign bit: 0→0)
ADD BH, 39 ; BH = 142
; CF = 0, ZF = 0
; OF = 1
(142 > 128, sign bit: 0→1)
ADD BH, 142 ; BH = 28
; CF = 1, ZF = 0
(142+142 = 256 + 28)
; OF = 1
(28 < 128, sign bit: 1→0)
EEL 3801C
Unsigned Integers
• Unsigned integers are easy – they use all 8 or
16 bits in the byte or word to represent the
number.
• If a byte, the total range is 0 to 255
(00000000 to 11111111).
• If a word, the total range is 0 to 65,535
(0000000000000000 to 1111111111111111).
EEL 3801C
Signed Integers
• Are slightly more complicated, as they can only
use 7 or 15 of the bits to represent the number.
The highest bit is used to indicate the sign.
• A high bit of 0  positive number
• A high bit of 1  negative number
• The range of a signed integer in a byte is
therefore, -128 to127, remembering that the
high bit does not count.
• The range of a signed integer in a word is
–32,768 to 32,767.
INST. OPERANDS FUNCTION
NO OPERAND
Decimal adjust After Addition.
Corrects the result of addition of two packed
BCD values.
Algorithm:
if low nibble of AL > 9 or AF = 1 then:
AL = AL + 6
AF = 1
if AL > 9F or CF = 1 then:
AL = AL + 60h
CF = 1
DAA
Example:
MOV AL, Fh ; AL = 0Fh
DAA ; AL = 15h
O, S, Z, A, C & P FLAGS are Affected
8086 Assembly 9
BCD Packing
• When typing a digit from the keyboard, it is
represented in ASCII values 30H thru 39H
– 00110000 thru 00111001
– if we replace the 0011 in the upper nibble, we
are left with BCD code for the digit
– this is an unpacked BCD number because we
are using 8 bits to represent it
• We can combine 2 BCD digits in a single
byte…this is a packed BCD number
EXAMPLE 1:
AL contains 25 (packed BCD)
BL contains 65 (packed BCD)
ADD AL, BL ;AL=8Ah
DAA ;AL=90h (8A+06)
EXAMPLE 2:
AL contains 45 (packed BCD)
BL contains 65 (packed BCD)
ADD AL, BL ;AL=AAh
DAA ;AL=?
INST. OPERANDS FUNCTION
NO OPERAND
ASCII Adjust after Addition.
Corrects result in AH and AL after addition
when working with BCD values.
Algorithm:
if low nibble of AL > 9 or AF = 1 then:
AL = AL + 6
AH = AH + 1
AF = 1 & CF = 1
else AF = 0 & CF = 0
In both cases: clear the high nibble of AL
AAA
A& C FLAGS are Affected
Example: MOV AX, 8h
ADD AX, 7h ; AH = 00, AL =0Fh
AAA ; AH = 01, AL = 05
EXAMPLE 1:
AL contains 32 (ASCII code for number 2)
BL contains 34 (ASCII code for number 4)
ADD AL,BL ;AL=66h
AAA ;AL=06 AH=00
?
EXAMPLE 2:
AL contains 32 (ASCII code for number 2)
BL contains 38 (ASCII code for number 8)
ADD AL, BL ;AL=6Ah
AAA ;AL=? AH=?
?
INST. OPERANDS FUNCTION
SUB
D.OPERAND,S.OPERAND
REG, memory
memory, REG
REG, REG
memory, immediate
REG, immediate
FUNCTION:
D.OPERAND = D.OPERAND - S.OPERAND
SBB
O, S, Z, A, C & P FLAGS are Affected
Example:
MOV AL, 6
SUB AL, 3
FUNCTION:
D.OPERAND = D.OPERAND - S.OPERAND - CF
Example:
MOV AL, 6
SBB AL, 3
INST. OPERANDS FUNCTION
NO OPERAND
Decimal adjust After Subtraction.
Corrects the result of subtraction of two
packed BCD values.
Algorithm:
if low nibble of AL > 9 or AF = 1 then:
AL = AL - 6
AF = 1
if AL > 9F or CF = 1 then:
AL = AL - 60h
CF = 1
DAS
Example: MOV AL, 0
SUB AL, 01h ; AL = 0FFh (-1)
DAS ; AL = 99h, CF=1
S, Z, A, C & P FLAGS are Affected
EXAMPLE 1:
MOV AL,83h
MOV BL,28h
SUB AL,BL ;AL=5Bh (83h-28h)
;= (83h+TC(28h))
;=(83h+D8h)
DAS ;AL=55h (5Bh-6)
EXAMPLE 2:
MOV AL, 16h
MOV BL,28h
SUB AL, BL ;AL=EEh (16h-28h)
DAS ;AL=?
INST. OPERANDS FUNCTION
NO OPERAND
ASCII Adjust after Subtraction.
Corrects result in AH and AL after subtraction
when working with BCD values.
Algorithm:
if low nibble of AL > 9 or AF = 1 then:
AL = AL - 6
AH = AH - 1
AF = 1 & CF = 1
else AF = 0 & CF = 0
In both cases: clear the high nibble of AL
AAS
A& C FLAGS are Affected
Example: :
MOV AX, 02FFh ; AH = 02, AL = FFh
AAS ; AH = 01, AL = 09
EXAMPLE 1:
MOV AX,38h
SUB AL,39h ;AX=00FFh (38h-39h)
;= (38h+TC(39h))
;=(38h+C7h)
AAS ;AX=FF09h (Ten’s
;complement of -1)
EXAMPLE 2:
MOV AX, 38h
SUB AL, 35h ;AX=0003h (38h-35h)
;= (38h+TC(35h))
;=(38h+??h)
AAS ;AX=????h ( ? )
Examples
; DX;AX = 1303F0h + 22A00h = 152DF0h
MOV AX, 03F0h
MOV DX, 0013h
ADD AX, 2A00h ; 03F0h + 2A00h = 2DF0h
ADC DX, 0002h ; 0013h + 0002h ; +0(no carry) = 0015h
; AX = 398 – 32 = 366 (= 016Eh)
MOV AX, 398; 018Eh
SUB AX, 32 ; AX = 018Eh – 0020h
; DX;AX = 1303F0h – 22A00h = 10D9F0h
MOV AX, 03F0h
MOV DX, 0013h
SUB AX, 2A00h ; 03F0h - 2A00h = D9F0h
SBB DX, 0002h ; 0013h - 0002h
; -1(borrow) = 0010h
MOV AL, 125
ADD AL, 15 ; AL = 125 + 15 (= 8Ch)
Instruction 4.pptx

More Related Content

Similar to Instruction 4.pptx

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
 
Microprocessor 8086 instruction description
Microprocessor 8086 instruction descriptionMicroprocessor 8086 instruction description
Microprocessor 8086 instruction descriptionDheeraj Suri
 
Ascii adjust & decimal adjust
Ascii adjust & decimal adjustAscii adjust & decimal adjust
Ascii adjust & decimal adjustTech_MX
 
microp-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :Pmicrop-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :PJathin Kanumuri
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction setSaumitra Rukmangad
 
microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2Jathin Kanumuri
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-pptjemimajerome
 
Instruction set summary
Instruction set summary Instruction set summary
Instruction set summary janicetiong
 

Similar to Instruction 4.pptx (20)

Al2ed chapter11
Al2ed chapter11Al2ed chapter11
Al2ed chapter11
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
[ASM]Lab7
[ASM]Lab7[ASM]Lab7
[ASM]Lab7
 
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
 
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
 
Emu8086
Emu8086Emu8086
Emu8086
 
Hemanth143
Hemanth143 Hemanth143
Hemanth143
 
Microprocessor 8086 instruction description
Microprocessor 8086 instruction descriptionMicroprocessor 8086 instruction description
Microprocessor 8086 instruction description
 
Ascii adjust & decimal adjust
Ascii adjust & decimal adjustAscii adjust & decimal adjust
Ascii adjust & decimal adjust
 
microp-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :Pmicrop-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :P
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
 
microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2
 
Lecture6
Lecture6Lecture6
Lecture6
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
 
Instruction set summary
Instruction set summary Instruction set summary
Instruction set summary
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 

More from HebaEng

lecrfigfdtj x6 I f I ncccfyuggggrst3.pdf
lecrfigfdtj x6 I f I ncccfyuggggrst3.pdflecrfigfdtj x6 I f I ncccfyuggggrst3.pdf
lecrfigfdtj x6 I f I ncccfyuggggrst3.pdfHebaEng
 
LECtttttttttttttttttttttttttttttt2 M.pptx
LECtttttttttttttttttttttttttttttt2 M.pptxLECtttttttttttttttttttttttttttttt2 M.pptx
LECtttttttttttttttttttttttttttttt2 M.pptxHebaEng
 
lect4ggghjjjg t I c jifr7hvftu b gvvbb.pdf
lect4ggghjjjg t I c jifr7hvftu b gvvbb.pdflect4ggghjjjg t I c jifr7hvftu b gvvbb.pdf
lect4ggghjjjg t I c jifr7hvftu b gvvbb.pdfHebaEng
 
lect5.gggghhhhhhhhhhhhyyhhhygfe6 in b cfpdf
lect5.gggghhhhhhhhhhhhyyhhhygfe6 in b cfpdflect5.gggghhhhhhhhhhhhyyhhhygfe6 in b cfpdf
lect5.gggghhhhhhhhhhhhyyhhhygfe6 in b cfpdfHebaEng
 
sensorshhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.pptx
sensorshhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.pptxsensorshhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.pptx
sensorshhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.pptxHebaEng
 
Homework lehhhhghjjjjhgd thvfgycture 1.pdf
Homework lehhhhghjjjjhgd thvfgycture 1.pdfHomework lehhhhghjjjjhgd thvfgycture 1.pdf
Homework lehhhhghjjjjhgd thvfgycture 1.pdfHebaEng
 
PIC1jjkkkkkkkjhgfvjitr c its GJ tagging hugg
PIC1jjkkkkkkkjhgfvjitr c its GJ tagging huggPIC1jjkkkkkkkjhgfvjitr c its GJ tagging hugg
PIC1jjkkkkkkkjhgfvjitr c its GJ tagging huggHebaEng
 
lecture1ddddgggggggggggghhhhhhh (11).ppt
lecture1ddddgggggggggggghhhhhhh (11).pptlecture1ddddgggggggggggghhhhhhh (11).ppt
lecture1ddddgggggggggggghhhhhhh (11).pptHebaEng
 
math6.pdf
math6.pdfmath6.pdf
math6.pdfHebaEng
 
math1مرحلة اولى -compressed.pdf
math1مرحلة اولى -compressed.pdfmath1مرحلة اولى -compressed.pdf
math1مرحلة اولى -compressed.pdfHebaEng
 
digital10.pdf
digital10.pdfdigital10.pdf
digital10.pdfHebaEng
 
PIC Serial Communication_P2 (2).pdf
PIC Serial Communication_P2 (2).pdfPIC Serial Communication_P2 (2).pdf
PIC Serial Communication_P2 (2).pdfHebaEng
 
Instruction 3.pptx
Instruction 3.pptxInstruction 3.pptx
Instruction 3.pptxHebaEng
 
IO and MAX 2.pptx
IO and MAX 2.pptxIO and MAX 2.pptx
IO and MAX 2.pptxHebaEng
 
BUS DRIVER.pptx
BUS DRIVER.pptxBUS DRIVER.pptx
BUS DRIVER.pptxHebaEng
 
VRAM & DEBUG.pptx
VRAM & DEBUG.pptxVRAM & DEBUG.pptx
VRAM & DEBUG.pptxHebaEng
 
8086 memory interface.pptx
8086 memory interface.pptx8086 memory interface.pptx
8086 memory interface.pptxHebaEng
 
Opcode 2.pptx
Opcode 2.pptxOpcode 2.pptx
Opcode 2.pptxHebaEng
 
VRAM & DEBUG.pptx
VRAM & DEBUG.pptxVRAM & DEBUG.pptx
VRAM & DEBUG.pptxHebaEng
 
8086 opcode.pptx
8086 opcode.pptx8086 opcode.pptx
8086 opcode.pptxHebaEng
 

More from HebaEng (20)

lecrfigfdtj x6 I f I ncccfyuggggrst3.pdf
lecrfigfdtj x6 I f I ncccfyuggggrst3.pdflecrfigfdtj x6 I f I ncccfyuggggrst3.pdf
lecrfigfdtj x6 I f I ncccfyuggggrst3.pdf
 
LECtttttttttttttttttttttttttttttt2 M.pptx
LECtttttttttttttttttttttttttttttt2 M.pptxLECtttttttttttttttttttttttttttttt2 M.pptx
LECtttttttttttttttttttttttttttttt2 M.pptx
 
lect4ggghjjjg t I c jifr7hvftu b gvvbb.pdf
lect4ggghjjjg t I c jifr7hvftu b gvvbb.pdflect4ggghjjjg t I c jifr7hvftu b gvvbb.pdf
lect4ggghjjjg t I c jifr7hvftu b gvvbb.pdf
 
lect5.gggghhhhhhhhhhhhyyhhhygfe6 in b cfpdf
lect5.gggghhhhhhhhhhhhyyhhhygfe6 in b cfpdflect5.gggghhhhhhhhhhhhyyhhhygfe6 in b cfpdf
lect5.gggghhhhhhhhhhhhyyhhhygfe6 in b cfpdf
 
sensorshhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.pptx
sensorshhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.pptxsensorshhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.pptx
sensorshhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.pptx
 
Homework lehhhhghjjjjhgd thvfgycture 1.pdf
Homework lehhhhghjjjjhgd thvfgycture 1.pdfHomework lehhhhghjjjjhgd thvfgycture 1.pdf
Homework lehhhhghjjjjhgd thvfgycture 1.pdf
 
PIC1jjkkkkkkkjhgfvjitr c its GJ tagging hugg
PIC1jjkkkkkkkjhgfvjitr c its GJ tagging huggPIC1jjkkkkkkkjhgfvjitr c its GJ tagging hugg
PIC1jjkkkkkkkjhgfvjitr c its GJ tagging hugg
 
lecture1ddddgggggggggggghhhhhhh (11).ppt
lecture1ddddgggggggggggghhhhhhh (11).pptlecture1ddddgggggggggggghhhhhhh (11).ppt
lecture1ddddgggggggggggghhhhhhh (11).ppt
 
math6.pdf
math6.pdfmath6.pdf
math6.pdf
 
math1مرحلة اولى -compressed.pdf
math1مرحلة اولى -compressed.pdfmath1مرحلة اولى -compressed.pdf
math1مرحلة اولى -compressed.pdf
 
digital10.pdf
digital10.pdfdigital10.pdf
digital10.pdf
 
PIC Serial Communication_P2 (2).pdf
PIC Serial Communication_P2 (2).pdfPIC Serial Communication_P2 (2).pdf
PIC Serial Communication_P2 (2).pdf
 
Instruction 3.pptx
Instruction 3.pptxInstruction 3.pptx
Instruction 3.pptx
 
IO and MAX 2.pptx
IO and MAX 2.pptxIO and MAX 2.pptx
IO and MAX 2.pptx
 
BUS DRIVER.pptx
BUS DRIVER.pptxBUS DRIVER.pptx
BUS DRIVER.pptx
 
VRAM & DEBUG.pptx
VRAM & DEBUG.pptxVRAM & DEBUG.pptx
VRAM & DEBUG.pptx
 
8086 memory interface.pptx
8086 memory interface.pptx8086 memory interface.pptx
8086 memory interface.pptx
 
Opcode 2.pptx
Opcode 2.pptxOpcode 2.pptx
Opcode 2.pptx
 
VRAM & DEBUG.pptx
VRAM & DEBUG.pptxVRAM & DEBUG.pptx
VRAM & DEBUG.pptx
 
8086 opcode.pptx
8086 opcode.pptx8086 opcode.pptx
8086 opcode.pptx
 

Recently uploaded

CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceanilsa9823
 
Presentation.pptx about blender what is blender
Presentation.pptx about blender what is blenderPresentation.pptx about blender what is blender
Presentation.pptx about blender what is blenderUbaidurrehman997675
 
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfChapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfParomita Roy
 
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130Suhani Kapoor
 
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai DouxDubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Douxkojalkojal131
 
Booking open Available Pune Call Girls Nanded City 6297143586 Call Hot India...
Booking open Available Pune Call Girls Nanded City  6297143586 Call Hot India...Booking open Available Pune Call Girls Nanded City  6297143586 Call Hot India...
Booking open Available Pune Call Girls Nanded City 6297143586 Call Hot India...Call Girls in Nagpur High Profile
 
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
SCRIP Lua HTTP PROGRACMACION PLC  WECON CASCRIP Lua HTTP PROGRACMACION PLC  WECON CA
SCRIP Lua HTTP PROGRACMACION PLC WECON CANestorGamez6
 
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...BarusRa
 
WAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsWAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsCharles Obaleagbon
 
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Delhi Call girls
 
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...ranjana rawat
 
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call GirlsCBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girlsmodelanjalisharma4
 
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk GurgaonCheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk GurgaonDelhi Call girls
 
The history of music videos a level presentation
The history of music videos a level presentationThe history of music videos a level presentation
The history of music videos a level presentationamedia6
 
SD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxSD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxjanettecruzeiro1
 
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...Amil baba
 
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...Suhani Kapoor
 
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...Suhani Kapoor
 
Cheap Rate Call girls Malviya Nagar 9205541914 shot 1500 night
Cheap Rate Call girls Malviya Nagar 9205541914 shot 1500 nightCheap Rate Call girls Malviya Nagar 9205541914 shot 1500 night
Cheap Rate Call girls Malviya Nagar 9205541914 shot 1500 nightDelhi Call girls
 

Recently uploaded (20)

CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
 
Presentation.pptx about blender what is blender
Presentation.pptx about blender what is blenderPresentation.pptx about blender what is blender
Presentation.pptx about blender what is blender
 
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdfChapter 19_DDA_TOD Policy_First Draft 2012.pdf
Chapter 19_DDA_TOD Policy_First Draft 2012.pdf
 
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
VIP Call Girls Service Mehdipatnam Hyderabad Call +91-8250192130
 
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai DouxDubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
 
Booking open Available Pune Call Girls Nanded City 6297143586 Call Hot India...
Booking open Available Pune Call Girls Nanded City  6297143586 Call Hot India...Booking open Available Pune Call Girls Nanded City  6297143586 Call Hot India...
Booking open Available Pune Call Girls Nanded City 6297143586 Call Hot India...
 
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
SCRIP Lua HTTP PROGRACMACION PLC  WECON CASCRIP Lua HTTP PROGRACMACION PLC  WECON CA
SCRIP Lua HTTP PROGRACMACION PLC WECON CA
 
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...
 
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...
Call Girls Service Mukherjee Nagar @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
 
WAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsWAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past Questions
 
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
Best VIP Call Girls Noida Sector 44 Call Me: 8448380779
 
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
(AISHA) Ambegaon Khurd Call Girls Just Call 7001035870 [ Cash on Delivery ] P...
 
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call GirlsCBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
CBD Belapur Individual Call Girls In 08976425520 Panvel Only Genuine Call Girls
 
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk GurgaonCheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
Cheap Rate ➥8448380779 ▻Call Girls In Iffco Chowk Gurgaon
 
The history of music videos a level presentation
The history of music videos a level presentationThe history of music videos a level presentation
The history of music videos a level presentation
 
SD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxSD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptx
 
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
 
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
VIP Russian Call Girls in Gorakhpur Deepika 8250192130 Independent Escort Ser...
 
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
 
Cheap Rate Call girls Malviya Nagar 9205541914 shot 1500 night
Cheap Rate Call girls Malviya Nagar 9205541914 shot 1500 nightCheap Rate Call girls Malviya Nagar 9205541914 shot 1500 night
Cheap Rate Call girls Malviya Nagar 9205541914 shot 1500 night
 

Instruction 4.pptx

  • 1. (4)
  • 2.
  • 3.
  • 4. INST. OPERANDS FUNCTION ADD D.OPERAND,S.OPERAND REG, memory memory, REG REG, REG memory, immediate REG, immediate FUNCTION: D.OPERAND = D.OPERAND + S.OPERAND ADC O, S, Z, A, C & P FLAGS are Affected Example: MOV AL, 6 ADD AL, -3 FUNCTION: D.OPERAND = D.OPERAND + S.OPERAND + CF Example: MOV AL, 6 ADC AL, -3
  • 5. MOV BH, 26 ADD BH, 77 ; BH = 103 ; CF = 0, ZF = 0 ; OF = 0 (103 < 128, sign bit: 0→0) ADD BH, 39 ; BH = 142 ; CF = 0, ZF = 0 ; OF = 1 (142 > 128, sign bit: 0→1) ADD BH, 142 ; BH = 28 ; CF = 1, ZF = 0 (142+142 = 256 + 28) ; OF = 1 (28 < 128, sign bit: 1→0)
  • 6. EEL 3801C Unsigned Integers • Unsigned integers are easy – they use all 8 or 16 bits in the byte or word to represent the number. • If a byte, the total range is 0 to 255 (00000000 to 11111111). • If a word, the total range is 0 to 65,535 (0000000000000000 to 1111111111111111).
  • 7. EEL 3801C Signed Integers • Are slightly more complicated, as they can only use 7 or 15 of the bits to represent the number. The highest bit is used to indicate the sign. • A high bit of 0  positive number • A high bit of 1  negative number • The range of a signed integer in a byte is therefore, -128 to127, remembering that the high bit does not count. • The range of a signed integer in a word is –32,768 to 32,767.
  • 8. INST. OPERANDS FUNCTION NO OPERAND Decimal adjust After Addition. Corrects the result of addition of two packed BCD values. Algorithm: if low nibble of AL > 9 or AF = 1 then: AL = AL + 6 AF = 1 if AL > 9F or CF = 1 then: AL = AL + 60h CF = 1 DAA Example: MOV AL, Fh ; AL = 0Fh DAA ; AL = 15h O, S, Z, A, C & P FLAGS are Affected
  • 9. 8086 Assembly 9 BCD Packing • When typing a digit from the keyboard, it is represented in ASCII values 30H thru 39H – 00110000 thru 00111001 – if we replace the 0011 in the upper nibble, we are left with BCD code for the digit – this is an unpacked BCD number because we are using 8 bits to represent it • We can combine 2 BCD digits in a single byte…this is a packed BCD number
  • 10. EXAMPLE 1: AL contains 25 (packed BCD) BL contains 65 (packed BCD) ADD AL, BL ;AL=8Ah DAA ;AL=90h (8A+06) EXAMPLE 2: AL contains 45 (packed BCD) BL contains 65 (packed BCD) ADD AL, BL ;AL=AAh DAA ;AL=?
  • 11. INST. OPERANDS FUNCTION NO OPERAND ASCII Adjust after Addition. Corrects result in AH and AL after addition when working with BCD values. Algorithm: if low nibble of AL > 9 or AF = 1 then: AL = AL + 6 AH = AH + 1 AF = 1 & CF = 1 else AF = 0 & CF = 0 In both cases: clear the high nibble of AL AAA A& C FLAGS are Affected Example: MOV AX, 8h ADD AX, 7h ; AH = 00, AL =0Fh AAA ; AH = 01, AL = 05
  • 12. EXAMPLE 1: AL contains 32 (ASCII code for number 2) BL contains 34 (ASCII code for number 4) ADD AL,BL ;AL=66h AAA ;AL=06 AH=00 ? EXAMPLE 2: AL contains 32 (ASCII code for number 2) BL contains 38 (ASCII code for number 8) ADD AL, BL ;AL=6Ah AAA ;AL=? AH=? ?
  • 13. INST. OPERANDS FUNCTION SUB D.OPERAND,S.OPERAND REG, memory memory, REG REG, REG memory, immediate REG, immediate FUNCTION: D.OPERAND = D.OPERAND - S.OPERAND SBB O, S, Z, A, C & P FLAGS are Affected Example: MOV AL, 6 SUB AL, 3 FUNCTION: D.OPERAND = D.OPERAND - S.OPERAND - CF Example: MOV AL, 6 SBB AL, 3
  • 14. INST. OPERANDS FUNCTION NO OPERAND Decimal adjust After Subtraction. Corrects the result of subtraction of two packed BCD values. Algorithm: if low nibble of AL > 9 or AF = 1 then: AL = AL - 6 AF = 1 if AL > 9F or CF = 1 then: AL = AL - 60h CF = 1 DAS Example: MOV AL, 0 SUB AL, 01h ; AL = 0FFh (-1) DAS ; AL = 99h, CF=1 S, Z, A, C & P FLAGS are Affected
  • 15. EXAMPLE 1: MOV AL,83h MOV BL,28h SUB AL,BL ;AL=5Bh (83h-28h) ;= (83h+TC(28h)) ;=(83h+D8h) DAS ;AL=55h (5Bh-6) EXAMPLE 2: MOV AL, 16h MOV BL,28h SUB AL, BL ;AL=EEh (16h-28h) DAS ;AL=?
  • 16. INST. OPERANDS FUNCTION NO OPERAND ASCII Adjust after Subtraction. Corrects result in AH and AL after subtraction when working with BCD values. Algorithm: if low nibble of AL > 9 or AF = 1 then: AL = AL - 6 AH = AH - 1 AF = 1 & CF = 1 else AF = 0 & CF = 0 In both cases: clear the high nibble of AL AAS A& C FLAGS are Affected Example: : MOV AX, 02FFh ; AH = 02, AL = FFh AAS ; AH = 01, AL = 09
  • 17. EXAMPLE 1: MOV AX,38h SUB AL,39h ;AX=00FFh (38h-39h) ;= (38h+TC(39h)) ;=(38h+C7h) AAS ;AX=FF09h (Ten’s ;complement of -1) EXAMPLE 2: MOV AX, 38h SUB AL, 35h ;AX=0003h (38h-35h) ;= (38h+TC(35h)) ;=(38h+??h) AAS ;AX=????h ( ? )
  • 18. Examples ; DX;AX = 1303F0h + 22A00h = 152DF0h MOV AX, 03F0h MOV DX, 0013h ADD AX, 2A00h ; 03F0h + 2A00h = 2DF0h ADC DX, 0002h ; 0013h + 0002h ; +0(no carry) = 0015h ; AX = 398 – 32 = 366 (= 016Eh) MOV AX, 398; 018Eh SUB AX, 32 ; AX = 018Eh – 0020h ; DX;AX = 1303F0h – 22A00h = 10D9F0h MOV AX, 03F0h MOV DX, 0013h SUB AX, 2A00h ; 03F0h - 2A00h = D9F0h SBB DX, 0002h ; 0013h - 0002h ; -1(borrow) = 0010h MOV AL, 125 ADD AL, 15 ; AL = 125 + 15 (= 8Ch)