Monday, October 26, 2015

8085 Program to Find the Smallest Data

Let us suppose that we have 10 data’s which are stored from memory address 9000H to 9009H. We find the smallest number from these data’s and store the value in 9100H.

Algorithm:

  1. Start.
  2. Load into register pair HL from memory location 9000H.
  3. Move 09 into register C.
  4. Move the contents of memory M into accumulator A.
  5. Increment register pair HL by 1.

8085 Program to Find the Greatest Data

Let us suppose that we have 10 data’s which are stored from memory address 9000H to 9009H. We find the largest number from these data’s and store the value in 9100H.

Algorithm:

  1.   Start.
  2. Load into register pair HL from memory location 9000H.
  3. Move 09 into register C.
  4. Move the contents of memory M into accumulator A.
  5. Increment register pair HL by 1.

8085 Program to Find the Square of a Number

Let us suppose that the number whose square root is to be found is stored in memory location 9000H and the result is to be stored in memory location 9100H.

Algorithm:

  1. Start.
  2. Load into register pair HL from memory address 9000H.
  3. Initialize accumulator A with 00.
  4. Move contents of memory M into register C.

Sunday, October 25, 2015

8085 Program to Add 10 Data Starting From Specific Memory Address

Let us suppose that 10 data’s are stored in memory location from 9000H to 9009H. These data’s are to be added and let us store the result in memory location 9100H.

Algorithm:

  1. Start.
  2. Load into register pair HL from memory location 9000H.
  3. Load into register pair DE from memory location 9100H.
  4. Move 09 into register C as counter.

8085 Program to Copy 16 Data from One Location to another Location

Let us suppose that the 16 data are stored starting from 9000H and we are to move the data into location starting from 9100H.

Algorithm:

  1. Start.
  2. Load into register pair HL from memory location 9000H which is the source location.
  3. Load into register pair DE from 9100H which is the destination location.
  4. Move 10 into register C which acts as counter (16 in decimal = 10 in hexadecimal).

8085 Program To Divide Two 8 Bit Numbers

Let us suppose that we store the two 8 bit numbers that are to be divided in the memory location 9000H and 9001H. Now the remainder of these numbers is to be stored in 9002H and the quotient is to be stored in 9003H.

Algorithm:

  1. Start
  2. Initialize register C with 00.
  3. Load into accumulator directly from location 9000H.
  4. Move content of A into register B.
  5. Load into accumulator directly from 9001H.
  6. Compare register B with accumulator A.

Wednesday, October 21, 2015

8085 Program To Multiply Two 8 Bit Numbers

Let us suppose that we store the two 8 bit numbers that are to be multiplied in the memory location 9000H and 9001H. Now the product of these numbers is to be stored in 9002H and the carry is to be stored in 9003H.

Algorithm:

  1. Start
  2. Initialize register C with 00.
  3. Load into accumulator directly from location 9000H.
  4. Move content of A into register B.
  5. Load into accumulator directly from 9001H.

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.