R0 = number of objects to sort
R1 = pointer to array of objects
R2 = pointer to comparison routine
R3 = workspace pointer for comparison procedure
R4 = size of object
R5 = address of 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 = address of object a
R1 = address of 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...
Although R5 doesn't have to be word-aligned, the sort will probably be faster
if it is.
|
|
|