--- title: "Placing USR Calls" id: 77910 type: "computer_media" slug: "placing-usr-calls" url: "http://localhost/computer_media/placing-usr-calls/" markdown_url: "http://localhost/computer_media/placing-usr-calls.md" published_at: "2026-11-19T15:04:11+00:00" modified_at: "2026-11-19T15:04:11+00:00" featured_image: url: "http://localhost/wp-content/uploads/2026/11/placing-usr-calls-1.png" excerpt: "A ZX80 (4K ROM) utility that reserves space at the top of memory for machine code, so Syntax USR routines can run at the same addresses as on 8K ROM machines." post_tag: - name: "Downloadable" slug: "downloadable" taxonomy: "post_tag" url: "http://localhost/tag/downloadable/" - name: "ZX80" slug: "zx80" taxonomy: "post_tag" url: "http://localhost/tag/zx80/" model: - name: "Sinclair ZX80" slug: "zx80" taxonomy: "model" url: "http://localhost/model/zx80/" genre: - name: "Machine Language" slug: "machine-language" taxonomy: "genre" url: "http://localhost/type/machine-language/" media_type: "Program" download_url: "https://archive.org/download/timex-sinclair-software-archive/Placing%20USR%20Calls%20%281981%29%28-%29%28ZX80%29%28US%29%28Program%29.zip" mediadate: "1981" images: - url: "http://localhost/wp-content/uploads/2026/11/placing-usr-calls-1.png" - url: "http://localhost/wp-content/uploads/2026/11/placing-usr-calls-2.png" article_media: - id: 19736 title: "Placing USR Calls in 4K, 8K" type: "article" url: "http://localhost/article/placing-usr-calls-in-4k-8k/" related_content: - id: 19688 title: "Input Port" type: "article" url: "http://localhost/article/input-port/" - id: 19690 title: "Beginner’s Loading ML Programs" type: "article" url: "http://localhost/article/beginners-loading-ml-programs/" media_type_tags: "Machine Language" license: false --- # Placing USR Calls A memory-protect utility for the ZX80 with the 4K ROM. Answer the first prompt with the number of K of memory in your machine and the second with the number of bytes to reserve. The program POKEs a six-byte routine at 17152 that loads HL with a new top of memory and jumps into the ROM’s initialisation at 026BH, after the point where the ROM would have found the real memory top. The computer restarts with the bytes above that address set aside, and the BASIC program is cleared, as after NEW. Then load or type your BASIC program (usually a machine-code loader or monitor); it is kept clear of the reserved area. The first free location is 16382-N+(1024*K). Syntax published its machine-code routines assembled for 1K, so to use them as printed answer the first prompt with 1. Later Syntax articles on loading machine code refer back to this program. As printed, the program cannot be told about a full 16K: line 7 works out 16384+K*1024, which passes the ZX80’s integer limit of 32767 when K is 16, so it stops with report 6 (arithmetic overflow). With 16K, answer 15 and allow for the extra 1K that stays reserved above the area. Published in Syntax June 1981 ([Placing USR Calls in 4K, 8K](https://timexsinclair.com/article/placing-usr-calls-in-4k-8k/)). ## Source Code ``` 5 INPUT K 6 INPUT N 7 LET M=16384+(K*1024)-1-N-1 10 POKE 17152,33 20 POKE 17153,M-(M/256)*256 30 POKE 17154,M/256 40 POKE 17155,195 50 POKE 17156,107 60 POKE 17157,2 70 LET X=USR(17152) ```