Data Maker

Developer(s): Kristian Boisvert
Date: 1988
Type: Program
Platform(s): TS 2068

This program will allow you to transform codes into DATA statements in a BASIC program. This is particularly useful for sending machine language programs to magazines and such. You enter a base address for the Data Maker routine (31000–65248), the first and last addresses of the code to convert, the first line number, the line increment and the number of items per line. The program builds a customised 288-byte machine-code routine and tells you how to save it; you then NEW, load the routine and your code, CLEAR below the base address and call it, and the code reappears as numbered DATA lines ready to SAVE or MERGE.

Two errors are possible, according to the magazine: out of memory (the routine is placed too low or there is too much code) and no more room for line (too many DATA lines, or the first line too high). Written by Kristian Boisvert, ©1988 Byte Power. Loading name DATA MAKER. Published on the Fall 1988 (Issue 11) tape of Byte Power.

Program Analysis

Unlike most Byte Power programs, Data Maker is plain BASIC with its machine code in DATA. Lines 20–70 work out the addresses of the routine’s variables and subroutines from the base address, under names such as FIRST, LAST, LINE, STEP, ITEM, POKE, NEXT and ROM. Lines 1000–1270 hold the 246 DATA items of the routine, with those names standing in for addresses, and lines 80–110 POKE them in: any value over 255 is written as a two-byte address. Lines 111–112 then POKE in the user’s start and end addresses, first line number, increment and items per line.

The generated routine

The routine walks from the start to the last address, converting each byte to decimal digits by repeated subtraction of 100, 10 and 1, and inserts them into the program area followed by the hidden number form (CHR$ 14 and five bytes), with commas between items, building a new line whenever the item count is reached. Line numbers are checked against 9999. Its last few bytes read the ROM at address 153 and jump to one of two ROM addresses, which appears to select the right make-room routine for either the TS2068 or the Spectrum ROM.

Notable Techniques

  • A small assembler-style relocation: symbolic names in DATA statements resolved to addresses at POKE time, so the routine can be built at any base address.
  • Variable names that read like keywords (LINE, STEP, POKE, NEXT, LEN), spelled out letter by letter.
  • The generated DATA lines carry proper hidden five-byte numbers, so they load and run like typed-in lines.

Potential Issues

  • The input at line 15 is not checked: a last address below the first, or a line increment of 0, is accepted.
  • Any DATA value over 255 is treated as an address, so the scheme relies on all real byte values in lines 1000–1270 being 255 or less.

Appears On

Issue 11 of BYTE POWER, the Canadian tape magazine for the Timex/Sinclair 2068 edited by Eric and Kristian Boisvert.

Related Articles

This program will allow you to transform codes into DATA statements in a BASIC program.

Image Gallery

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