--- title: "Sort Routine" id: 76622 type: "computer_media" slug: "sort-routine" url: "http://localhost/computer_media/sort-routine/" markdown_url: "http://localhost/computer_media/sort-routine.md" published_at: "2026-11-11T08:02:22+00:00" modified_at: "2026-11-11T08:02:22+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/11/sort-routine-1.png" excerpt: "Sort a list of words into alphabetical order on a 1K ZX81: enter how many words, type them in and see them sorted." post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 1000" slug: "ts1000" taxonomy: "post_tag" url: "http://localhost/tag/ts1000/" - name: "ZX81" slug: "zx81" taxonomy: "post_tag" url: "http://localhost/tag/zx81/" 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: "Leo Morgan" slug: "leo-morgan" taxonomy: "indiv" url: "http://localhost/indiv/leo-morgan/" genre: - name: "Utility" slug: "utility" taxonomy: "genre" url: "http://localhost/type/utility/" media_type: "Program" programmers: - name: "Leo Morgan" slug: "leo-morgan" taxonomy: "indiv" url: "http://localhost/indiv/leo-morgan/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Sort%20Routine%20%281981%29%28Morgan%2C%20Leo%29%28TS1000%29%28US%29%28Program%29.zip" mediadate: "1981" images: - url: "http://localhost/wp-content/uploads/2026/11/sort-routine-1.png" article_media: - id: 19640 title: "Sort Routine" type: "article" url: "http://localhost/article/sort-routine/" media_type_tags: "Utility" license: false --- # Sort Routine Answer ENTER NUMBER OF WORDS with how many words you have, then type each word (1 to 20 characters). The program counts the entries and prints the list in alphabetical order. RUN 200 saves the program as SORT and starts it again. It fits in 1K. Published in Syntax October 1981 ([Sort Routine](https://timexsinclair.com/article/sort-routine/)). ## Source Code ``` 1 REM ALPHA-NUMERIC SORT ROUTINE REVISED BY LEO MORGAN 9/5/81 5 PRINT "ENTER NUMBER OF WORDS, 1 TO N" 10 INPUT N 15 DIM A$(N,20) 20 FOR I=1 TO N 25 PRINT "TYPE A WORD, 1 TO 20 CHARACTERS" 27 PRINT AT 21,0;I 30 INPUT A$(I) 35 CLS 40 NEXT I 50 LET X=0 60 LET X=X+1 70 IF X>N THEN STOP 80 IF A$(X)="ZZZZZZZZZZZZZZZZZZZZ" THEN GOTO 60 90 FOR Y=1 TO N 100 IF A$(Y)