Thursday, October 15, 2015

8085 Program To Subtract Two 16 Bit Numbers


Let us suppose that the first 16 bit number is stored in memory location 9000H and the second number is stored in memory location 9002H. These two 16 numbers are to be subtracted and the result is to be stored in memory location 9004H.

Algorithm:

  1. Start.
  2. Load first data from 9000H directly into register pair HL.
  3. Exchange contents of register pair DE and HL.
  4. Load second data from 9002H directly into register pair HL.
  5. Move contents of register L into accumulator A.

8085 Program To Add Two 16 Bit Numbers

Let us suppose that the two 16 bit numbers are stored in 9000H and 9002H. These two 16 but numbers are to be added and the result is to be stored in memory location 9004  and the carry (if generated) is to be stored in memory location 9006H.

Algorithm:

  1. Start.
  2. Initialize register C for using it as a counter for storing carry value.
  3. Load data into HL register pair from one memory address (9000H).
  4. Exchange contents of register pair HL with DE.
  5. Load second data into HL register pair (from 9002H).

Wednesday, October 14, 2015

8085 Program To Subtract Two 8 Bit Numbers

Let us suppose that we store the two 8 bit numbers that are to be subtracted in the memory location 9000H and 9001H. Now the difference of the numbers is to be stored in 9100H and borrow, if present, is to be stored in 9101H.

Algorithm:

  1. Start
  2. Initialize one register (suppose C) to 00 to store the borrow value.
  3. Load HL register pair with content of memory location 9000H.
  4. Move the content of memory into accumulator.
  5. Increment the register pair HL.

8085 Program To Add Two 8 Bit Numbers


Let us suppose that we store the two 8 bit numbers that are to be added in the memory location 9000H and 9001H. Now the sum of the numbers is to be stored in 9100H and the carry is to be stored in 9101H.

Algorithm:

  1. Start
  2.  Initialize one register (suppose C) to 00 to store the carry value.
  3. Load the first data (stored in 9000H) into accumulator A.
  4. Load the second data (stored in 9001H) into register pair HL.