Microprocessor 8085 Programs

1) Add Positive Nos.

 
  LXI H, 2100
  MVI B, 0
  MVI D, FF
  MVI C, 5
START: MOV A, M
               RLC JC
               NEXT
               RRC
               ADD B
               CMP D
               JC END
               MOV B, A
  NEXT:  INX H
                DCR C
                JNZ START
      END: STA 2000
                HLT

2) Bubble Sort

MVI B, 05
START:           LXI H, 2100
MVI C, 04
BACK:            MOV A, M
INX H
CMP M
JC END
STA 2200
MOV A, M
DCX H
MOV M, A
LDA 2200
INX H
MOV M, A
END:               DCR C
JNZ BACK
DCR B
JNZ START
HLT dot

3) Exchanging the Array Elements (Swap 2 Arrays)

 LXI H, 2100
 LXI D, 2200
 MVI C, 0A
START:            MOV A, M
 STA 2300
 LDAX D
 MOV M, A
 LDA 2300
 STAX D
 INX H
 INX D
 DCR C
 JNZ START
 HLT
dot          

4) Find the Highest No in an Array

LXI H, 2100
MVI C, 03
MOV A, M
DCR C
INX H
START:           CMP M
 JNC NEXT
 MOV A, M
 NEXT:            INX H
 DCR C
 JNZ START
 STA 2200
 HLT

Comments

Popular Posts