Sorting Program

Zahid's Avatar, Join Date: Apr 2007
Go4Expert Member
Hi...


Could u please send me the complete program of "Sorting of numbers"?
In Ascending Order.




Regards ,
Zahid.
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
Would you like fries with that? Supersized?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by DaWei
Would you like fries with that? Supersized?
I would prefer a Pizza.
0
Zahid's Avatar, Join Date: Apr 2007
Go4Expert Member
Quote:
Originally Posted by DaWei
Would you like fries with that? Supersized?
Hi sir,


I need a complete ALP for sorting of nos in ascending order in microprocessor 8085.
I couldn't understand what does fries and supersized mean with my question.

Could you help me regarding the same?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
You are asking for something which is like what we are asking from you. If you want someone to write complete assignment for you as if someone on the roadside is asking for something like pizza to you.
0
Zahid's Avatar, Join Date: Apr 2007
Go4Expert Member
Quote:
Originally Posted by shabbir
You are asking for something which is like what we are asking from you. If you want someone to write complete assignment for you as if someone on the roadside is asking for something like pizza to you.



Hi,

I think you assume that I am asking the complete program from you. Actually i got stuck with the program so i wanna refer with the correct one.


Whatever i wrote was:


MVI B,05H ; i need 5 nos to be sorted, this B reg acts as a counter
LXI D,0000H ; i wanna store data to be sorted from 0000H
SAME: LDAX D ; loading DE content to A
MOV B,A ; storing A in B
INX D ; incrementing DE by 1
DCR B ; dec B
JZ OVER ; if B goes to zero it should HALT
CMP B ; comparing B with A
JC SAME ; if the compare result sets CY flag, go to label SAME

SWAP: XCHG ; exchange content of DE and HL
JMP SAME ; go to label SAME to check the count in B
OVER: HLT



Since I'm new to microprocessor I donot know much in this program. So I asked you to kindly assist me on the same


Thanks,
Regards,
Zahid
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
It looks like you are moving everything into B.

MVI B,05H - You have the counter in B
MOV B,A - Content of memory location is also moved into B.
0
DaWei's Avatar, Join Date: Dec 2006
Team Leader
As Shabbir says, here is your basic problem: you're using B as a counter, but you overwrite B in the fourth instruction. Bye, bye, B as a counter.