DZX-Forth

Description of the page content

A Forth for ZX Spectrum +3e.

Sleeping project. Started on 2014-11-03. 30% completed.

Tags:

Description

DZX-Forth is a standard Forth system under development for ZX Spectrum +3e.

Origin

DZX-Forth was forked from CP/M DX-Forth a Forth-94 system for 8088 CP/M.

The fork was done from DX-Forth 4.00, then updated to DX-Forth 4.09; also some changes and fixes from versions 4.10 and 4.11 were incorporated later into DZX-Forth.

Goal

The first goal was to build a modern Forth system for ZX Spectrum +3 and ZX Spectrum +3e. But the original +3DOS has an important bug: it is impossible to know the size of files that don’t have a +3DOS header. Happily this bug was fixed in ZX Spectrum +3e v1.37 by its author, Garry Lancaster. Therefore ZX Spectrum +3e became the only target platform for DZX-Forth.

Support for IDEDOS and ResiDOS were planned.

Status

DZX-Forth is a sleeping project. It was developed from 2014-11-03 to 2015-05-20. It’s not finished but it’s usable.

Two development problems put the project on stand-by:

  • DX-Forth is written for the 8080 processor. Therefore many routines are not optimized for the more powerful Z80. This means some code is slower and bigger than it could be. Identifying and optimizing those parts of the original source was an additional task.

  • The kernel of DX-Forth is very big, intended for a 64-KiB RAM space. The ZX Spectrum +3e has a similar paging mode, but the goal was to fit the system into the 48 KiB of the ordinary paging modes. Moving the less used code from the kernel to the library became a problem, because many words depend on shared assembly routines, which are not accessible outside the kernel without adding new words.

Some code of DZX-Forth has been reused in Solo Forth, a Forth system with a different approach, under active development, for ZX Spectrum 128 and compatible computers, supporting +3DOS, G+DOS and TR-DOS, and planned support for NextOS and others. At the time of writing, Solo Forth has superseded DZX-Forth by far.

A Git repository for DZX-Forth was created on 2016-03-21 with the development backups, in order to make future development easier. It was uploaded to GitHub on 2018-08.

Usage

Two DSK disk images are included in the bin directory. Note both of them are double-sided 80-track 760-KiB disk images, not the original single-sided 40-track 190-KiB format of +3DOS. Your ZX Spectrum emulator should support them.

Open disk A with your favorite ZX Spectrum emulator. A launcher is provided for the Fuse emulator. Open also disk B, which contains source files.

Example: How to open a blocks file from disk B:

s" b:tools.fb" r/o open-block-file
1 load
1 list

Documentation

Documentation is in a very early stage. It mostly consists of the original documentation of DX-Forth, converted to Asciidoctor format, and with some changes and addons.

Building the Forth system

A Makefile file for make is provided. But at the time of writing (2016-03-22) compilation is not possible because the Forth tool which builds the BASIC loader depends on some modules of the Galope library, which is not published yet. This is noted in the Makefile and will be solved in a future version. Meanwhile, a temporary solution is to edit the Makefile and comment out the following recipe, provided the address of the Forth system has not been changed (it’s 25000 by default):

dzx-forth_loader.bas : dzx-forth_loader.bas.raw dzx-forth_kernel.tap
	@make dzx-forth_kernel.tap
	./tools/patch_the_loader.fs

Then make sure the requirements of the Makefile, which are listed in its header, are installed on your system, and start the building with one of the following commands:

Command Goal

make

build both disks

make dsk1

build only disk 1

make dsk2

build only disk 2

make doc

build the documentation

Download

DZX-Forth in GitHub.

Related pages

Solo Forth
A disk-based Forth system for ZX Spectrum 128, for cross-development of ZX Spectrum programs.
Couplement Forth
A subroutine-threaded Forth for ZX Spectrum.