--- title: "Colorsort" type: "article" slug: "colorsort" url: "http://localhost/article/colorsort/" markdown_url: "http://localhost/article/colorsort.md" published_at: "2020-10-27T17:12:24+00:00" modified_at: "2024-06-14T01:31:00+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "Basic and machine language programs to demonstrate sorting speeds." category: - name: "Syntax" slug: "syntax" taxonomy: "category" url: "http://localhost/category/periodicals/syntax/" post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" - name: "Type-in program" slug: "type-in-program" taxonomy: "post_tag" url: "http://localhost/tag/type-in-program/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Lloyd Painter" slug: "lloyd-painter" taxonomy: "indiv" url: "http://localhost/indiv/lloyd-painter/" publication: "Syntax" publication_r: id: 10246 title: "Syntax" type: "periodical" url: "http://localhost/periodical/syntax/" authors: "Lloyd Painter" volume: "5" issue: "3" issues_articles: - id: 26725 title: "Syntax/Syntax ZX80 v5 n3" type: "issue" url: "http://localhost/issue/syntax-syntax-zx80-v5-n3/" pages: "10" pubdate: "March 1984" archive_link: false volumeissue: "v5n3" article_media: - id: 55062 title: "Colorsort" type: "computer_media" url: "http://localhost/computer_media/colorsort/" --- # Colorsort Basic and machine language programs to demonstrate sorting speeds. ## Source Code: Colorsort ``` 5 REM 24 line BASIC color sort by Lloyd Painter 10 BRIGHT 0: BORDER 0: INK 6 15 PAPER 0: CLS 20 LET a=22527 25 FOR n=1 TO 768 30 POKE (a+n),8+8*INT (RND*7) 35 NEXT n 40 FOR s=767 TO 1 STEP -1 45 LET x=0 50 FOR n=1 TO s 55 LET c=a+n 60 IF PEEK c<=PEEK (c+1) THEN GO TO 80 65 LET x=PEEK c 70 POKE c,PEEK (c+1) 75 POKE (c+1),x 77 PAUSE 15 80 NEXT n 85 IF x=0 THEN GO TO 95 90 NEXT s 95 BEEP .5,26 100 PAUSE 10 105 GO TO 95 ```