AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
Entry
     R0 = number of objects to sort
     R1 -> array of objects
     R2 -> comparison routine
     R3 = workspace pointer for comparison procedure
     R4 = size of object
     R5 -> temporary workspace of R4 bytes (only needed if R4>63)

This SWI will sort an array of objects.  It is very similar to the OS_HeapSort SWI, except that you can use it to sort an array of any object, rather than just arrays of pointers.  R2 points to a routine which is entered, in SVC mode, as follows :

     R0 -> object a
     R1 -> object b
     R12 = value supplied to WimpExt_Sort in R3
     R13 -> supervisor stack
     R14 = return address

The routine should compare the two objects and return, preserving all registers apart from R0,R1,R12 and R14, with flags set as follows :

     a<b   Z=0, C=0
     a=b   Z=1, C=1
     a>b   Z=0, C=1

The actual method of sorting is unspecified; suffice it to say it‘s fast... (Currently it‘s a heap sort.)  Although R5 doesn‘t have to be word-aligned, the sort will probably be faster if it is.

Provided by Sort

[sh-index] Back to list of manuals