Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \B0
			
			


Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
D\E5\ED\C5\E5

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
F\E5\CD

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A\D9\E1\CD\CA

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
AD

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
D

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
E

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
AA

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
AD

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
B

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
B

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
ED

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
C

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
EF

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
A

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
B

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
AD

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top
C

Delphic Toolkit

Products: 4K Toolkit
Date: 1985
Type: Cassette
Platform(s): TS 1000

This is a self-relocating machine code toolkit loader for the ZX81/TS1000, distributed commercially by Delphic Enterprises in 1985. The BASIC program presents three installation options: embedding the toolkit immediately after the user’s BASIC program, relocating it into the 8–16 KB address range, or placing it above RAMTOP. Lines 1–2 contain the bulk of the toolkit as raw Z80 machine code stored in REM statements, and the bootstrap at line 8 executes it via RAND USR 16514. The relocation routines (called via USR 20616, 20628, and 20657) handle copying the toolkit to the chosen address and patching the relevant system variables (addresses 16388–16395, 16420–16621). A save/verify loop at lines 900–998 allows the configured toolkit to be saved to tape with a bad-load check comparing USR return values before and after.


Program Analysis

Program Structure

The program divides into a machine code payload, a BASIC menu shell, and installation/save routines. Lines 1–2 are REM statements containing the entire Z80 machine code toolkit (several hundred bytes). Lines 3–8 are the bootstrap: system variable patches and the initial RAND USR 16514 entry point. Lines 100–190 present the three-option menu. Lines 200–560 handle each installation path. Line 800 is a shared subroutine that prints the chosen start address. Lines 900–999 handle tape saving and verify.

Machine Code Payload

Lines 1 and 2 together hold the complete toolkit binary as raw bytes inside REM statements. The Z80 entry point at address 16514 (two bytes past the start of the line 1 REM data, after the line header) is called directly by RAND USR TK on line 8. Additional internal entry points referenced from BASIC include:

  • USR 20616 — main relocation/copy engine (line 530)
  • USR 20628 — checksum or address-capture routine used for save-verify (lines 960, 980)
  • USR 20657 — special handler for the >32 KB RAMTOP case (line 440)

The machine code itself uses the LDIR block-copy instruction (\ED\B0) extensively for relocation. It also patches IY-indexed system variables in-place (sequences like \FD\36 = LD (IY+d),n) to redirect system pointers after relocation.

BASIC Menu and Installation Paths

KeyOptionLinesNotes
1Carry toolkit with user program200–250TK stays at 16514; instructs user to delete lines 10–999 and re-enter their program
2Locate in 8–16 KB block300–390Validates 8192 ≤ TK ≤ 12288; calls relocation via GOSUB 800 then line 500
3Locate beyond RAMTOP400–490Reads RAMTOP from system variables 16388–16389, subtracts 4096; guards against >45056 or >28672 with an optional 32–48 K confirmation

System Variable Manipulation

Lines 3–6 directly POKE system variables: addresses 16419–16420 and 16394–16395. These correspond to E_LINE / WORKSP area pointers and the D_FILE display-file pointer region — adjusting them before the machine code runs ensures the toolkit’s relocation logic has a clean workspace. Line 510–520 mirror PEEK 16434 and PEEK 16435 (the PROG pointer) into the toolkit area at address 20620–20621, so the copied code knows where the BASIC program starts.

Save and Verify Loop

Lines 900–998 implement a manual save-and-verify cycle. USR 20628 is called before and after the SAVE, and the two return values are compared at line 995. A mismatch triggers a “BAD LOAD” message at line 997 before jumping back to the NEW pathway at line 550. This is an unusual but practical approach to tape reliability: the machine code routine presumably returns a checksum or ending-address value that should be identical on a good save.

Key BASIC Idioms

  • RAND USR TK — standard ZX81 idiom for calling machine code without disturbing the stack unnecessarily; RAND discards the return value silently.
  • LET RMTP=PEEK 16388+256*PEEK 16389-4096 (line 410) — reads the two-byte RAMTOP system variable and subtracts 4 KB to find a safe placement address.
  • IF INKEY$="" THEN GOTO 900 (line 900) — busy-wait polling loop for key detection, a standard ZX81 technique in the absence of interrupts accessible from BASIC.
  • POKE 16418,2 / POKE 16418,0 — toggling the CDFLAG byte to switch between FAST and SLOW display modes at lines 110 and 950.

Notable Techniques

The toolkit uses the REM-as-binary-store technique: by placing raw machine code bytes inside a REM statement, the loader avoids any DATA/READ overhead and places the code at a fixed, predictable address (16514 for line 1’s content). Line 2’s REM extends the binary, with its entry bytes including what appears to be a trampoline that sets up the IY register and stack pointer before jumping into the main code. The FD 36 (IY-relative store) opcodes visible in the machine code confirm the code runs with IY pointing to the system variables area at 0x4000, consistent with the ZX81 firmware convention.

Anomalies and Observations

  • Line 435 is referenced by GOTO 435 at line 480 but does not appear in the listing — this is the well-known ZX81 technique of jumping into the middle of an existing line or relying on line-number arithmetic; execution would fall through to line 440 or 450.
  • Line 360 (PRINT ,,"RAMTOP TOO HIGH") is shared between the option-2 out-of-range path (line 370 jumps to it after printing its own message) and the option-3 high-RAMTOP guard — a deliberate code-reuse branch.
  • The STOP at line 9 acts as a firewall: if the machine code at 16514 ever returns normally, execution halts rather than falling into the menu.
  • Line 10’s REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E in inverse video serves as a placeholder comment instructing the licensee where to insert their own program lines.

Content

Appears On

Related Products

16 utilities that are relocatable to wherever you can execute machine code, on EPROM. Tape version available from Tom Woods.

Related Articles

Related Content

Image Gallery

Source Code

   1 REM \21\B0\0D\09\E5\ED\43\79\40\C5\21\E5\0F\09\E5\CD\2A\0A\D9\E1\CD\CA\0A\7D\08\29\2A\31\35\2D\2E\28\00\39\34\34\31\30\2E\39\76\76\76\37\00\16\00\37\2A\33\3A\32\27\2A\37\7D\04\2B\00\16\00\2B\37\2A\2A\00\38\35\26\28\2A\76\76\28\00\16\00\28\34\35\3E\7D\08\35\00\16\00\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\76\31\00\16\00\32\34\3B\2A\7D\08\2C\00\16\00\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\29\00\16\00\29\2A\31\2A\39\2A\7D\06\30\00\16\00\37\2A\32\00\30\2E\31\31\76\76\38\00\16\00\38\2A\26\37\28\2D\7D\06\2D\00\16\00\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\32\00\16\00\32\2A\37\2C\2A\7D\07\2E\00\16\00\39\26\35\2A\00\2E\33\29\2A\3D\76\76\33\00\16\00\33\3B\32\00\38\39\34\37\2A\7D\03\3A\00\16\00\3A\33\31\34\28\30\76\76\3B\00\16\00\3B\26\37\2E\26\27\31\2A\38\7D\03\36\00\16\00\36\3A\2E\39\76\76\76\76\35\37\2A\38\38\00\31\2A\39\39\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C1\C5\21\DC\0D\09\CD\CA\0A\F5\CD\2A\0A\F1\C1\D6\28\D8\FE\14\D0\C5\87\21\46\01\16\00\5F\19\09\5E\23\56\EB\09\E9\FE\04\9D\01\9B\01\77\01\36\07\17\08\C1\0C\9B\01\C2\01\3E\04\FE\01\BE\0B\9B\01\6D\0B\81\02\30\05\86\02\9B\01\6E\01\F9\08\C1\FD\34\00\CB\FA\C3\47\03\D9\CD\CA\0A\76\2B\37\2A\2A\00\27\3E\39\2A\38\00\14\80\21\00\00\39\ED\4B\1C\40\ED\42\44\4D\CD\20\15\CD\DB\15\C1\C9\D9\CD\CA\0A\76\29\2A\31\2A\39\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\ED\52\D0\19\EB\CD\5D\0A\C9\D9\CD\CA\0A\76\37\2A\32\00\30\2E\31\31\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\A7\ED\52\D0\19\D5\CD\F2\09\E5\CD\B8\07\7E\FE\EA\EB\D1\20\EB\E1\ED\42\E5\EB\CD\60\0A\18\E1\D9\CD\CA\0A\76\32\2A\37\2C\2A\76\76\00\00\1D\00\16\00\35\37\2A\38\2A\37\3B\2A\76\76\00\00\1E\00\16\00\28\34\32\27\2E\33\AA\C1\C5\21\BB\0D\09\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\1D\28\05\FE\1E\28\21\C9\2A\0C\40\11\7D\40\ED\52\22\7B\40\E5\19\2B\C1\03\03\ED\5B\04\40\1B\ED\B8\13\ED\53\04\40\C3\C6\03\2A\04\40\4E\23\46\23\ED\5B\0C\40\ED\B0\ED\53\0C\40\22\04\40\2B\2B\F9\2B\2B\22\02\40\EB\C3\06\04\E1\E1\C3\10\04\D9\CD\CA\0A\76\38\2A\26\37\28\2D\76\76\00\00\2A\33\39\2A\37\00\38\39\37\2E\33\2C\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\21\7D\40\3E\FE\F5\E5\23\23\ED\5B\0C\40\A7\ED\52\38\03\E1\18\75\19\4E\23\46\23\C5\E5\ED\5B\14\40\E5\2A\1A\40\37\ED\52\E1\38\21\7E\CD\B4\07\20\07\0B\0B\0B\0B\0B\0B\23\1A\13\ED\A1\28\E3\78\B1\E1\C1\0B\20\D5\E1\CD\F2\09\EB\18\BB\E1\C1\FD\36\22\03\D1\F1\3C\C1\C5\F5\D5\2A\02\40\E5\21\1D\03\09\E5\ED\62\39\22\02\40\EB\CD\50\07\E1\18\0A\18\93\2A\79\40\01\E5\0F\09\D9\E1\22\02\40\FD\35\22\FD\34\00\FD\36\00\FF\E1\28\BC\37\E5\F5\2A\79\40\E5\01\BF\0E\09\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\F1\E1\C1\04\30\08\20\AC\CD\F2\09\EB\18\A6\E1\C9\CD\AD\14\2B\CD\5C\05\06\13\CD\2C\0A\AF\D7\D7\ED\5B\14\40\D5\2A\1A\40\E5\A7\ED\52\44\4D\CD\6B\0B\2A\79\40\01\DC\0D\09\CD\CA\0A\FE\77\20\0E\E1\2B\2B\D1\ED\52\38\D1\19\CD\5C\05\18\CB\06\01\FE\74\28\4C\FE\79\28\46\FE\75\28\45\FE\76\28\69\47\3A\06\40\A7\20\03\78\18\2A\3D\20\0B\AF\32\06\40\78\C6\C0\18\1E\18\A1\3D\20\10\78\FE\40\30\04\C6\80\18\10\01\4A\00\09\7E\18\09\01\4E\00\09\AF\32\06\40\7E\E1\2B\CD\26\05\3A\06\40\18\0C\04\04\04\3A\06\40\2F\A0\32\06\40\E1\A7\20\04\3E\B1\18\10\3D\20\04\3E\B0\18\09\3D\20\04\3E\AC\18\02\3E\AB\2A\1A\40\2B\77\C1\18\AD\E1\2B\D1\ED\52\28\A6\19\CD\5C\05\3E\76\D7\D7\C9\D9\CD\CA\0A\76\32\34\3B\2A\76\F6\C1\C5\21\73\04\09\CD\CA\0A\C1\C5\21\4D\05\09\FD\CB\78\CE\CD\CA\0A\C1\D0\21\D4\04\09\CD\CA\0A\2A\18\40\ED\5B\16\40\CD\5D\0A\C9\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\E3\E5\D9\CD\CA\0A\76\76\00\00\2E\33\38\2A\37\39\00\26\2B\39\2A\37\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\E5\CD\D8\09\22\12\40\E5\2A\0A\40\CD\D8\09\22\16\40\D1\ED\52\C1\E1\D0\ED\52\ED\5A\D8\E1\E1\C9\2A\18\40\ED\5B\16\40\ED\52\E5\E5\C1\2A\12\40\E5\CD\9E\09\D1\C1\2A\0C\40\A7\ED\52\20\05\19\09\22\0C\40\2A\16\40\D5\ED\B0\E1\C9\D9\CD\CA\0A\76\28\34\35\3E\76\F6\C1\C5\21\73\04\09\CD\CA\0A\D1\D5\C5\21\D4\04\19\CD\CA\0A\C1\ED\53\18\40\70\23\71\ED\43\0A\40\C1\FD\CB\78\C6\EB\18\1D\D9\CD\CA\0A\76\37\2A\33\3A\32\27\2A\37\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\E1\22\18\40\C1\C5\D9\CD\CA\0A\76\76\00\00\38\39\26\37\39\2E\33\2C\00\31\2E\33\2A\00\33\34\1B\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\2A\0A\40\CD\D8\09\22\16\40\ED\52\C1\28\0E\FD\CB\78\4E\20\08\EB\CD\EA\09\38\02\E1\C9\D1\C5\D5\D9\CD\CA\0A\76\76\00\00\2E\33\28\37\2A\32\2A\33\39\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\7C\B5\20\03\21\01\00\E5\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\35\E1\E5\01\07\00\ED\42\06\03\2B\7E\CB\87\FE\EC\28\04\10\F6\18\DE\C5\D5\3E\1C\23\C5\CD\26\05\EB\C1\10\F8\E1\C1\48\06\00\2B\56\2B\5E\EB\09\EB\73\23\72\E1\09\18\BD\FD\CB\78\46\20\22\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\11\CD\8A\15\60\69\CD\D8\09\EB\E1\E5\2B\72\2B\73\18\E2\2A\16\40\EB\2A\18\40\37\ED\52\C1\E1\30\1E\FD\CB\78\4E\FD\CB\78\8E\20\23\A7\ED\42\44\4D\EB\CD\EA\09\38\04\28\02\18\14\EB\01\01\00\09\EB\72\23\73\EB\09\EB\D5\C5\2B\CD\F2\09\18\C9\FD\CB\78\46\FD\CB\78\86\20\65\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\38\54\E1\E5\2B\56\2B\5E\2A\0C\40\37\ED\52\EB\30\05\11\0F\27\18\03\56\23\5E\E1\E5\D5\01\0A\00\A7\ED\42\EB\01\18\FC\18\07\01\9C\FF\18\02\0E\F6\AF\09\3C\38\FC\ED\42\3D\C6\1C\12\13\CB\01\30\E9\CB\71\28\EA\7D\C6\1C\12\13\13\C1\D5\CD\20\15\D1\01\05\00\ED\B0\18\9F\21\7C\40\E5\ED\4B\79\40\21\E6\0E\09\CD\CA\0A\D8\00\E1\E5\D5\01\0A\00\ED\42\0E\00\7E\FE\1C\20\04\03\23\18\F7\AF\B1\20\03\E1\18\D9\C5\A7\ED\42\CD\60\0A\C1\E1\2B\56\2B\5E\EB\A7\ED\42\EB\73\23\72\E1\ED\42\18\BE\D9\CD\CA\0A\76\76\7D\0D\29\34\33\AA\C9\00\D9\CD\CA\0A\76\37\2A\32\00\2C\2A\33\2A\37\26\39\2A\76\76\7D\03\31\2E\33\2A\00\33\3A\32\27\2A\37\0E\00\8F\FD\34\39\C1\C5\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\E5\CD\D8\09\20\06\CD\F2\09\CD\60\0A\C1\D1\C5\E5\D5\D9\CD\CA\0A\76\76\7D\03\33\34\1B\00\34\2B\00\38\35\26\28\2A\38\0E\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\C1\E1\C5\03\03\C5\03\03\03\03\C5\CD\9E\09\23\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\C1\E1\E3\EB\72\23\73\23\71\23\70\23\36\EA\23\E5\D9\CD\CA\0A\76\76\7D\03\2B\2E\31\31\00\28\2D\26\37\26\28\39\2A\37\0E\00\8F\ED\4B\39\40\0C\CD\18\09\2A\79\40\01\DC\0D\09\CD\CA\0A\F5\D7\D1\E1\C1\78\B1\28\05\0B\72\23\18\F7\36\76\10\FE\0D\20\FB\C9\D9\CD\CA\0A\76\2D\2A\3D\00\28\34\33\3B\2A\37\39\76\76\00\00\1C\00\16\00\38\39\34\35\76\76\00\00\1D\00\16\00\39\34\2C\2C\31\2A\76\76\F6\06\10\CD\2C\0A\D9\CD\CA\0A\29\2A\28\2E\32\26\31\00\39\34\00\2D\2A\3D\76\F6\C1\C5\21\81\0F\09\CD\CA\0A\78\A7\20\07\0D\28\2C\0C\E1\C8\E5\C5\CD\20\15\CD\DB\15\AF\D7\3E\14\D7\AF\D7\D1\0E\04\AF\06\04\CB\23\CB\12\17\10\F9\C6\1C\D7\0D\20\F0\3E\76\D7\18\C6\18\AB\06\10\CD\2C\0A\D9\CD\CA\0A\2D\2A\3D\00\39\34\00\29\2A\28\2E\32\26\31\76\F6\11\00\00\C1\C5\D5\21\DC\0D\09\CD\CA\0A\FE\76\28\18\D1\FE\1C\38\ED\FE\2C\30\E9\D7\D6\1C\06\04\CB\23\CB\12\10\FA\83\5F\18\DA\C1\78\A7\20\07\0D\28\B4\0C\E1\C8\E5\AF\D7\3E\14\D7\AF\D7\CD\20\15\CD\DB\15\3E\76\D7\18\B9\D9\CD\CA\0A\76\3B\26\37\2E\26\27\31\2A\38\00\35\37\2E\33\39\76\76\76\00\39\3E\35\2A\7D\04\33\26\32\2A\7D\05\3B\26\31\3A\2A\76\00\16\16\16\16\7D\04\16\16\16\16\7D\05\16\16\16\16\16\76\F6\ED\5B\10\40\1A\FE\80\C1\20\05\21\93\0E\09\E9\C5\E6\E0\FE\E0\20\05\21\C9\09\18\10\FE\40\20\05\21\15\0A\18\07\E6\20\20\09\21\78\0A\09\CD\CA\0A\18\D3\D9\CD\CA\0A\33\3A\32\27\2A\37\00\00\80\1A\E6\1F\C6\20\D7\1A\17\13\30\09\1A\E6\7F\D7\1A\17\13\30\F7\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\18\9D\D9\CD\CA\0A\2B\34\37\16\33\2A\3D\39\80\1A\E6\1F\C6\20\D7\13\3E\03\F5\2A\1C\40\EB\01\05\00\ED\B0\EB\22\1C\40\D5\FD\46\3A\0E\0F\CD\18\09\CD\DB\15\ED\4B\79\40\21\8A\0E\09\C5\E5\CD\CA\0A\E1\C1\D1\F1\3D\20\D2\D5\CD\CA\0A\D1\13\13\C9\D9\CD\CA\0A\38\39\37\2E\33\2C\00\00\80\1A\E6\1F\C6\20\D7\D9\CD\CA\0A\0D\7D\06\80\13\EB\4E\23\46\23\EB\78\B1\28\2A\C5\FD\7E\39\FE\01\20\15\D5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\1A\CB\77\28\02\3E\0F\D7\C1\0B\13\18\D2\D5\ED\4B\79\40\21\8A\0E\09\E5\CD\CA\0A\E1\CD\CA\0A\D1\C9\D9\CD\CA\0A\26\37\37\26\3E\00\00\00\80\1A\E6\1F\C6\20\D7\1A\CB\77\F5\13\28\03\3E\0D\D7\3E\10\D7\EB\5E\23\56\EB\19\23\E3\E5\EB\23\46\18\03\3E\1A\D7\C5\23\4E\23\46\C5\E5\CD\20\15\CD\DB\15\E1\D1\C1\10\EB\23\3E\11\D7\E5\D5\FD\7E\39\FE\10\30\0B\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\D1\E1\F1\20\3D\C1\A7\ED\42\09\30\28\C5\ED\5B\1C\40\01\05\00\ED\B0\ED\53\1C\40\E5\CD\DB\15\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\18\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\D1\C9\C1\A7\ED\42\09\30\EB\C5\D5\D5\FD\7E\39\FE\01\20\15\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\7E\CB\77\28\02\3E\0F\D7\D1\1B\7A\B3\23\D5\20\D4\D1\E5\ED\4B\79\40\21\8A\0E\09\CD\CA\0A\FD\46\3A\0E\0F\CD\18\09\E1\D1\18\B1\00\D9\CD\CA\0A\76\35\37\34\2C\37\26\32\00\38\2E\3F\2A\76\F6\C1\C5\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\C1\D8\E5\21\27\0E\09\CD\CA\0A\D1\19\E5\D9\CD\CA\0A\76\76\00\00\27\3E\39\2A\38\00\3A\38\2A\29\00\14\80\C1\CD\20\15\CD\DB\15\C9\D9\CD\CA\0A\76\33\3B\32\00\38\39\34\37\26\2C\2A\76\76\00\00\1D\00\16\00\38\39\34\37\2A\76\76\00\00\1E\00\16\00\37\2A\28\34\3B\2A\B7\C1\C5\21\BB\0D\09\CD\CA\0A\C1\C5\21\DC\0D\09\CD\CA\0A\FE\1D\28\06\FE\1E\28\5A\C1\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\38\39\34\37\2A\76\F6\C1\21\3F\0F\09\CD\CA\0A\2A\0A\40\CD\D8\09\D1\EB\A7\ED\52\D8\E5\2A\79\40\01\00\20\A7\ED\42\20\03\01\00\30\60\69\C1\71\23\70\23\EB\ED\B0\D5\2A\79\40\01\27\0E\09\CD\CA\0A\44\4D\E1\71\23\70\23\EB\78\B1\28\02\ED\B0\C9\06\15\CD\2C\0A\D9\CD\CA\0A\76\37\2A\28\34\3B\2A\37\76\F6\E1\01\00\20\A7\ED\42\20\03\01\00\30\60\69\4E\23\46\23\E5\C5\2A\0A\40\23\CD\D8\09\C1\C5\E5\CD\9E\09\E1\EB\2A\0C\40\C1\A7\ED\52\20\05\19\09\22\0C\40\E1\ED\B0\4E\23\46\23\78\B1\C8\E5\CD\9A\14\CD\C5\0E\2A\10\40\D1\EB\ED\B0\EB\22\10\40\C3\9D\14\D9\CD\CA\0A\76\39\26\35\2A\00\2E\33\29\2A\3D\76\76\00\00\2A\33\39\2A\37\00\39\2E\39\31\2A\0E\76\F6\C1\C5\21\77\03\09\CD\CA\0A\D9\CD\CA\0A\00\00\39\2E\39\31\2A\0E\80\2A\14\40\EB\2A\1A\40\A7\ED\52\44\4D\CD\6B\0B\3E\76\D7\D7\D9\CD\CA\0A\00\00\38\39\26\37\39\00\39\26\35\2A\00\26\33\29\00\35\37\2A\38\38\00\26\33\3E\00\30\2A\3E\9B\C1\C5\21\DC\0D\09\CD\CA\0A\06\0F\CD\2C\0A\1E\19\16\03\C1\C5\21\9B\0D\09\06\00\CD\CA\0A\38\EF\10\F9\1D\20\F4\15\20\F1\CD\CA\0A\38\07\10\F9\1D\20\F6\18\DB\0E\01\06\00\CD\CA\0A\38\04\10\F9\18\CE\1E\94\06\1A\1D\DB\FE\17\CB\7B\7B\38\F5\10\F5\20\04\FE\56\30\E0\3F\CB\11\30\DB\79\E6\7F\D7\CB\11\30\D1\C1\C5\21\8A\0E\09\CD\CA\0A\18\A1\3E\7F\DB\FE\D3\FF\1F\30\03\17\17\C9\F1\C1\21\93\0E\09\CD\CA\0A\01\00\00\10\FE\0D\20\FB\18\3B\00\D9\CD\CA\0A\76\76\00\00\2A\33\39\2A\37\00\33\3A\32\27\2A\37\00\2B\34\37\00\28\2D\34\2E\28\2A\9B\C9\CD\2B\0F\CD\BB\02\2C\20\FA\CD\BB\02\44\4D\2C\28\F8\CD\BD\07\7E\CD\23\0F\C9\CD\23\0F\3E\76\D7\D7\D7\2A\79\40\E5\01\BF\0E\09\0E\2A\CD\CA\0A\01\B4\00\CD\35\0F\FD\7E\34\A7\00\CA\58\00\2A\25\40\01\FB\F7\ED\42\E1\CA\13\04\44\4D\E9\D9\CD\CA\0A\76\76\00\00\2E\33\28\31\3A\29\2A\00\3B\26\37\2E\26\27\31\2A\38\00\0F\00\00\3E\00\34\37\00\B3\ED\4B\39\40\3E\06\81\4F\CD\18\09\ED\4B\79\40\21\DC\0D\09\CD\CA\0A\FE\3E\28\11\D9\CD\CA\0A\33\34\7D\03\80\21\00\00\ED\5B\10\40\C9\D9\CD\CA\0A\3E\2A\38\00\00\80\2A\10\40\EB\2A\14\40\37\ED\52\C9\3E\76\D7\3E\03\FD\BE\3A\C0\21\BF\0E\09\C5\0E\28\CD\CA\0A\C1\21\DC\0D\09\CD\CA\0A\FE\28\20\10\3E\11\FD\96\3A\57\2A\0C\40\01\E8\00\09\CD\76\08\06\11\CD\2C\0A\C9\D9\CD\CA\0A\00\00\35\37\2A\38\38\00\8B\79\D7\D9\CD\CA\0A\0B\00\34\37\00\26\33\3E\00\34\39\2D\2A\37\00\30\2A\3E\9B\C9\CD\BC\14\E1\E3\CD\B7\07\EB\2A\0C\40\ED\52\EB\D8\E5\7E\FE\FA\28\0F\CB\87\FE\EC\28\17\E1\2B\56\2B\5E\19\23\18\E0\23\7E\CD\B4\07\28\F9\FE\DE\20\F5\23\18\DE\23\7E\FE\1C\38\04\FE\26\38\F6\CD\B4\07\20\DA\23\7E\FE\76\20\D4\E5\ED\4B\1C\40\C5\CD\FB\13\E1\CD\CB\12\E1\D1\E3\E9\C5\D9\CD\CA\0A\00\00\2B\37\34\32\00\31\2E\33\2A\80\ED\4B\0A\40\CD\20\15\CD\DB\15\D9\CD\CA\0A\00\39\34\00\31\2E\33\2A\00\8F\FD\34\39\C1\21\81\0F\09\CD\CA\0A\C5\CD\20\15\CD\DB\15\E1\23\CD\D8\09\E3\E9\2A\12\40\E5\2A\18\40\E5\2A\16\40\E5\2A\02\40\E5\FD\36\01\40\FD\36\2D\61\21\00\1E\22\29\40\2A\14\40\2B\E5\22\12\40\01\06\00\CD\9E\09\2A\14\40\22\16\40\2A\79\40\01\C4\0F\09\E5\ED\62\39\22\02\40\CD\EF\0E\ED\5B\14\40\1B\E1\CD\9D\14\ED\53\1C\40\CD\8A\15\E1\22\02\40\E1\22\16\40\E1\22\18\40\E1\22\12\40\C9\D9\06\01\E1\7E\FE\7D\28\05\07\CB\3F\18\03\23\46\AF\F5\D7\F1\10\FA\23\E5\D8\18\E6
   2 REM \01\00\10\11\00\00\21\82\40\ED\B0\C9\2A\10\40\11\7D\40\A7\ED\52\EB\01\00\00\A7\7E\89\4F\38\07\23\1B\7A\B3\C8\18\F3\04\18\F6\21\5B\40\F9\2A\04\40\11\00\10\AF\ED\52\22\04\40\2B\36\3E\2B\F9\2B\2B\22\02\40\C3\75\06\1C\1C\1C\1C\1C
   3 POKE 16419,10
   4 POKE 16420,0
   5 POKE 16394,10
   6 POKE 16395,0
   7 LET TK=16514
   8 RAND USR TK
   9 STOP 
  10 REM %Y%O%U%R% %P%R%O%G%R%A%M% %H%E%R%E
 100 CLS 
 105 SLOW 
 110 POKE 16418,2
 120 PRINT "***** THE DELPHIC TOOLKIT *******";TAB 31;"** (C) 1985 DELPHIC ENTERPRISES **";TAB 31;"*** TAPE LICENSEE- THOMAS WOODS**"
 130 PRINT ,,,,,,"%*%D%O% %Y%O%U% %W%A%N%T% %T%O%:---",,,,,"1. CARRY TOOLKIT WITH YOUR PGM. ",,"2. LOCATE TOOLKIT IN 8-16K BLOCK",,"3. LOCATE TOOLKIT BEYOND RAMTOP"
 140 LET Z$=INKEY$
 150 IF Z$="" THEN GOTO 140
 160 IF Z$="1" THEN GOTO 200
 170 IF Z$="2" THEN GOTO 300
 180 IF Z$="3" THEN GOTO 400
 190 GOTO 100
 199 STOP 
 210 LET TK=16514
 215 CLS 
 220 GOSUB 800
 230 PRINT ,,"LIST 10, THEN USE TOOLKIT TO    DELETE FROM LINE 10 TO LINE 999.",," THEN ENTER YOUR PROGRAM LISTING STARTING AT LINE 10."
 240 STOP 
 250 GOTO 100
 300 CLS 
 310 PRINT "ENTER START ADDRESS 8192-12288"
 320 INPUT TK
 330 IF TK<8192 OR TK>12288 THEN GOTO 370
 340 GOSUB 800
 350 GOTO 500
 360 PRINT ,,"RAMTOP TOO HIGH"
 370 PRINT ,,"%O%U%T% %O%F% %R%A%N%G%E"
 380 PAUSE 200
 390 GOTO 100
 400 CLS 
 410 LET RMTP=PEEK 16388+256*PEEK 16389-4096
 420 IF RMTP>45056 THEN GOTO 360
 430 IF RMTP>28672 THEN GOTO 470
 440 RAND USR 20657
 450 LET TK=RMTP
 455 GOSUB 800
 460 GOTO 500
 470 PRINT ,,"COMPUTER MODIFIED TO RUN        MACHINE CODE FROM 32-48K? Y/N"
 475 LET Z$=INKEY$
 480 IF Z$="Y" THEN GOTO 435
 485 IF Z$="N" THEN GOTO 360
 490 GOTO 475
 500 RAND TK
 510 POKE 20620,PEEK 16434
 520 POKE 20621,PEEK 16435
 530 RAND USR 20616
 540 PRINT ,,"%*%T%O%O%L%K%I%T% %F%I%L%E%D% %I%N% %S%E%L%E%C%T%E%D% %A%R%E%A%.",,"%"%B%R%E%A%K%"% %T%O% %E%N%T%E%R% %B%A%S%I%C% %P%R%O%G%R%A%M% % % %A%N%Y% %O%T%H%E%R% %K%E%Y% %T%O% %"%N%E%W%.%"% % % % % % % % "
 550 IF INKEY$="" THEN GOTO 550
 560 NEW 
 800 PRINT "TOOLKIT START ADDRESS =";TK;"       ",," RAND USR TK OR ";TK;" TO CALL."
 810 RETURN 
 900 IF INKEY$="" THEN GOTO 900
 910 IF INKEY$="S" THEN GOTO 940
 920 IF INKEY$="P" THEN GOTO 100
 930 GOTO 900
 940 FAST 
 950 POKE 16418,0
 960 LET L=USR 20628
 970 SAVE "TOOL%S"
 980 LET M=USR 20628
 990 SLOW 
 995 IF M=L THEN GOTO 900
 996 CLS 
 997 PRINT AT 10,12;"%B%A%D% %L%O%A%D","ANY KEY TO NEW AND TRY AGAIN"
 998 GOTO 550
 999 STOP 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.