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

sorting of numbers in assembly langauge programming

Discussion in 'Assembly Language Programming (ALP) Forum' started by nikhil4u, Mar 4, 2006.

  1. nikhil4u

    nikhil4u New Member

    Joined:
    Mar 4, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    sorting of numbers in assembly language programming

    hey shabbir i am new to assembly programming
    can u send me a program for sorting of numbers in assembly language for 8085 microprocessor.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
    Hey its not good to give the complete program but will definitely help you with the main part of the program. It finds the maximum number and this can help you write the sort program
    Code:
    LXI H,ADD1
    ; Load 16 bit data in reg pair H
    MOV C,M
    ; Load the counter to compare the total no of data to count
    INX H
    ; Increment the address to point to the next location
    MOV A,M
    ; Load the second no in the accumulator
    ADD2:
    ; Label to jump at
    INX H
    ; Increment the address to point to the next location
    CMP M
    ; Compate the accumulator with the next no in series
    JNC LESS:
    ; Jmp to a location with the comparision returns a carry
    MOV A,M
    ; Move the content of the location M into the accumulator if the Jump fails
    LESS:
    ; Label to jump at
    DCR C
    ; decrement the counter
    JNZ ADD2
    ; Jump if there is anything more to compare
    STA ADD_OUTPUT 
    ; Accumulator will contain the Max no and move to the out put address.
    
    Thanks
    Shabbir
     
  3. coderzone

    coderzone Super Moderator

    Joined:
    Jul 25, 2004
    Messages:
    734
    Likes Received:
    37
    Trophy Points:
    0
    Re: sorting of numbers in assembly language programming

    Do you mind sharing the programs with us.
     
  4. nikhil4u

    nikhil4u New Member

    Joined:
    Mar 4, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    actually i have to complete an assignment in which i have to design an emulator in which sorting can be done as chief operation.
     
  5. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
    The routine will help you to design the sort program.
     
  6. khurramee1

    khurramee1 New Member

    Joined:
    Oct 30, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    sir i need a programme in Assembly Language to find the maximum number and the minimum number from an array of ten numbers.
     
  7. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
    khurramee1 please post it as seperate thread for it to be seen by the experts.
     
  8. emreee

    emreee New Member

    Joined:
    May 12, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Please Help me,

    I dont know 8085 assembly but this is a school homework

    1) D recorder < 11
    E recorder < 11
    D+E = write to B recorder
    But If Not E < 9 or Not D < 9 Then exit program

    2) If (01H + 03H) < AAH Then
    01H + 03H = write 2000H
    Else
    01H + 03H = write 3000H
    End If

    This Questions write to assemly 8085 language.Please Help me :embarasse
     
  9. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    How come you don't have knowledge of 8085 assembly but are getting homework projects anyway? If you're not on the course then you shouldn't get the homework. If you are on the course then (a) you've been goofing around and deserve to fail or (b) you'll know some 8085 in which case you can at least get started and show us where you're stuck, at which point we'll help.
     
  10. digitalpbk

    digitalpbk New Member

    Joined:
    Jun 23, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    thanx for the codes...
    you can check out my online simulator and assembler and play with it to start coding for 8085 ... sadly i cant post any links here .. so it is at

    labs.kitiyo.com/8085/

    check out
     
  11. bZk

    bZk New Member

    Joined:
    Jul 23, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Find Smallest byte from array of ten bytes. Assuming that the bytes are stored in memory from address location 5000H ;

    Code:
     LDA 5000H ;[Loads accumulator with data from memory location 5000H i.e. our first number]
     LXI H,5001H ;[Moves 5001H into register pair H-L]
     MVI C,09H ;[Initialize counter at 9 as we need to compare nine times]
    L2: CMP M ;[Compare the number in memory with that in accumulator]
    JC L1 ;[Jump if CF = 1]
    MOV A,M ;[Move data from memory to accumulator]
    L1: INX H ;[Increment H-L pair data]
    DCR C ;[Decrement Register C Data]
    JNZ L2 ;[Jump if ZF = 0]
    MOV M,A ;[Move data from accumulator to memory]
    HLT ;[Halt]
    
    On the similar lines, we will write the program to find the greatest bit as follows


    Code:
     LDA 5000H ;[Loads accumulator with data from memory location 5000H i.e. our first number]
     LXI H,5001H ;[Moves 5001H into register pair H-L]
     MVI C,09H ;[Initialize counter at 9 as we need to compare nine times]
    L2: CMP M ;[Compare the number in memory with that in accumulator]
    JNC L1 ;[Jump if CF = 0]
    MOV A,M ;[Move data from memory to accumulator]
    L1: INX H ;[Increment H-L pair data]
    DCR C ;[Decrement Register C Data]
    JNZ L2 ;[Jump if ZF = 0]
    MOV M,A ;[Move data from accumulator to memory]
    HLT ;[Halt]
    
     
  12. aryanilu143

    aryanilu143 New Member

    Joined:
    Dec 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    varanasi
    Re: sorting of numbers in assembly language programming

    thanh u dear ,plz sort out my problem .and tell me,.
    write a program in assemly lang. of 8085 to sort a given set of 8 bit items stored at consecutive memory location? plz ans it and tell me now bcoz tomr. is my exam ,or send me at aryanilu143@gmail.com.i will be thankful.
     

Share This Page