--- title: "Auto RAMTOP" id: 76316 type: "computer_media" slug: "auto-ramtop" url: "http://localhost/computer_media/auto-ramtop/" markdown_url: "http://localhost/computer_media/auto-ramtop.md" published_at: "2026-11-11T08:03:12+00:00" modified_at: "2026-11-11T08:03:12+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/11/auto-ramtop-1.png" excerpt: "Tell it how many bytes your machine code needs, and this ZX81 program works out the new RAMTOP and can set it for you." 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: "Todd Montague" slug: "todd-montague" taxonomy: "indiv" url: "http://localhost/indiv/todd-montague/" genre: - name: "Utility" slug: "utility" taxonomy: "genre" url: "http://localhost/type/utility/" media_type: "Program" programmers: - name: "Todd Montague" slug: "todd-montague" taxonomy: "indiv" url: "http://localhost/indiv/todd-montague/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Auto%20RAMTOP%20%281983%29%28Montague%2C%20Todd%29%28TS1000%29%28US%29%28Program%29.zip" mediadate: "1983" images: - url: "http://localhost/wp-content/uploads/2026/11/auto-ramtop-1.png" article_media: - id: 19534 title: "Set RAMTOP Automatically" type: "article" url: "http://localhost/article/set-ramtop-automatically/" media_type_tags: "Utility" license: false --- # Auto RAMTOP Reads RAMTOP, asks how many bytes your routine needs, and prints the new RAMTOP in a box with the two numbers to POKE into 16388 and 16389. Answer Y and it POKEs them and does NEW, so the space is protected; N leaves things as they are. Run it before loading or typing your own program. The article also suggests using it to speed up a program by lowering RAMTOP by the memory the program doesn’t use. SAVE it before you run it, since line 995 wipes it out. Published in Syntax August 1983 ([Set RAMTOP Automatically](https://timexsinclair.com/article/set-ramtop-automatically/)). ## Source Code ``` 5 SLOW 10 LET RT=PEEK 16388+256*PEEK 16389 20 PRINT TAB 10;"RAMTOP=";RT 30 PRINT 35 PRINT "HOW MANY BYTES IS YOUR ROUTINE?" 40 INPUT BYTES 45 PRINT 50 PRINT TAB 10;"BYTES LONG=";BYTES 55 LET NA=RT-BYTES 60 LET A=NA/256 63 PRINT 65 PRINT "MAKE RAMTOP=";NA 70 LET A$=STR$ A 100 FOR X=1 TO LEN A$ 110 IF A$(X)="." THEN GOTO 200 120 NEXT X 200 LET A$=A$( TO X-1) 210 LET A=VAL A$ 230 LET RE=NA-256*A 800 PRINT AT 8,3;"▛▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▜" 810 PRINT AT 9,3;"▌";AT 9,21;"▐" 820 PRINT AT 10,3;"▙▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▟" 830 PRINT AT 9,4;NA;"=";RE;"+256*";A 840 PRINT 850 PRINT 860 PRINT "DO YOU WANT MEMORY SET TO ",NA;"?" 870 LET Q$=INKEY$ 880 IF Q$="Y" THEN GOTO 950 890 IF Q$="N" THEN GOTO 999 900 GOTO 870 950 PRINT 960 PRINT TAB 11;"DONE" 970 PAUSE 80 980 POKE 16388,RE 990 POKE 16389,A 995 NEW ```