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

MATHLECT1LECTUREFFFFFFFFFFFFFFFFFFHJ.pdf
MATHLECT1LECTUREFFFFFFFFFFFFFFFFFFHJ.pdfMATHLECT1LECTUREFFFFFFFFFFFFFFFFFFHJ.pdf
MATHLECT1LECTUREFFFFFFFFFFFFFFFFFFHJ.pdfHebaEng
 
Estimate the value of the following limits.pptx
Estimate the value of the following limits.pptxEstimate the value of the following limits.pptx
Estimate the value of the following limits.pptxHebaEng
 
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
 

More from HebaEng (20)

MATHLECT1LECTUREFFFFFFFFFFFFFFFFFFHJ.pdf
MATHLECT1LECTUREFFFFFFFFFFFFFFFFFFHJ.pdfMATHLECT1LECTUREFFFFFFFFFFFFFFFFFFHJ.pdf
MATHLECT1LECTUREFFFFFFFFFFFFFFFFFFHJ.pdf
 
Estimate the value of the following limits.pptx
Estimate the value of the following limits.pptxEstimate the value of the following limits.pptx
Estimate the value of the following limits.pptx
 
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
 

Recently uploaded

Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...home
 
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Call Girls in Nagpur High Profile
 
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
 
Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...
Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...
Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...nagunakhan
 
Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation decktbatkhuu1
 
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
 
(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
 
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
 
WAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsWAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsCharles Obaleagbon
 
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 Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130  Available With RoomVIP Kolkata Call Girl Gariahat 👉 8250192130  Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Roomdivyansh0kumar0
 
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
 
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵anilsa9823
 
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Delhi Call girls
 
Top Rated Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Call Girls in Nagpur High Profile
 
Verified Trusted Call Girls Adugodi💘 9352852248 Good Looking standard Profil...
Verified Trusted Call Girls Adugodi💘 9352852248  Good Looking standard Profil...Verified Trusted Call Girls Adugodi💘 9352852248  Good Looking standard Profil...
Verified Trusted Call Girls Adugodi💘 9352852248 Good Looking standard Profil...kumaririma588
 
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...Call Girls in Nagpur High Profile
 

Recently uploaded (20)

Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
 
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Koregaon Park ⟟ 6297143586 ⟟ Call Me For Genuine S...
 
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...
 
Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...
Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...
Nepali Escort Girl Gomti Nagar \ 9548273370 Indian Call Girls Service Lucknow...
 
Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation deck
 
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
young call girls in Pandav nagar 🔝 9953056974 🔝 Delhi escort Service
 
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
 
(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...
 
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
 
WAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past QuestionsWAEC Carpentry and Joinery Past Questions
WAEC Carpentry and Joinery Past Questions
 
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 Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130  Available With RoomVIP Kolkata Call Girl Gariahat 👉 8250192130  Available With Room
VIP Kolkata Call Girl Gariahat 👉 8250192130 Available With Room
 
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
 
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
 
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service  🧵
CALL ON ➥8923113531 🔝Call Girls Kalyanpur Lucknow best Female service 🧵
 
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
 
Top Rated Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Saswad ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974
escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974
escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974
 
Verified Trusted Call Girls Adugodi💘 9352852248 Good Looking standard Profil...
Verified Trusted Call Girls Adugodi💘 9352852248  Good Looking standard Profil...Verified Trusted Call Girls Adugodi💘 9352852248  Good Looking standard Profil...
Verified Trusted Call Girls Adugodi💘 9352852248 Good Looking standard Profil...
 
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
 

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)