In this section we will see how to reset the accumulator content in Intel 8085 and 8086 microprocessors.
In both of the microprocessors, there are four instructions to do the work. These instructions are doing the same in both cases.
Let us see the 8085 instructions first to reset the Accumulator.
|MVI A,00H||This instruction loads 00H into the accumulator. This is two-byte instruction.|
|ANI 00H||This instruction performs AND operation between accumulator and 00H. This is also a two-byte instruction.|
|XRA A||This one-byte instruction is performing the XOR operation with accumulator itself.|
|SUB A||SUB A is another one-byte instruction. It subtracts accumulator value from the accumulator.|
The XRA A and SUB A both are one-byte instruction, but as XRA A is logical, it performs faster than the other. So XRA A is best for clearing/resetting Accumulator content than other three instructions.
Now let us see how to reset accumulator in 8086 microprocessor.
|MOV AX, 0000||This instruction loads 0000H into the accumulator.|
|AND AX, 0000||This instruction performs AND operation between accumulator and 0000H.|
|XOR AX, AX||Here we are performing XOR operation on AX and AX. The source and destination both are set to AX.|
|SUB AX, AX||Here also the source and destination is AX and AX. This instruction subtracts AX value from AX itself to make it 0000H|