--- title: "A 4-Line Program to Set RAMTOP" id: 77412 type: "computer_media" slug: "a-4-line-program-to-set-ramtop" url: "http://localhost/computer_media/a-4-line-program-to-set-ramtop/" markdown_url: "http://localhost/computer_media/a-4-line-program-to-set-ramtop.md" published_at: "2026-11-15T18:38:32+00:00" modified_at: "2026-11-15T18:38:32+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/11/four-line-ramtop-1.png" excerpt: "Four lines that lower RAMTOP by N K using the SEED variable; as printed line 30 POKEs the wrong byte." post_tag: - 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/" genre: - name: "Utility" slug: "utility" taxonomy: "genre" url: "http://localhost/type/utility/" media_type: "Program" mediadate: "1986" images: - url: "http://localhost/wp-content/uploads/2026/11/four-line-ramtop-1.png" article_media: - id: 38315 title: "A 4-Line Program to Set RAMTOP" type: "article" url: "http://localhost/article/a-4-line-program-to-set-ramtop/" media_type_tags: "Utility" license: false --- # A 4-Line Program to Set RAMTOP Lowers RAMTOP by N kilobytes and does NEW, to make room above BASIC for machine code. It uses RAND to put the new RAMTOP into the SEED system variable (16434-16435) and copies the two bytes into RAMTOP (16388-16389). For a set address X instead, use RAND X in line 10. As printed, line 30 POKEs 16388 again where 16389 is needed, so RAMTOP is not lowered. Reprinted in Sinc-Link from Your Computer, March 1983, sent in by G. Chambers. Published in Sinc-Link August-September 1986 ([A 4-Line Program to Set RAMTOP](https://timexsinclair.com/article/a-4-line-program-to-set-ramtop/)). ## Source Code ``` 5 INPUT N 10 RAND 1024*(32-N) (or RAND X) 20 POKE 16388, PEEK 16434 30 POKE 16388, PEEK 16435 40 NEW ```