--- title: "XFER" id: 76680 type: "computer_media" slug: "xfer" url: "http://localhost/computer_media/xfer/" markdown_url: "http://localhost/computer_media/xfer.md" published_at: "2026-11-11T08:02:12+00:00" modified_at: "2026-11-11T08:02:12+00:00" author: "David Anderson" featured_image: url: "http://localhost/wp-content/uploads/2026/11/xfer-1.png" excerpt: "A BASIC loader for machine code: write the hex bytes in REM lines at the top of your program and XFER copies them into a string and runs them." 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: "David Ornstein" slug: "david-ornstein" taxonomy: "indiv" url: "http://localhost/indiv/david-ornstein/" genre: - name: "Machine Language" slug: "machine-language" taxonomy: "genre" url: "http://localhost/type/machine-language/" media_type: "Program" programmers: - name: "David Ornstein" slug: "david-ornstein" taxonomy: "indiv" url: "http://localhost/indiv/david-ornstein/" download_url: "https://archive.org/download/timex-sinclair-software-archive/XFER%20%281982%29%28Ornstein%2C%20David%29%28TS1000%29%28US%29%28Program%29.zip" mediadate: "1982" images: - url: "http://localhost/wp-content/uploads/2026/11/xfer-1.png" - url: "http://localhost/wp-content/uploads/2026/11/xfer-2.png" article_media: - id: 19976 title: "Loading Hexadecimal Listings" type: "article" url: "http://localhost/article/loading-hexadecimal-listings/" media_type_tags: "Machine Language" license: false --- # XFER Machine code is often printed as hex. With XFER you type the bytes into REM lines that start with ( and end the list with a REM $ line; the program finds each REM, turns each pair of hex digits into a byte, collects the bytes in Z$ and calls them with USR. The download includes the article’s example, a few bytes that add 16 and 32 and return the result: after RUN, PRINT VALUE shows 48. Z$ must be the first variable the program creates, because the start address of the code is worked out from VARS. In line 330 the word REM inside the quotes is the REM keyword. The article also shows how to POKE the bytes into a REM in line 1 instead. In testing, RUN in a 1K ZX81 stopped with report 4; with 2K or more the example works. Published in Syntax June 1982 ([Loading Hexadecimal Listings](https://timexsinclair.com/article/loading-hexadecimal-listings/)). ## Source Code ``` 10 REM ( 3E 10 06 20 80 06 00 4F C9 20 REM $ 100 REM XFER 110 LET Z$="" 120 LET A=16513-5 140 LET SA=PEEK 16400+PEEK 16401*256+3 200 REM MAIN LOOP 210 GOSUB 300 220 IF X$="(" THEN GOSUB 400 230 IF X$="$" THEN GOTO 1000 240 GOTO 200 300 REM FIND A REM 310 LET A=A+5 320 LET X=PEEK A 325 LET X$=CHR$ X 330 IF X$=" REM " THEN GOTO 370 340 LET A=A+1 350 IF PEEK A=118 THEN GOTO 300 360 GOTO 340 370 LET A=A+1 380 LET X=PEEK A 385 LET X$=CHR$ X 390 RETURN 400 REM PROCESS A LINE 410 GOSUB 500 420 IF EOL=1 THEN RETURN 430 LET H=(X-28)*16+PEEK (A+1)-28 440 LET A=A+1 450 LET Z$=Z$+CHR$ H 460 GOTO 400 500 REM FIND A NON-SPACE CHAR 505 LET EOL=0 510 LET A=A+1 520 LET X=PEEK A 530 IF X=0 THEN GOTO 510 540 IF X=118 THEN LET EOL=1 550 LET X$=CHR$ X 560 RETURN 1000 REM DONE WITH XFER 1010 LET VALUE=USR SA ```