Solo Forth development history in 2016-06..2016-09

Description of the page content

Solo Forth development history in 2016-06..2016-09



Move there to the library.

Move noop in order to reuse its code and save 2 bytes from the previous word:

; ----------------------------------------------
  _code_header perform_,'PERFORM'

; doc{
; perform  ( a  -- )
; Execute the word whose xt is stored in _a_.  Do nothing if
; the content of _a_ is zero.
; }doc

  pop hl
  ld a,(hl)
  inc hl
  ld h,(hl)
  ld l,a
  or h
  jp nz,execute_hl
  ; Execution continues in `noop`:

; ----------------------------------------------
  _code_header noop_,'NOOP'

; doc{
; noop  ( -- )
; }doc


Fix need-here, which left the parsed string on the stack.

: need-here  ( "name" -- )
  parse-name needed-word 2@ 2>r
  new-needed-word  2dup needed-word 2! undefined?
  if  blk @ load  else  2drop  then  2r> needed-word 2!  ;

  \ doc{
  \ need-here  ( "name" -- )
  \ If "name" is not a word found in the current search order,
  \ load the current block.
  \ This is a faster alternative to `need`, when the needed
  \ word is in the same block, and conditional compilation is
  \ used with `?\`, `?(` or `[if]`.
  \ }doc

Add [''], the counterpart of '', recently added:

[unneeded] '' ?(  need need-here  need-here name>>
: ''  ( "name" -- xtp )  defined dup ?defined name>>  ; exit ?)

[unneeded] [''] ?(  need need-here  need-here ''
: ['']  '' postpone literal  ; immediate compile-only exit ?)
  \ Compilation: ( "name" -- )
  \ Execution: ( -- xtp )

Fix find-name with ?do.

Fix the descriptions of the converters.


Add gcd operator.


Add color constants and color modifiers.

Fix needing c@+.

Improve needing of 128K sound effects. Now every sound effect can be required individually.


Fix requiring c1+!, c1-!, 1+! and 1-!.

Fix comment.


Improve definition of 128K sounds. Now sounds are created with sound instead of sound:, and when they are executed they just play instead of returning the address of its data.

Add a 128K sound editor. First version. It's usable but needs improvements.

Start support for TR-DOS. First changes to support TR-DOS 5.xx, with the Beta Disk 128 interface. The TRD disk image is created by the Makefile, but it's not usable yet.

Fix boot in TR-DOS.

Extract DOS-specific code from the kernel. The kernel code that specific to G+DOS (finished) and +3DOS (unfinished) has been moved to independent files. A new file for TR-DOS has been created too.

Fail trying to save the library as TR-DOS file. TR-DOS does not accept files larger than $FF00 bytes. The solution is to save the library on the disk sectors, the method used with G+DOS.

Improve sector-id for G+DOS, add rec/track.

Prepare low-level support for TR-DOS. The low-level code has been adapted from the G+DOS version.

The library TRD disk images are created, with the source on the sectors, thanks to the implementation of fsb2-trd (, but they can not be tested, because they can not be open with the Fuse emulator, probably because it examines sector 8 of track 0, where TR-DOS stores its own meta data. The solution is to use the track 0 from a formated disk image, but a custom version of fsb2-trd is needed for that.


Make library TRD disk images with track 0. A Forth program creates track 0 files, containing the metadata of a formated TR-DOS empty disk, in order to add them at the start of the 636-KiB disk images (formated size, therefore without the 4-KiB track 0), now created by a provisional modified version of fsb2-trd. This way the TR-DOS library disks can be opened by the Fuse emulator.

Fix and improve low-level support for TR-DOS. Not working yet, though.

Fix requisites of the kernel.

Make the TR-DOS library work in drive 0. Library source blocks can be loaded, but only from drive 0. Only blocks 1..100 have been tested. The calculation of sector-id must be tested for the whole range of sectors, both sides of the disk.

Reorganize the exception codes; add TR-DOS codes. In order to make calculations easier, all DOS will share the range of exception codes.

Fix G+DOS (cat); update the G+DOS module.


Start implementing ior to DOS calls. The goal is all Forth words that call any DOS routine return an ior error result.

Print DOS name in the greeting message.

Organize the disk images in directories.

├── gplusdos
├── plus3dos
└── trdos

Fix conditional compilation of some library words. The conditional compilation of ]l, ]2l, exec, eval, save-here and restore-here was wrong.

Improve needing of , [is] and is. No and [is] can be needed apart.

Rename error-messages-block to errors-block. Also combine blocks of its module to save two of them.

Compact the library. The code of several modules has been compacted and reorganized in order to save blocks, because of the 636 KiB usable in TR-DOS disk images.

Further compression will be possible, because there are 1-block modules that contain 1-line definitions, and they could be combined into one single module with conditional compilation.

Split the meta tools disk into two. So far the meta tools disk contained the main library, the tests and the benchmarks. It fitted for a 800-KiB G+DOS disk image, but not for a 636-KiB TR-DOS disk image.

Now the tests and the benchmarks are in different disks.

Fix requisite of "Siderator 2".

Rename disk images; add blks checker. All disk image files have been renamed after a shorter and clearer format, easier to use with the SDL file interface of the Fuse emulator. Now disks are numbered the same way in every DOS, with an ordinal number instead the identifier of the drive it's supposed to be used with.

├── gplusdos
│   ├── disk0.mgt
│   ├── disk1_lib.mgt
│   ├── disk2_lib+games.mgt
│   ├── disk3_lib+benchmarks.mgt
│   ├── disk4_lib+tests.mgt
│   └── disk9_lib_without_dos.mgt
└── trdos
    ├── disk0.trd
    ├── disk1_lib.trd
    ├── disk2_lib+games.trd
    ├── disk3_lib+benchmarks.trd
    ├── disk4_lib+tests.trd
    └── disk9_lib_without_dos.trd

"disk9" is a special disk image used for debugging. It contains the core library except the DOS modules. This means disk9 contains exactly the same blocks in all DOS implementations. This is useful to check if disk access works fine when a new DOS is implemented, comparing the output of blks (a debug tool, temporarily included in the kernel) to a different DOS. The TR-DOS implementation has been checked this way. It works fine, except the default drive can not be changed yet.


Rename the kernel file in TR-DOS. TR-DOS filenames are only 8 bytes long, and their type is stored apart, thus a standard extension is not needed; anyway, "forth.bin" does not fit.


Add lib-order. So far the library must be one single disk. lib-order, set-lib-order and get-lib-order will make it possible to use several library disks and configure the order in which they are searched, up to the maximum allowed by the DOS. These words are not used by need yet, so they are useless at the moment.

Make G+DOS' transfer-sector return an ior.

Remove G+DOS' old set-library-disk. set-library-disk and get-library-disk are superseded by set-lib-order and get-lib-order, which are implemented but not used by locate yet.

Build disk0 for +3DOS. The main disk of +3DOS was deactivated some time ago, because +3DOS support is not implemented. Now the disk is built, but it can not boot because the 128K memory paging must be adapted to +3 first.

Add more tries and tests to finish TR-DOS support.


Fix system-bank for +3DOS. Now the +3DOS version boots fine.

Make TRD disk images with fsb2-trd. The ad hoc solution used so far to create sectors 0 of the TRD disk images has been moved to fsb2 and integrated into fsb2-trd, which now does the whole job.

Improve restoring of IX in TR-DOS. ld ix,next (4 bytes) is faster than push ix and pop ix (4 bytes).

Rename the FZX fonts to fit any DOS. The filename format 4+3 fits G+DOS (10 chars), +3DOS (8+3 chars) and TR-DOS (8 chars). This is simpler than creating different names for every DOS, and makes code compatible.

Improve copying the FZX to the disk images.

Rename the 42 CPL driver and font. The new filenames fit any DOS, making the 42 CPL screen mode module compatible.

Rename the 64 CPL driver. The new filename fits any DOS, making the 64 CPL screen mode module compatible.

Rename the kernel file to "solo.bin". This filename fits any DOS. So far TR-DOS needed a different, shorter name. Now all common files of disk 0 have identical names in all DOSes (except the loader, of course).

Make also a 180 KiB disk 0 for +3DOS.

Reuse code of invert. Currently, the HL register needs to be inverted from assembler, in two DOS operations. There's no need to duplicate code. The fastest method is chosen, though the call makes invert a bit slower.

Free RAM page 1 in +3DOS. +3DOS uses RAM pages 1, 3, 4 and 6 as an array of 128 sector buffers (numbered 0...127), each of 512 bytes, thus 32 buffers per RAM page. The cache and RAM disk occupy two separate (contiguous) areas of this array. In order to free RAM page 1 for Solo Forth, the default configuration must be modified, moving everything up and making the RAM disk 32 buffers smaller.


Add and modify TR-DOS tests and tries.


Complete the +3DOS exception codes.

Add first try using the library disks in +3DOS. The first approach is to open the library disk as a single file. But there are two problems:

1) The file pointer does not start at 0, but at 736256. Beside, reposition-file doesn't change it. 2) Closing the "drive file" works with disk 0 (in any drive), but not with disk 1 (in any drive): error code -1006 (Unrecognised disk format) is returned. This seems a problem of the disk images created by fsb2-dsk.


Add new comments to the BASIC loaders.

Complete the list of ZX Spectrum ROM routines.

Compact the source of located.

Improve the code to debug the TR-DOS version.

Add ref-xdpb to the +3DOS version.

Update version number.

Update the char codes inc file.