Logical Instructions of 8085 – Instruction Set of 8085 Microprocessor – Microprocessor

Logical 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. Hello Friends, this video is on the topic logical instructions in eight zero eight five Microprocessor, here we will study the logical instructions like logical and logical or logical exclusive or not compare and the rotate instructions which are available in the instruction set of eight zero eight five Microprocessor, So let us start with our topic. The logical instructions they perform the logical operations like logical and logical or illogical exclusive or not compare complement rotate all these instructions are all these operations are performed by these instructions so let us study one by one all the instructions which are available in the eight zero eight five microprocessor first instruction is the compare instruction and it’s mnemonic is cmp you so this instruction it compares the contents of the register or the memory with the accumulator suppose we are comparing the contents of the register so we will write cmp okay it can be any of the register like the a resistor accumulator b c d e HL any of the six registers of no it 0 8 5 microprocessor if we are comparing the memory then we are going to write cmp m okay and M is the address of the memory location which is there in the HL pair register so it is going to compare the contents of the register and memory with the accumulator now how this comparison is done suppose that if the contents of the accumulator and equal to the register or the memory so if we perform the subtraction like if we are subtracting the contents of the accumulator and the register or memory then if they are equal we will get the result as 0 because both the contents are equal so this attraction will result into a answer 0 okay so the when we are getting a result after any arithmetic or logical operation are 0 then the zero flag is said okay so this comparison is done by performing the subtraction okay and when subtraction is done then we will see what is the effect on the zero flag so if the contents of the accumulator they are less than the contents of the register or the memory then carry flag is sick means carry flag is equals to one if the contents of the accumulator are equal to the contents of the register and memory then zero flag is said okay and if the contents of accumulator are greater than the register or the memory then both the Cadi flag and the zero flag they are reset ok because what we are doing we are subtracting the register or memory contents from the accumulator so if the if this is means this content is greater then we have to take a carry we have to borrow it okay so caddy flag will be said in this case caddy flag will be reset because no borrow or carry is generated in that case and zero flag is also reset because the contents are not equal to each other result will not be zero and then the contents are equal because the result we will get as zero we are performing the subtraction so zero flag will be set so we are going to check the contents we will compare both the contents means to register with the accumulator and memory with the accumulator and we will check the conditions of the flag carry flag and zero flag will be checked if we found that the Cadi flag is set then you can say that the contents of accumulator are less than the contents of the register or the memory if we found that zero flag is set then the cartons are equal to each other and if we found that the khaki flag and zero flag both are reset then the contents of accumulator of greater so in this way the comparison is done in the 8 0 8 5 microprocessor using the instruction CM p okay next instruction is C P hi okay that means compare the immediate data with the accumulator you so because whenever I is written in any of the instruction of eight zero eight five this I means immediate okay so after this CPI and 8-bit data is written in the instruction and the contents of the accumulator and this 8-bit data they are compared because accumulator is also an 8-bit register so both the 8-bit data will be compared with the contents of the accumulator and again the same comparison is done by the subtraction by performing the subtraction and same conditions are changed here that if the contents of the accumulator are less than the 8-bit data then then caddy flag is sick zero flag is set and if accumulator is greater than data then caddy and zero Botha reset okay so same comparison is done here but in CMP we are comparing a register and memory with the accumulator here we are comparing an 8-bit data with the accumulator next instruction is logical and instruction and for that we are having done demonic as a n8 so this is going to logical and the register or memory with the accumulator so if it is a n/a then it is going to compare the register and memory with the or it is going to logically and the contents of the register and memory with the accumulator so if we are comparing the sister we will write a n/a and the register that means a b c d e it can be any of these register b c d e HL any of the register we can use him if we have come logically ending the memory then we will write m here okay so it is going to logically add the contents of the accumulator and the contents of register or the memory location and whatever will be the result the effect of it will be shown in the flags like if caddy is there or zero flag is affected then we can check the conditions of these flags also next instruction is a n I this instruction it logically adds the contents of the accumulator with the 8-bit data which is given in the instruction itself so it will be a n I and then we will have an 8-bit data yong so this because we are having i here it means an image a data is there okay so 8-bit data and the accumulator their contents will be added with each other and the result of that will be stored in the accumulator itself the result of all the logical and the arithmetic operations it will be stored in the accumulator itself okay so your we are logically Andy and the 8-bit data result is stored in the accumulator itself and you do this instruction so although flags are affected like sign flag zero flag parity flag Kagi flag all the flags will be affected hope you can see modified you do this instruction next instruction is xr/e this instruction is going to exclusively or the contents of the register pair a register or memory with the contents of the accumulator you and the result of this operation will be stored in the accumulator itself so if we are writing X re R then it will be a register and if it we are writing X R a.m. then it will be your memory location okay and the address of that memory location will be given get from the HL register pair means the address to which the H will register pair is pointing that will be the address of the memory location now due to this instruction the flags s Z P they are modified and the carry and the auxilary carry flag they are reset ok now in the exclusive or operation we know that when we are having opposite values like if we are having 0 & 1 & 1 & 0 then we will get a high on the output okay when we are exclusively ordering the contents then if when we are having different values different bits like 0 1 or 1 0 then we will get an high output and if we are having same then we will get up low output so this is how the exclusive or operation is performed similarly if we are having a next instruction is XR I so this is also going to exclusively or the contents of the accumulator with the 8-bit data because here we are having I for the immediate so xri and then we will have an 8-bit data over here so your register and memory are exclusively or with accumulator and here the 8-bit data will be the operate is exclusive or with accumulator and the result is stored in the accumulator itself and all the flags they are modified due to this operation now next instruction next logical instruction is logical or operation we have steady logical and logical exclusive on here now we are having logical or o R a so it is going to logically or the contents of the accumulator you so if we are having a are a then our it will be a register and O our e if we are having M then it will be a memory location again result is a stored in the accumulator itself and all the flags are modified as Z p c– and auxilary carry result of this operation is also stored in the accumulator itself and similar to this we are having the other instruction which is o R I and here we will have an 8-bit data because I is there so it will be for an image a data which is given in the instruction itself the operand is the 8-bit data and it will be logically or with the contents of the accumulator you result is again stored in the accumulator itself and all the flags they are modified do do this instruction so these instructions are performing the logical operations like logical and logical or and logical exclusive all then we have the rotate instructions also they come under this logical instructions category rotate operations so the next logical instruction is rotate accumulate them so these are the rotate instructions and the mnemonic for this is RL C there is no operand in it okay only we are going to write the mnemonic RLC in the program and the operand it is means it is implicit in the instruction itself means whenever we are writing RLC it is going to rotate the contents of the accumulator to the left inside by one bit okay you so in this each binary bit of the accumulator is rotated left by one position so the accumulator it is an 8-bit register so all the bits they will be rotated to the left hand side by one bit so the d7 bit it will now go into the D note position D note is shifted to d1 d1 at d2 d2 is shifted to one bit left hand side D 3 D 3 will go become d 4 d 4 will become D 5 D 5 will become D 6 and D 6 bit will become D 7 so in this way one bit will be shifted to the left hand side and the d7 bit will become the D not bit so here the accumulator is rotate to the left hand side ok now this D 7 bit when it is shifted to the D not bit it also goes to the carry flag okay so carry flag is modified according to the bit number b7 if suppose bit number d7 it is 1 so caddy flag will be set because this d7 bit will goes to the carry flag also and to the D note position also similarly if the d7 bit if it is 0 then the carry flag will be reset so here due to this RLC instruction the carry flag is modified according to the bit number d7 the remaining flux is Z P and auxilary carry they are not affected okay and because this instruction is not having any operand operand is implicit in it so in the program if we are using this instruction we will just write the mnemonic RL C next instruction is our RC that is rotate accumulator right mnemonic for this is mnemonic means that how we are writing or using that instruction in the main program what is the code for that so rotate accumulator right it’s mnemonic is our our C here also we are having no operand operand is implicit in it and the operand is the accumulator so the rotate operation it has to be performed on the accumulator and the contents of the accumulator are rotated to the right-hand side by one bit position so all the bits will be rotated or shifted to the right-hand side by one bit position you so the bit number D not it will now become the bit number d7 all the bits are rotated so we are having the 8 bit accumulator and this denote bit it becomes the d7 bit D not is the least significant bit and the d7 it is the most significant bit so this LSB will now become the MSB okay and also this bit is shifted to the carry flag okay so this bit it becomes the d7 bit also and it goes in the carry flag also so here also the kaki flag is modified according to the bit number D not if it is 0 carry flag will be reset if it is 1 then carry flag will be set now all the other flag signs zero parity and auxilary caddy they are not affected and when we are using this instruction we will just write our RC in the main program we are not going to specify any operon because operand is implicit in itself and the operand is a accumulator I after this operation the result will be stored in the accumulator itself because we are rotating the contents of the accumulator only so the accumulator it will be loaded with the new contents or new rotated contents which are shifted to the right-hand side by one bit position next instruction is protein accumulator left to carry mnemonic for this is our a and no operand is their operand is again the accumulator and now we are going to rotate the contents of the accumulator to the left-hand side but here we are using the carry flag also so here we are having our a L okay you so your rotation is done but the but this rotation is done through the Caddy fly let’s see how this operation is performed now all the wigs have to be shifted to the left hand side by one bit position so the bits are shifted to the left hand side but now the d7 bit it will be shifted to the carry flag and caddy flag will become the B not bit all the other bits they will be shifted to the left hand side by one bit position okay so in the earlier instruction that is RLC what we are doing we are shifting all the bits to the left hand side by one bit position and d7 was becoming the D not bit and also this d7 bit is going to the carry flag but now 37 bit we’ll go to the carry flag means here and this carry flag whatever will be the value of the carry whether it is set or reset means it’s new or one it will become the need not bit you so this caddie flag it is modified according to the b7 bit just like the RNC okay and the caddie flag will now become the bit number D not so this is the instruction rotate accumulator left through caddy are a n-now although other flags like sign zero parity and the auxilary carry they are not modified only the carry flag is affected due to this instruction next instruction is rotate accumulator right through carry the mnemonic for this is our a our no operand is their operand is the accumulator so the contents of the accumulator they will be rotated or shifted to the right hand side through the carry so accumulator it is an 8-bit register so all the bits will be shifted to the right hand side by one bit position but in the right hand side direction so D not bit here we have to use the carry also so the D not bit it will become the carry flag carry flag will become the d7 bit you so if we see here we are having the 8-bit accumulator all the bits have to be shifted to the right-hand side by one bit position but we have to use the carry flag so D not will become the carry flag and carry flag will become the d7 bit and all the other bits they will be shifted to the right-hand side by one bit position so this is the instruction RA are now here the carry flag it is modified according to the bit number V not okay and all the other flags like sign zero parity can absolutely carry they will not be affected you so these were the four rotate instruction ar-ar-ar LC and re l and r r c okay next logical instructions we are having other complement instructions complement accumulator the mnemonic for this instruction is we have to complement the accumulator so see M a now here also we will be having no operate because operand is specified in the instruction itself it is implicit that is the accumulator so the contents of accumulator they are complemented complement means that if the bittle 0 it will become 1 and if the bit is 1 it will become 0 ok complement of 0 is 0 and 1 they are complement of each other ok so your each bit or we can say the contents of accumulator they are complemented suppose that accumulator it is having the content this is the content of the accumulator now when we are using this instruction complement the accumulator that is CMA the new contents of the accumulator are instead of a 1 will be complemented it will become 0 0 is complemented it will become 1 0 will become 1 1 will become 0 so this is the new contents of the accumulator ok next instruction is complement carry the mnemonic for this is CMC and no operand is to be specified because here the operand is the Cadi flag ok so whatever will be the contents of the Cadi flag they will be complemented suppose if the carry flag is set it will be reset and if it is reset it will be set you so if the caddy flag is set it will be reset say it means its value is 1 and reset means its value will become zero and if the carry flag is reset it will be set means if it is 0 it will become 1 so we are having 2 instructions related to the complement operation complement accumulator and complement the carry next instruction is set caddy now the mnemonic for this is St C no operand operand is the Caddy flag now this instruction it sets the carry flag to 1 so whatever will be the key value of the catty flag it will now become one means the Cadi flag will be set and all the other flags like sine zero parity auxilary caddy are not affected due to this instruction only the carry flag is affected okay so the instructions we have studied like rotate instructions and complement then set carry instructions these instructions do not affect the flags like sign zero parity and auxilary carry only the Cadi flag which is associated with these instructions only carry flag is affected so in this video we studied about the logical instructions which are present in the instruction set of 8 0 8 5 microprocessor under the statically logical instructions we studied the instructions logical and logical or logical exclusive or and then we studied the set carry complimentary complement accumulator rotate instructions we studied for rotate instruction rotate accumulator left rotate accumulator right we have used carry also there so all the instructions under this category logical instructions we have studied in this video so I hope that this topic is clear to you thank you

4 thoughts to “Logical 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 *