Free Electronic Circuits & 8085 projects

Electronic projects with circuit diagram and 8085 microprocessor projects.

Arrange in Descending order

Published on Nov 17 2009 // Trainees

Statement: Arrange an array of 8 bit unsigned no in descending order

  • START:MVI B, 00 ; Flag = 0
  • LXI H, 4150 ; Count = length of array
  • MOV C, M
  • DCR C ; No. of pair = count -1
  • INX H ; Point to start of array
  • LOOP:MOV A, M ; Get kth element
  • INX H
  • CMP M ; Compare to (K+1) th element
  • JNC LOOP 1 ; No interchange if kth >= (k+1) th
  • MOV D, M ; Interchange if out of order
  • MOV M, A ;
  • DCR H
  • MOV M, D
  • INX H
  • MVI B, 01H ; Flag=1
  • LOOP 1:DCR C ; count down
  • JNZ LOOP ;
  • DCR B ; is flag = 1?
  • JZ START ; do another sort, if yes
  • HLT ; If flag = 0, step execution

Related Programs for Beginners: (Click down)

Exchange the contents of memory locations

Pack the unpacked BCD numbers

Program to test RAM

Add each element of array with the elements of another array