SUB Subtract Instruction
This instruction is used to subtract the contents of any register or memory location from the contents of accumulator. There are two formats as follows:
a.Subtract the contents of Register The contents of register R are subtracted from the contents of accumulator and result of operation is stored in the accumulator. Here register R may be any one of the A, B, C,D, E,H or L registers.
SUBR ( A- A - R)
Flags : All flags are modified according to the results.
As we have already discussed in chapter 1 that the subtraction is done using 2 s complement method in microprocessor. Followings steps are followed by the 8085 microprocessor while performing subtract operations.
Step1. Converts subtrahend ( the number to be subtracted) into its 1 s complement form.
Steps2. Adds 1 to the 1 complements form to obtain 2 complement form the subtrahend.
Step3. Adds 2 complements to the minuend ( the contents of the accumulator).
Step 4. Complements the carry flag.