--- title: "Moving RAMTOP" id: 77317 type: "computer_media" slug: "moving-ramtop" url: "http://localhost/computer_media/moving-ramtop/" markdown_url: "http://localhost/computer_media/moving-ramtop.md" published_at: "2026-11-15T18:39:09+00:00" modified_at: "2026-11-15T18:39:09+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/11/moving-ramtop-1.png" excerpt: "Move RAMTOP up or down without NEW, so the program in memory survives, with a 33-byte relocatable machine-code routine." post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" 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: "Rene Bruneau" slug: "rene-bruneau" taxonomy: "indiv" url: "http://localhost/indiv/rene-bruneau/" genre: - name: "Utility" slug: "utility" taxonomy: "genre" url: "http://localhost/type/utility/" media_type: "Program" programmers: - name: "Rene Bruneau" slug: "rene-bruneau" taxonomy: "indiv" url: "http://localhost/indiv/rene-bruneau/" download_url: "https://archive.org/download/timex-sinclair-software-archive/Moving%20RAMTOP%20%281992%29%28Bruneau%2C%20Rene%29%28TS1000%29%28CA%29%28Program%29.zip" mediadate: "1992" images: - url: "http://localhost/wp-content/uploads/2026/11/moving-ramtop-1.png" - url: "http://localhost/wp-content/uploads/2026/11/moving-ramtop-2.png" - url: "http://localhost/wp-content/uploads/2026/11/moving-ramtop-3.png" article_media: - id: 23713 title: "ZX81 Resources: Moving RAMTOP" type: "article" url: "http://localhost/article/zx81-resources-moving-ramtop/" media_type_tags: "Utility" license: false --- # Moving RAMTOP A 33-byte relocatable machine-code routine that moves RAMTOP up or down without NEW, so a program already in memory survives. Set the new RAMTOP with RAND, then call the routine with USR; it moves the machine stack and the error pointer to the new top of memory. The program asks for an address and copies the routine there from its line 1 REM, so you can keep it anywhere safe. Rene Bruneau adapted it from a routine in COMPUTE! magazine. In the article you type a hex loader (RUN 100) and the bytes, then delete the loader; the download is that finished program, with the code already in the REM. Published in Sinc-Link July-August 1992 ([ZX81 Resources: Moving RAMTOP](https://timexsinclair.com/article/zx81-resources-moving-ramtop/)). ## Source Code ``` 1 REM ---33 SPACES---- 10 PRINT "ROUTINE ADDRESS" 20 INPUT ADD 30 FAST 40 FOR X=0 TO 32 50 POKE ADD+X, PEEK (16514+X) 60 NEXT X 70 SLOW 80 STOP 100 LET X=16514 110 LET T=0 120 LET A$="" 130 IF A$="" THEN INPUT A$ 140 IF A$="S" THEN PRINT "CHECK SUM = ";T,P 150 POKE X,16*CODE A$+CODE A$(2)-476 160 LET T=T+ PEEK X 170 IF PEEK 16442<=2 THEN SCROLL 180 PRINT X;" ";A$(1 TO 2) 190 LET X=X+1 200 LET A$=A$(3 TO) 210 GOTO 130 Listing 2 (machine code, hex): 16514 2A 04 40 2B ED 5B 32 40 16522 ED 53 04 40 01 30 00 ED 16530 B8 EB AF ED 52 54 5D 39 16538 F9 2A 02 40 19 22 02 40 16546 C9 ```