What for numbers, 8bit 16bit or float, is it an index-value pair which needs to be sorted? My first guess, in pseudo code: you have 6 positions: array[6]; start: index = 0; loop: if array[index] > array[index+1] { swap array[index] with array[index+1] goto start: } index = index + 1; if(index = 6) goto end: goto loop: end: I think it's bubblesort. Not the most efficient (ahum) but for 6 positions, this should do it. This should do it. I haven't done anything in MPASM for some time now, so the ASM code is a bit foggy. But this could be put into ASM fairly easy. Use INDF with an index variable for the array. Use a temp register to swap the variables. Use patience to implement it :) Regards, Claudio -----Oorspronkelijk bericht----- Van: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]Namens JISAK@NETCOURRIER.COM Verzonden: donderdag 5 september 2002 11:27 Aan: PICLIST@MITVMA.MIT.EDU Onderwerp: [PIC] Sorting numbers Hi all, I need to sort 6 values in assembler (MPASM). Do you know some routines Thanks JK -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.