SORT (16K ZX-81)
by Paul Kecskemety
from ZX Computing 31 (November 1986), page 79

I have sent you a contribution for your giant REM program. My machine code
program will sort a specified character array into alphabetical order in a
matter of seconds, eg. A 500 by 10 array in less than 2 seconds. This program
is therefore very useful for filing programs.

My routine occupies 151 bytes and is relocatable if 2 addresses are altered. I
have included a HEX loader to poke in the machine code and by changing line 100
to the required starting address, the program will automatically alter the two
fixed addresses and so relocate the machine code routine.

The routine will only sort two dimensional character arrays and will produce an
error code 2 if the variable has not been set up, or an error code 3 if the
dimensions of the array are wrong. The routine is called from basic by the
command:

   PRINT USR start address, X$

where X$ represents any character array. It is more convenient to define the
variable, SORT, to hold the starting address and so the routine can be called by:

   PRINT USR SORT, X$

I have also written an example program to demonstrate my routine and this is
listed from line 1000 onwards. To use this program simply change start address
in line 1010 to the starting address of the routine.
