Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   Sorting Program (http://www.go4expert.com/forums/sorting-program-t3835/)

Zahid 11Apr2007 16:10

Sorting Program
 
Hi...


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




Regards ,
Zahid.

DaWei 11Apr2007 18:04

Re: Sorting Program
 
Would you like fries with that? Supersized?

shabbir 11Apr2007 18:50

Re: Sorting Program
 
Quote:

Originally Posted by DaWei
Would you like fries with that? Supersized?

I would prefer a Pizza.

Zahid 11Apr2007 19:34

Re: Sorting Program
 
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?

shabbir 11Apr2007 20:33

Re: Sorting Program
 
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.

Zahid 11Apr2007 21:55

Re: Sorting Program
 
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

shabbir 11Apr2007 22:26

Re: Sorting Program
 
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.

DaWei 12Apr2007 08:59

Re: Sorting Program
 
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.


All times are GMT +5.5. The time now is 11:25.