This program is a BASIC loader and tape-management utility for an inventory application written by Kristian Boisvert, published by Byte Power in 1986. It uses machine code routines loaded at address 55213 (decimal) for its core inventory logic, with the BASIC acting purely as a shell for load, save, verify, and quit operations. The program exploits `PEEK 65535` as a jump-dispatch mechanism, reading a value stored at the top of RAM to determine which routine to call after machine code execution completes. Line 9000 serves as the bootstrap autostart entry point (saved with `LINE 9000`), and line 9999 handles the two-block tape mastering sequence—saving the BASIC loader followed by the 5213-byte machine code block starting at address 50000 (5E4 hex).
Program Structure
The BASIC listing is divided into clearly labelled functional blocks, each introduced by a REM statement:
- Lines 0–20: Initialisation — clears memory to address 49999, prints the screen, and launches the main machine code routine at 50900 via
RANDOMIZE USR 50900. - Lines 50–75: LOAD block — prompts for a filename, loads a CODE block into address 55213, then jumps into a second machine code entry point at 51903.
- Lines 100–150: SAVE block — prompts for a filename, saves 2738 bytes of machine code from 55213, then verifies the tape.
- Lines 200–210: QUIT — resets
CLEARto the top of RAM and issuesNEWto wipe the system cleanly. - Lines 8000–8020: Reusable
GO SUBsubroutine for validated filename input. - Line 9000: Bootstrap autostart line, loaded first from tape; performs colour setup, displays a splash screen, and loads the machine code block.
- Line 9010: Post-load integrity check using
PEEK 23681(system variableRASP/printer buffer flag, here repurposed as a ready flag). - Line 9999: Tape mastering utility — saves both the BASIC and the CODE block and verifies both.
Machine Code Usage
The program depends entirely on machine code for its inventory logic. Three distinct entry points are referenced from BASIC:
| Address | Purpose |
|---|---|
50900 | Main menu / initialisation routine, called at startup (line 10) |
51903 | Post-load entry point, called after a file is loaded (line 70) |
55213 | Base address of the CODE block — inventory data or runtime engine |
The machine code block is 2738 bytes long (per the SAVE at line 130) but line 9999 saves 5213 bytes from address 50000 (5E4 hex). This discrepancy suggests that line 9999 is the master-save of the full binary (machine code plus inventory data), while line 130 saves only the user data portion at 55213.
Bootstrap and Integrity Check
Line 9000 is the autostart entry (saved with LINE 9000) and acts as the tape loader. After loading the machine code with LOAD ""CODE, line 9010 peeks system variable address 23681. This address corresponds to the RASP system variable, which the machine code apparently sets to a non-zero value to signal a successful load. If it remains zero (e.g., the wrong code block was loaded), the program lists line 9999 and stops — effectively self-documenting the mastering procedure for the developer.
Key BASIC Idioms and Techniques
CLEAR 49999at line 9 protects the machine code region (50000 onwards) from BASIC’s use of RAM.INPUT "FILE NAME:"; LINE A$uses theLINEkeyword to accept any characters, avoiding tokenisation of the entered string.- The filename length is validated to a maximum of 10 characters in the
GO SUB 8000subroutine, matching the Spectrum’s tape filename limit. GO TO 110at line 120 (whenA$="") loops back into the subroutine call rather than the subroutine body itself — this works because line 110 is theGO SUB 8000call, so an empty entry simply re-invokes the prompt.- The copyright symbol
©appears in theREMat line 0 and in the splashPRINTat line 9000, consistent with the TS2068/Spectrum character set.
Content
Source Code
0 REM INVENTORY WRITTEN BY KRISTIAN BOISVERT ©1986 BYTE POWER
1
2 REM PRINT DRIVER SHOULD BE BETWEEN 30000 & 49999 OR BETWEEN 58000 & 65535!
9 CLEAR 49999
10 PRINT AT 0,0;: RANDOMIZE USR 50900
20 GO TO PEEK 65535
50 REM LOAD
55 GO SUB 8000
60 LOAD A$CODE 55213
70 CLS : PRINT AT 0,0;: RANDOMIZE USR 51903
75 GO TO PEEK 65535
100 REM SAVE
110 GO SUB 8000
120 IF A$="" THEN GO TO 110
130 SAVE A$CODE 55213,2738
140 PRINT AT 21,0;"REWIND TAPE TO VERIFY ";A$: VERIFY A$CODE
150 GO TO 70
200 REM QUIT
210 CLEAR 65535: NEW
8000 REM GET STRING
8010 INPUT "FILE NAME:"; LINE A$: IF LEN A$>10 THEN GO TO 8010
8020 RETURN
9000 INK 0: PAPER 7: BORDER 7: CLS : PRINT AT 8,11;"INVENTORY";AT 10,2;"WRITTEN BY KRISTIAN BOISVERT";AT 12,8;"©1986 BYTE POWER";AT 20,0;"STILL LOADING...": INK 7: PRINT AT 15,0;: LOAD ""CODE : INK 0
9010 IF PEEK 23681=0 THEN PRINT AT 15,0;: LIST 9999: STOP
9020 GO TO 10
9999 SAVE "INVENTORY" LINE 9000: SAVE "INVENTORY"CODE 5E4,5213: VERIFY "INVENTORY": VERIFY "INVENTORY"CODE
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

