--- title: "String Reversal" id: 77940 type: "computer_media" slug: "string-reversal" url: "http://localhost/computer_media/string-reversal/" markdown_url: "http://localhost/computer_media/string-reversal.md" published_at: "2026-11-19T15:04:18+00:00" modified_at: "2026-11-19T15:04:18+00:00" featured_image: url: "http://localhost/wp-content/uploads/2026/11/string-reversal-1.png" excerpt: "A ZX80 program that prints any string you type backward, first in normal and then in inverse video." post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "ZX80" slug: "zx80" taxonomy: "post_tag" url: "http://localhost/tag/zx80/" model: - name: "Sinclair ZX80" slug: "zx80" taxonomy: "model" url: "http://localhost/model/zx80/" indiv: - name: "Austin Brown" slug: "austin-brown" taxonomy: "indiv" url: "http://localhost/indiv/austin-brown/" genre: - name: "Demo" slug: "demo" taxonomy: "genre" url: "http://localhost/type/demo/" media_type: "Program" programmers: - name: "Austin Brown" slug: "austin-brown" taxonomy: "indiv" url: "http://localhost/indiv/austin-brown/" download_url: "https://archive.org/download/timex-sinclair-software-archive/String%20Reversal%20%281981%29%28Brown%2C%20Austin%29%28ZX80%29%28US%29%28Program%29.zip" mediadate: "1981" images: - url: "http://localhost/wp-content/uploads/2026/11/string-reversal-1.png" - url: "http://localhost/wp-content/uploads/2026/11/string-reversal-2.png" article_media: - id: 19669 title: "Manipulating Strings" type: "article" url: "http://localhost/article/manipulating-strings/" media_type_tags: "Demo" license: false --- # String Reversal A string demonstration for the ZX80. Type a string at the prompt and the program prints it backward twice, once in normal characters and once in inverse video, then -END-. It takes the string apart one character at a time with CODE and TL$, storing the codes in array C, and prints them from the last to the first. The array allows strings of up to 30 characters; to handle longer strings, increase the size of C in line 5 as far as memory allows. The same article printed a separate Inverse Graphics subroutine by Peter Herschel, which is not part of this program. Published in Syntax September 1981 ([Manipulating Strings](https://timexsinclair.com/article/manipulating-strings/)). ## Source Code ``` 5 DIM C(30) 10 PRINT "ENTER A STRING" 20 INPUT A$ 30 PRINT 40 PRINT "REVERSE OF ";A$;" IS:" 50 LET I=0 60 LET I=I+1 70 LET C(I)=CODE(A$) 80 LET A$=TL$(A$) 90 IF NOT A$="" THEN GO TO 60 100 FOR N=0 TO I-1 110 LET K=I-N 120 PRINT CHR$(C(K)); 130 NEXT N 140 PRINT 150 PRINT 160 FOR N=0 TO I-1 170 LET K=I-N 180 PRINT CHR$(C(K)+128); 190 NEXT N 200 PRINT 210 PRINT 220 PRINT "-END-" ```