Arithmetic Instructions of 8085 – Instruction Set of 8085 Microprocessor – Microprocessor

Arithmetic Instructions of 8085 – Instruction Set of 8085 Microprocessor – Microprocessor


Do subscribe to Ekeeda Channel and press
bell icon to get updates about latest Engineering HSC and IIT-JEE Mains and
Advanced videos So let us study that what instructions
come under this category in this category the instructions which
perform the arithmetic operations they are included arithmetic operations like
addition subtraction increment and decrement the first instruction under this
category is a D D addition the operand of this instruction can be a register or
it can be your memory so this instruction is add register so this instruction add it is adding the
contents of the operand operand can be a register if R is there then it will be a
register and if M is there then it will be a memory so the contents of either
the register or the memory they are added to the contents of the accumulator
so one of the operand will be in the accumulator and another operand will be
the register or a memory now if the operand is memory then the location of
that memory is specified by the contents of the actual registers how we are
getting the location of the memory the actual register pair will indicate the
location of the memory suppose we have here 8 0 4 0 so at this memory location
the second data will be stored suppose at 8 0 4 0 we have 2 so this 2 and
accumulator is having 3 so 3 & 2 they got added up and the result of the
operation will be stored in the accumulator itself so accumulator will
have 6 here now if we have a register here so in that register like be
register see register b e:h l any of the resistors can be used and that resistor
will be added up with the accumulator if it is a register then b c d e HL any of
the registers can be used and their content will be added up with the
accumulator now all the flags are modified to reflect the result of the
addition in the 0 8 5 we have five types of flags sign flag zero flag parity flag
auxilary carry flag and carry flag so while performing this operation addition
operation if the result obtained after the addition if the result is zero then
zero flag will be said if a carry is generated in adding of
two numbers then carry flag will be set to 1 and if auxilary carry is generated
then auxilary carry flag is set to 1 if the result is having even numbers of 1
then parity flag is set otherwise it is reset and if the result is 0
coming out to be 0 of it is a negative number
then sign flag in zero flags are modified so all the flags they are
modified to reflect the result of the addition all the five flags will be
changed so this was the add R or either M instructions next instruction we have
a DC R and in this is add register to accumulator with Daddy so this instruction is a DC R or M no
operand can either be a register or it can be a memory location so this is
adding the register to the accumulator with caddy caddy flag is used so we have
this see here the contents of the operand at the register or memory and
the carry flag they are added to the contents of the accumulator and the
result of the addition is stored in the accumulator itself here also all the
flags are modified and if the operand it is a memory then the location of that
memory will be specified by the HL register pair let’s take an example
suppose we have a DC B that is adding the register B with the accumulator and
the carry flag also suppose an accumulator we have the number 2 and in
the B register we have the number 3 and in carry flag suppose carry flag is set
to 1 so this instruction a DC it is going to add the be registered with the
accumulator register and also the carry flag and the result will be stored in
the accumulator so 2 plus 3 plus 1 it will be 7 so
accumulator will have 7 here now suppose if carry
flag is equal to 0 it is the set condition if it is 1 and reset condition
if its value is 0 so if it is 0 then 0 plus 3
plus two so the content of accumulator will be six so this is how the carry
flag and the register they are added up and the accumulator and result is stored
in the accumulator it’s same now if we are having a memory address suppose we
are having ADC M so M is the address in the HL register pair HL will have 8 0 5
0 suppose so 8 0 5 0 memory location it is having the number 7 and we have the
accumulator has 2 and carry flag has 1 so 7 plus 2 plus 1 it will be 10 so
accumulator contents will be a suppose if it is 0 then 7 plus 2 plus 0 so the
accumulator content will be 9 so this is how this instruction works
it adds the carry flag and the register and accumulator or it can add a memory
location plus the carry and the accumulator now the next instruction is
Adi this instruction is add immediate to
accumulator so in this instruction the operand is an 8-bit data the operand is
defined in the instruction itself so this instruction is going to add this
8-bit data with the accumulator and the result of the addition will be stored in
the accumulator itself so this instruction adds the 8-bit data
to the contents of the accumulator and the result is stored in the accumulator
itself and all the flags are modified in this instruction let’s take an example
we have ad I and 45 so this is an 8-bit data fortify this will be added with the
accumulator suppose accumulator has here five so this five and forty five they
are going to add up and the result will be stored in the accumulator itself so
it will be 50 so in this way this instruction works that it adds the
immediate data given in the instruction itself to the accumulator and the result
is stored in the accumulator itself our next instruction is ECI this instruction is at the in EEG data
which is given in the instruction along with the carry to the accumulator so this instruction it is adding this
8-bit data along with the caddy flag to the contents of the accumulator and the
result is the stored in the accumulator itself let’s take an example if we have
AC I again 45 then this 45 number will be added to the accumulator accumulator
is having five and carry flag is suppose set so it is equal to one so 45 plus
five plus one so the accumulator will get the result 51 if it is having 0 then
the accumulator will have the result 15 so this instruction ACA it is adding the
immediate data which is in the instruction to the contents of the
accumulator and the carry flag all three are added up and the result is
the stored in the accumulator flags are also modified if suppose after the
addition any carry is generated then carry flag is again modified and if 0 if
the result is 0 then 0 flag is said sign parity auxilary carry all the five flags
they are modified during this instruction the next instruction is AC this instruction is to add the
accumulator with the image a data plus the carry so this instruction is adding this image
a data which is given in the instruction in cells to the accumulator along with
the carry so this 8-bit data which is the operand
and the carry flag they are added to the contents of the accumulator and the
result of this arithmetic operation it is stored in the accumulator now we know
that whenever any automatic and logical operation is performed the floods like
sign flag zero flag parity auxilary caddy and caddy all these flags are
modified so as to reflect the result of the addition if the number after
obtained after the addition it is a negative number or it is a positive
number then sign flag will be modified if the result is zero then zero flag
will be modified if any caddy is generated then carry an auxilary carry
they are modified and if the resultant number it is having even number of ones
or odd number of ones then parity flaccus modified so all the flags are
modified due to this instruction to reflect the result of the addition now
if we take an example of this instruction then a CI and an 8-bit data
suppose we have 45 so this instruction can be written in the program to execute
this instruction now what it will do suppose in the accumulator we have 0 4
and this 8-bit date is 45 and suppose the carry flag is reset it is in the
reset condition that is its value is 0 then 4 + 0 + 45 all these 3 will be
added and the result will be stored in the accumulator so in the accumulator we
will get 4 & 4 5-it will be 49 if it is 1 then 4 plus 1
plus 45 then the accumulator will have 50 ok so this is how the caddy flag and
the mej data and accumulator they are added up now next instruction is dad now
in 8 0 8 5 there is an exception that no registers the contents of the register
pairs they cannot be added if you want to add any of the register then you have
to add with it to the accumulator like we have b c d e h l so no two resistors
pair they can be added if you have to add the contents of any of the register
then you have to move the contents of the other register into the accumulator
so we can say that addition can only be performed if one of the operand it is
stored in the accumulator no two other resistors they can be added but an 8 0 8
5 this instruction bag it is an exception this instruction add to
register pairs ok so this instruction is about and the registered pair to h&L registers so because b c d e HL
they cannot be added up and if you want to add then one of the operon should be
stored in the accumulator so this instruction is an exception it is adding
the contents of the register pair either b c or either de with hn so one of the
operand will be in the BC registers or de resistor and one of the operand will
be in the HL register so earlier instructions whatever we have
studied about the addition of two contents or two numbers then their
addition was about 8-bit addition like 8-bit data will be added to another
8-bit data and the result is also an 8-bit data now using this instruction
guide we can add a 16-bit number and the 16-bit number it is stored in the
register pair any of the register pair BC or either de and another operand will
be stored in the Etzel resistor so both the numbers they will be added up and
the result will be stored in the HL register let’s take an example we will
write bad H so what it is doing it is adding the contents of the HL register
pair with the HL register pair okay so suppose in HL register pair if we have 0
2 and 0 3 this is the content of HL register pair then this will be added
because here we have written that h-he on e HL will be added with a chill only
so here also we will write 0 2 0 3 both will be added up and the result of the
addition will be 0 2 0 4 it will be 0 2 is 0 4 and here we will have 6 now this
addition it was a 8 bit addition also you can say that HNH these are 8 bit
data and the result is also 8 bit you can have 16-bit data also here and then
the we’ll be the 16-bit content so this
instruction it is allowing the 16-bit addition of the data now here we can
also have suppose we have bad B then the a children sister pair will be added
with the BC register pair L will be added with C and H will be added with B
higher-order registers will be added and lower order registers will be added and
accordingly if the Cadi is generated then the Cadi flag will be modified and
the result of the addition it is stored in the HL register pair only so the contents of the souls are just a
pair they are not altered if in this case like that be if we have in BC
resistor we have a 16-bit data then this resistor and HL resistor pair they are
added and the result is restored in HL but the contents of the BC register they
are not changed so the contents of the source resistor pair they are not
altered and if the result which we are getting after the 16-bit addition if it
is greater than 16 bits sub that is it means caddy is generated then this caddy
flag is said and no other Flags they are modified so this was the that
instruction next instruction we have is su B R and in this instruction is for
the subtraction it subtracts the contents of the accumulator from the
register or the memory so here we can have the operand as a register also and
as a memory location also so what this instruction suv’s doing it is to
subtract so subtracting the register or memory
from the accumulator so this instruction is to sub the
contents of the operand if the operand is memory or it can be a register
they are subtracted from the accumulator so for subtraction the subtraction is
always done like from smaller number is subtracted from the larger number now
here we are subtracting the contents of the memory or the register from the
accumulator suppose an accumulator we have the number three and in the
register suppose we are having the register B here and in this register we
are having the number zero one then one will be subtracted from three and the
result will be stored in the accumulator itself so accumulator will now have the
number zero – now this abduction it is a binary subtraction here decimal
subtraction you have to perform so so if the accumulator in this case of
cumulated was having the larger number so easily the subtraction killing we
perform now if the accumulator it is having a lesser number suppose one is in
the accumulator and three is in the register then you have to subtract the
three from one so now you will get a negative number and this negative number
will modify the flags in the sign flag it will be set that means it values will
be one if the result of the subtraction is a negative number and if some Gaddy
is generated means borrow is generated you have to borrow your then carry flag
and all these flags are also modified do you do this instruction
now if the operand it is of memory then the address of this memory location it
is a specified in the HL register Pam suppose we have written here sub n 18
then the address of this memory location will be given by the HL register pair
suppose we have a 0 5 0 here then our second number will be stored at this
memory location suppose we have one here then this one will be subtracted from
accumulator and result will be stored in the
accumulator itself so this is how the this instruction will be executed it
subtracts the contents of the operand from the accumulator and also all the
flags they are modified to reflect the result of this subtraction next
instruction we have is SBB now in case of addition we were having carry now in
case of subtraction we will have borrow so this instruction is doing what it is
subtracting the source source is our operand it can be either a register or
it can be a memory location it is subtracting the source and the borrow
from the accumulator so this instruction what it is doing the
contents of the operand operand can be either the register or it can be a
memory location it can be a memory and the borrow flag they are subtracted from
the contents of the accumulator now if the operand it meant it is a
memory then its address is given by the HL register bear and all the flags are
modified just the differences there that in the SUV instruction we are
subtracting the contents of the register and memory from the accumulator
but in this SBB instruction we are having this borrow flag also so this
borrow flag is also considered and it is also subtracted from the accumulator now
example we can write here s BB we can write any of the registers we can use
like s BB C resistor we have used or we can write s BB in hip it is M then its
address is given by the it will register pair suppose initially we have two zero
three four then one of the operand it will be in the accumulator and we have
the borrow flag we have to consider the borrow flag also if it is zero or bun
and the second operand is stored at this memory location to 0 3 4 so this is how
this instructions execute now next instruction we have is it is again for
the subtraction now this instruction is sui this I means
we have an immediate data here and this immediate data it is given in the
instruction it’s same so what you what this instruction does it subtracts the
container this 8-bit data from the accumulator so this is subtracting the
immediate data with the accumulator no borrow flag you don’t have to consider
borrow black in this only this data and the accumulator so this instruction it is subtracting
the 8-bit data from the contents of the accumulator result is stored in the
accumulator and all the flags are modified due to the execution of this
instruction now example we have sui and 45 so this number 45 it will be
subtracted from the accumulator suppose an accumulator we have 50 then 45 will
be subtracted from 50 and the result will be stored in accumulator which is
zero five and if there is any borrow suppose in this number we have is 445
suppose we are having here fifty-five then we will subtract this 55 from 50
then we have to take a borrow then the flags will be modified to reflect the
result that a borrow has been taken to perform this subtraction so this was su
I that is subtracting the Maj data from the accumulator next we have s bi8
mu theta now this instruction it considers the borrow because here B is
for the borrow and I is for the immediate data and s is for the
subtraction so this is doing the subtracting the change it from public up
with vodka so this instruction it is subtracting
the 8-bit data along with the borrow flag from the contents of the
accumulator and the result is stored in the accumulator itself and also all the
flags are modified to reflect the result of the is for the subtraction and the
addition instructions you can notice that in all the addition and subtraction
instructions we have used though one of the our contents will be in the
accumulator we have add a bi a DC and AC n these are other addition and for
subtraction we have su b then Sui then we have is bi and we have SB B so these
four were photo addition and these work for the subtraction we were having two operands two numbers
we require and one of the number is in accumulator and the second number it is
in the either it is a stored in the register or it is a stored at a memory
location and also we can have an 8-bit data directly given in the instruction
itself that is immediate datum and one instruction boson exception that is the
guide instruction which is adding two resistor pairs it is adding a registered
payer with the Etzel register pair so these were for the addition and
subtraction now next instructions which come under the category of arithmetic
operations or arithmetic instructions arithmetic instructions are increment
and decrement increment is increasing the number by one and decrement means
decreasing the number by one so first we will study the increment instruction so
we have INR R and M so this instruction is to increment register or memory by one so this
resistor it can be any of the resistors a b c we have d e h n l so any of the
resistor it can be incremented by 1 or it can be a memory also now this memory
address of this memory location will be given by the HL resistor pair so this instruction INR it is increasing
the content of the register or the memory by one and the result is stored
in the same place suppose take an example we have INR B so in the B
register a number is stored suppose it is 3 so this I naught B it will
increment the instruction this register by 1 so the content of B will now become
0 4 so the result of this increment instruction it is stored in the same
place if we have written INR C so in the C register if we have 4 then this will
be incremented and it will become 5 it will be incremented by 1 just remember
that here only the register is incremented by 1 we are not taking the
register pair here only the register it can be any of the register it can be
accumulator b c d e HL any of these registers and they can be incremented by
1 now if the operand it is of memory then the address of this memory location
will be given by tau H will register pay so this was INR okay we have a
modification of this instruction we have i NX i NH r now this instruction is used
to increment the register pair by 1 so your register pair is incremented by
one we can have the resistance pair as BC we can have de and we can have a
chain so any of these register spills can be incremented by one using this IX
instruction now result of this increment it will be stored in the same place
let’s take an example if we have BC register we have eight zero five zero
then it will be plus one incremented by one and the result will be BC will have
eight zero five one because we will add this one in the lower order register C
is the lower order register so plus one will make it fifty one and eighty will
remain as it is so this complete register pair is incremented by one so
the sine X instruction we can use to increment the register pair and result
is restored at the same place similarly we can have an X this was an X B then we
can have an X D also and we can have INX it’s also so through this the BC
register pair will be implemented through this de will be incremented and
through this H L will be incremented so here register pairs are incremented by
one now these were for the increment and then we can have the same instructions
just difference of this will be that now we will have deployment in the register
or the register pair by one so just we were having iron ore for
incremented INR a denim here we have DC RR n m4 decrementing the register or
memory by one so the contents of the register register
can be BC accumulator can also be their de h L any of the register it can be
decremented by 1 and if it is immunity then the address of this memory location
it is a specified in it shall register pair the result of this instruction it
is stored in the same place suppose we have I this we have d CR and C and in C
register we are having 5 so this will be decremented by 1 and the new contents
will be 0 4 so the content will remain stored at this the result is stored in
the same place it is not stored in the accumulator it is stored at the same
place and the number is decremented by 1 similarly we can have d CR m and M the
setlist will be specified in HL register pair we have supposed to 0 3 4 then at 2
0 3 4 if we have a number 6 then it will be decremented by 1 and now the new data
will be 0 5 so this is of this instruction VCR works now next
instruction we have is d CX this instruction it decrements the
registered pair buy one just like I on expose for incrementing the registered
pair by one DC X is four decrementing the register pair by one so the contents of the register pet will
be decremented like b c d e and agent any of the register pair it can be
decremented by 1 and the result is stored at the same place now in de
suppose we are having 2 0 3 4 then it will be decremented by 1 so the new
contents of the de register pair will be 2 0 3 3 and we can have the instruction
for this d CX d we can have d CX be also we can have d
CX h also so this is decrementing the register pairs by 1 so these were the
increment and decrement instructions I not INEX we were having INR INEX for the
increment and we have DC r and d CX for the degree matter now next instruction
we have this be a a this is decimal a just accumulator B is for decimal a is for a just and
this a is for the accumulator this instruction is used in the BCD
operations when the microprocessor it is performing the BCD addition then this
instruction is used so this instruction it is used to bend
the microprocessor it is performing BCD operations BCD means battery coded
decimal now in the microprocessor we have all the numbers in the decimal
notation that is in the form of zero and once so the this instruction decimal a
just accumulator it changed the contents of the accumulator which are given in
the binary value to two 4-bit BCD digits because accumulator it is an 8-bit
transistor so we were having 8-bit data now this 8-bit data which is given in
the accumulator it has changed into two 4-bit data’s this is for bit and 4-bit
pitches in the BCD notation because this 8-bit data it is in the decimal notation
so it will be converted into the BCT dot notation and it will get converted into
two 4-bit data’s now this is the only instruction which is using the auxilary
carry flag to perform this BCD conversion so it can be asked that which
instruction uses the auxilary carry flag so this is the answer that the decimal
is just accumulator instruction it uses the auxilary carry flag to perform the
BCD conversion although other flags they are also modified to reflect the result
of the addition now how this BCD conversion is performed
let’s see so if I do the note of the four bits
suppose we are having the number this is our 8 bit data and the lower or the four
bits they are greater than 9 or if the auxilary caddy is said so if this
auxilary carry flag it is said that means its value is 1 then this
instruction it adds 6 to the lower order 4 bits so
this 6 will be added to the lower order 4 bits n we can have the 4 bits which
are in the BCD notation now if the value this was for the lower order 4 bits now
if we have the value of the higher order 4 bits it is greater than 9 or if this
auxilary carry flag it has said that means it is 1 then the accumulator then
this instruction it adds 6 to the higher order bits so if a higher order bits are
greater than 9 then the instruction it adds and if this caddie flag it is said
then this 6 is added to the higher order bits and the result will we have is the
4 bits in the BCD notation so this is how the BCD conversion is performed how
a decimal number is this converted into the BCD notation if lower order bits
they are greater than 9 then add 6 to the lower order bits and if the higher
order bits they are greater than 9 carry flag asset then add six to the
higher order bits to perform this BCD conversion in the microprocessor we will
just write D a a this instruction it does having implicit addressing mode
implicit addressing because the operand it is given in the instruction itself
operand is the data or it is something on which we are performing the operation
so we are here performing the operation on the accumulator and accumulator it is
specified in the instruction itself we need not to specified externally it is
implicit in the instruction so this type of addressing is implicit addressing so
this instruction da it is an example of implicit addressing mode so this was all
about the arithmetic instructions the arithmetic instructions they involve the
operations like addition subtraction increment decrement and the last
instruction we studied was the decimal adjust accumulator is the BCD conversion
so these instructions were for the fall in the category of arithmetic
instructions next we will study the branching instruction

8 thoughts to “Arithmetic Instructions of 8085 – Instruction Set of 8085 Microprocessor – Microprocessor”

  1. Hello Friends,

    Watch Complete Video Series of Subject Microprocessor only on Ekeeda Application.

    Use Coupon Code "NEWUSER" and access any one Subject free for 3 days!

    Download Ekeeda Application and take advantage of this offer.

    Android:- https://play.google.com/store/apps/details?id=student.ekeeda.com.ekeeda_student&hl=en

    iOS:- https://itunes.apple.com/tt/app/ekeeda/id1442131224

Leave a Reply

Your email address will not be published. Required fields are marked *