LXI H,2500H
MOV C,M
L3: DCR C
JZ L4
MOV B,C
LXI H,2501
L2: MOV A,M
INX H
CMP M
JNC L1
MOV D,M
MOV M,A
DCX H
MOV M,D
INX H
L1: DCR B
JNZ L2
JMP L3
L4:RST 1





Is this wrong????? the program is going on an infinite loop