1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Sorting Program

Discussion in 'Assembly Language Programming (ALP) Forum' started by Zahid, Apr 11, 2007.

  1. Zahid

    Zahid New Member

    Joined:
    Apr 6, 2007
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    Hi...


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




    Regards ,
    Zahid.
     
  2. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    Would you like fries with that? Supersized?
     
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    I would prefer a Pizza.
     
  4. Zahid

    Zahid New Member

    Joined:
    Apr 6, 2007
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    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?
     
  5. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    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.
     
  6. Zahid

    Zahid New Member

    Joined:
    Apr 6, 2007
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0



    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
     
  7. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83
    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.
     
  8. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    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.
     

Share This Page