--- title: "Sort Routine (Short Version)" id: 77934 type: "computer_media" slug: "sort-routine-short-version" url: "http://localhost/computer_media/sort-routine-short-version/" markdown_url: "http://localhost/computer_media/sort-routine-short-version.md" published_at: "2026-11-19T15:04:16+00:00" modified_at: "2026-11-19T15:04:16+00:00" featured_image: url: "http://localhost/wp-content/uploads/2026/11/sort-routine-tabor-1.png" excerpt: "Sort a list of words into alphabetical order: a shorter version of Leo Morgan's ZX81 sort routine." post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" model: - name: "Sinclair ZX81" slug: "zx81" taxonomy: "model" url: "http://localhost/model/zx81/" - name: "Timex/Sinclair 1000" slug: "ts-1000" taxonomy: "model" url: "http://localhost/model/ts-1000/" indiv: - name: "Dave Tabor" slug: "dave-taber" taxonomy: "indiv" url: "http://localhost/indiv/dave-taber/" genre: - name: "Utility" slug: "utility" taxonomy: "genre" url: "http://localhost/type/utility/" media_type: "Program" programmers: - name: "Dave Tabor" slug: "dave-taber" taxonomy: "indiv" url: "http://localhost/indiv/dave-taber/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Sort%20Routine%20%28Short%20Version%29%20%281982%29%28Tabor%2C%20Dave%29%28TS1000%29%28US%29%28Program%29.zip" mediadate: "1982" images: - url: "http://localhost/wp-content/uploads/2026/11/sort-routine-tabor-1.png" - url: "http://localhost/wp-content/uploads/2026/11/sort-routine-tabor-2.png" article_media: - id: 65592 title: "Program Improvements: Sort Routine" type: "article" url: "http://localhost/article/program-improvements-sort-routine/" related_content: - id: 76622 title: "Sort Routine" type: "computer_media" url: "http://localhost/computer_media/sort-routine/" media_type_tags: "Utility" license: false --- # Sort Routine (Short Version) 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](https://timexsinclair.com/article/program-improvements-sort-routine/)). ## 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 ```