Sort Routine (Short Version)

Developer(s): Dave Tabor
Date: 1982
Type: Program
Platform(s): ZX81, TS 1000
Tags: Utility

Type how many words you have, then each word (up to 20 characters). The program prints them in alphabetical order. There are no prompts: the cursor just waits for each entry.

This is a shorter version of Leo Morgan’s Sort Routine (Syntax October 1981). Instead of keeping track of which words have been printed, it overwrites each printed word with an inverse space, which sorts after any normal word. The article suggests adding back prompts like the ones in Leo Morgan’s program.

Published in Syntax July 1982 (Program Improvements: Sort Routine).

Image Gallery

Source Code

  10 INPUT N
  15 DIM A$(N,20)
  20 FOR I=1 TO N
  25 INPUT A$(I)
  30 NEXT I
  40 FOR Y=1 TO N
  45 LET F=1
  50 FOR X=1 TO N
  55 IF A$(F)>A$(X) THEN LET F=X
  60 NEXT X
  65 PRINT A$(F)
  70 LET A$(F)="█"
  75 NEXT Y

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.