--- title: "HEX>DEC" id: 79488 type: "computer_media" slug: "hexdec" url: "http://localhost/computer_media/hexdec/" markdown_url: "http://localhost/computer_media/hexdec.md" published_at: "2026-11-22T14:40:53+00:00" modified_at: "2026-11-22T14:40:53+00:00" featured_image: url: "http://localhost/wp-content/uploads/2026/11/hex-dec-1.png" excerpt: "Converts four hex digits to decimal on the TS1000." 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: "Stan Livingston" slug: "stan-livingston" taxonomy: "indiv" url: "http://localhost/indiv/stan-livingston/" genre: - name: "Mathematics" slug: "mathematics" taxonomy: "genre" url: "http://localhost/type/mathematics/" media_type: "Program" programmers: - name: "Stan Livingston" slug: "stan-livingston" taxonomy: "indiv" url: "http://localhost/indiv/stan-livingston/" download_url: "https://archive.org/download/timex-sinclair-software-archive/HEX-DEC%20%281985%29%28Livingston%2C%20Stanley%20W.%29%28TS1000%29%28Program%29.zip" mediadate: "1985" images: - url: "http://localhost/wp-content/uploads/2026/11/hex-dec-1.png" - url: "http://localhost/wp-content/uploads/2026/11/hex-dec-2.png" article_media: - id: 78322 title: "HEX>DEC" type: "article" url: "http://localhost/article/hexdec-2/" - id: 43649 title: "HEX>DEC" type: "article" url: "http://localhost/article/hexdec/" media_type_tags: "Mathematics" license: false --- # HEX>DEC Converts a four-digit hexadecimal number to decimal on the TS1000 or ZX81. RUN it, enter the first two digits, then the next two, then a single space (each followed by ENTER) to get the answer. It needs 2K or more, as on a TS1000: it uses addresses around 30000 as scratch memory, and that fails on a 1K ZX81. Published in LISTing February 1985 ([HEX>DEC](https://timexsinclair.com/article/hexdec-2/)), and printed again, with the author’s name, in [June-August 1989](https://timexsinclair.com/article/hexdec/). ## Source Code ``` 5 REM HEX>DEC 10 POKE 30000,1 20 POKE 30003,201 30 LET X=30001 40 LET A$="" 50 IF A$="" THEN INPUT A$ 60 PRINT A$; 70 IF A$=" " THEN GO TO 120 80 POKE X,16*CODE A$+CODE A$(2)-476 90 LET X=X+1 100 LET A$=A$(3 TO ) 110 GO TO 50 120 PRINT " ";PEEK (X-2)*256+PEEK (X-1) ```