--- title: "REM Generator" id: 77487 type: "computer_media" slug: "rem-generator" url: "http://localhost/computer_media/rem-generator/" markdown_url: "http://localhost/computer_media/rem-generator.md" published_at: "2026-11-15T18:38:19+00:00" modified_at: "2026-11-15T18:38:19+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/11/rem-generator-1.png" excerpt: "A machine-code routine above RAMTOP meant to create a REM line of any length; as printed it fills memory instead." 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: "Machine Language" slug: "machine-language" taxonomy: "genre" url: "http://localhost/type/machine-language/" media_type: "Program" mediadate: "1984" images: - url: "http://localhost/wp-content/uploads/2026/11/rem-generator-1.png" - url: "http://localhost/wp-content/uploads/2026/11/rem-generator-2.png" article_media: - id: 40059 title: "Machine Code Programming (part 2)" type: "article" url: "http://localhost/article/machine-code-programming-part-2/" media_type_tags: "Machine Language" license: false --- # REM Generator A 68-byte machine-code routine, kept above a lowered RAMTOP at 32699, meant to build a line-0 REM of any length to hold machine code, so you do not have to type hundreds of characters after REM. A short BASIC program asks how many bytes you want, POKEs the count into the routine and calls it. The routine is used by lowering RAMTOP to 32698 (POKE 16388,186, POKE 16389,127 and NEW), entering the 68 bytes at 32699 with the loader, and then running the REM-making program. As printed, the routine reads its byte count from 16450 (in the printer buffer) while the BASIC POKEs the count into the routine itself, so it fills memory instead of making the REM. It is part 2 of the newsletter’s unsigned machine-code series. Published in Sinc-Link early 1984 (Vol. 2 No. 2) ([Machine Code Programming (part 2)](https://timexsinclair.com/article/machine-code-programming-part-2/)). ## Source Code ``` Loader: 10 SCROLL 20 PRINT "ENTER STARTING ADDRESS" 30 INPUT X 40 SCROLL 50 SCROLL 60 PRINT "ENTER YOUR MACHINE CODE" 70 SCROLL 80 SCROLL 90 INPUT Y 100 POKE X,Y 110 PRINT X;"'"; PEEK X 120 LET X=X+1 130 GOTO 80 REM Generator machine code (enter at 32699): 237, 75, 66, 64, 205, 231, 2, 197, 3, 3, 197, 1, 6, 0, 42, 41, 64, 9, 34, 41, 64, 33, 125, 64, 205, 158, 9, 35, 112, 35, 112, 35, 193, 113, 35, 112, 35, 54, 234, 35, 54, 118, 193, 197, 205, 158, 9, 193, 197, 35, 54, 61, 11, 120, 177, 32, 248, 193, 42, 41, 64, 9, 34, 41, 64, 195, 7, 2 REM Generator BASIC: 10 PRINT at 10,0; "HOW MANY BYTES FOR THE REM STATEMENT?" 20 INPUT X 30 POKE 32711, X- INT (X/256) * 256 40 POKE 32712, INT (X/256) 50 RAND USR 32699 60 CLS 70 LIST 0 ```