A case in point is the 'ReHead' program. This is a bridge between the two common ways of storing the information needed to make a file SAVEd from ZX BASIC reloadable later. As well as the code, data or BASIC program, a Spectrum needs to know the file-type, start address or line, and the boundary between BASIC code and variables inside the main data-block.
There are two incompatible ways to do this - the TAP file header invented by Carlo Delhez (RIP) for his Spectrum emulators for the Sinclair QL and later systems, much used by other emulators and repositories like World of Spectrum. It uses 16-bit offsets so it's limited to files of less than 64K, just like the original Spectrum tape format it's modelled upon. The other one, invented by Amstrad for the Spectrum Plus 3, later used by EsxDOS and NextZXOS, creates a slightly larger file with provision for files more than 64K long. The most obvious difference is that the Amstrad header starts with the text PLUS3DOS, soon followed by over 100 null characters to pad it to a CP/M 128-byte record.
My original version of the converter is version 1.3, written on the Next. The later version 2.8 runs on any Spectrum with Spectranet fitted. If the %ASAVE and %ALOAD commands are replaced with code to save or load raw bytes at the chosen address it can be used with any other ZX filesystem. The subroutine at the end of the ZX BASIC version shows how ASAVE can be emulated, rather slowly, by writing the bytes one at a time to a serial file on a Spectrum with the +3e update ROMs I reviewed in the Crash 2019 annual. If you make a version for another Spectrum configuration, please let me know.
tnfs ~
should be entered:
tnfsd ~
The missing suffix 'd' stands for 'daemon', the Unix term for a program that works in the
background.Simon N Goodwin
Spectranet, ZX Diag Cart and K-Mouse at Byte Delight
Spectranet official guide on alioth.net
Spectranet support page on Facebook, frequented by both Dylan Smith and Ben Versteeg
Microdrive cables from Sintech
Mouse-compatible Spectrum software downloads
Spectrum Next homepage
The main Spectrum Next page on Facebook
The NextBASIC programmers' Facebook group
Spectrum Next RAM and Wi-Fi expansion from RetroBench
Next manual download (only available in 7z format)
Hoglet Acorn BBC Micro core documentation
Unofficial Spectrum Next cores by Victor Trucco
Patreon for Victor's unofficial cores
Simon N Goodwin's free NextBASIC tools
TAP to PLUS3DOS header converter:
PLUS3DOS to TAP header converter:
Combined converter example in ZX BASIC for Spectranet
Combined converter example, ZX BASIC with a +3DOS header
Combined converter example, ZX BASIC ASCII source text
This is a translation of the NextBASIC ReHead program included below. It uses only standard ZX BASIC features apart from the %ALOAD and %ASAVE commands which are specific to Spectranet and allow files to be loaded and saved without checking for or adding any sort of header. These commands allow files to be loaded and saved with headers other than the default .TAP header Spectranet uses. Thanks to Dylan Smith for adding the %ASAVE command once users asked for it on the Spectranet Facebook page. As standard ZX BASIC is used, there is no check that the specified file exists or is no more than 32K long. If the file cannot be found the program will stop with an error report. If it's more than 32K long it is liable to be truncated, preventing re-loading. As all processing is done in memory, for speed, there's only 48K available for the conversion program, screen, system variables and both sorts of header, and only 32K left after that lot for the body of the array, program or code file being converted.
Mouse demo in PLUS3DOS format:
kMouse/Kempston Mouse demo TAP
Mouse demo as ZX BASIC ASCII source text
TAP to PLUS3DOS header converter
PLUS3DOS to TAP header converter
Combined converter example in NextBASIC tokens
Combined converter example, NextBASIC source text
Note that spaces in filenames may cause problems because of the inconsistent way Amstrad and Sinclair handle them - all characters in a ten-character Sinclair filename are significant, whereas Amstrad suppresses spaces before a dot in an attempt to be compatible with the rudimentary wildcard-handling in CP/M and MSDOS, where * pads the pattern with spaces up to the eight-character stem limit, rather than matching any characters as a true wildcard would. The best way round this is to rename the file to exclude spaces.
Mouse demo in ZX BASIC PLUS3DOS token format
Mouse demo as NextBASIC ASCII source text
Simon's Z80n assembler examples
Enjoy! Simon N Goodwin, July..December 2020
ZX Spectrum Next downloads and information
UTILITIES
These utilities are downloadable in ZX BASIC format or optimised for NextBASIC, though the ZX BASIC
ones will work on any Spectrum with at least 48K of memory. The maximum size of file that can be converted is 32K.
ZX BASIC
NextBASIC