Sorting Program

Go4Expert Member
11Apr2007,16:10   #1
Zahid's Avatar
Hi...


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




Regards ,
Zahid.
Team Leader
11Apr2007,18:04   #2
DaWei's Avatar
Would you like fries with that? Supersized?
Go4Expert Founder
11Apr2007,18:50   #3
shabbir's Avatar
Quote:
Originally Posted by DaWei
Would you like fries with that? Supersized?
I would prefer a Pizza.
Go4Expert Member
11Apr2007,19:34   #4
Zahid's Avatar
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?
Go4Expert Founder
11Apr2007,20:33   #5
shabbir's Avatar
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.
Go4Expert Member
11Apr2007,21:55   #6
Zahid's Avatar
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
Go4Expert Founder
11Apr2007,22:26   #7
shabbir's Avatar
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.
Team Leader
12Apr2007,08:59   #8
DaWei's Avatar
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.