Subtraction of Two 8 bits number with consideration of Borrow in 8085 Microprocessor

Here, we are going to learn how to subtract two 8 bits numbers with consideration of borrow in 8085 Microprocessor?
Submitted by Samiksha Yadav, on October 19, 2018

Problem statement:

To subtract two 8bit numbers with consideration of borrow using 8085 microprocessor.


  1. Load the H-L pair with the address of first memory location.
  2. Move the content of H-L to accumulator.
  3. Increment H-L pair to next memory location.
  4. Load the register B with the memory location of second data.
  5. Initialize register C with 00H. this will store the borrow (if any).
  6. Subtract the content of accumulator with the content of register B and the result will be stored in accumulator automatically.
  7. If carry flag is set then increment register C.
  8. Increment H-L pair.
  9. Move result from accumulator to memory location 3002H.
  10. Increment H-L pair.
  11. Move borrow from register C to memory location 3003H.


Address	Mnemonics   Operands
2000	LXI         H,3000H
2003	MOV         A, M
2004	INX         H
2005	MOV         B, M
2006	MVI         C, 00H
2008	SUB         B
2009	JNC         200D
200C	INR         c
200D	INX         H
200E	MOV         M, A
200F	INX         H
2010	MOV         M, C
2011	HLT


    3000H:		05H
    3001H:		02H

    3002H:		03H
    3003H:		00H

Hence successfully subtracted two 8 bits numbers with consideration of borrow.

Help this article has answered all your questions. Like and comment below if satisfied.

Related Tutorials


Comments and Discussions!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.