ZXTil: A Threaded Interpretive Language for the ZX Spectrum

Sep 01, 2026 • 14:30 / 2 min read

“Threaded Interpretive Languages” by R. G. Loeliger

Back in the 1980s I discovered a book on the shelf of my local library - “Threaded Interpretive Languages” by R. G. Loeliger (PDF available here on archive.org).

“Threaded Interpretive Languages” by R. G. Loeliger

The book describes how to implement the basics of an indirect threaded FORTH interpreter, and also contains instructions on how to implement compilation of executable files, ‘block’ editors, and compilation from storage.

FORH on the ZX Spectrum

I was fascinated, since I had already experimented with FORTH using White Lightning by Oasis Software, but I never had time to try it out.

White Lightning by Oasis Software

Since I’ve now got my platform set up for ZX Spectrum coding, I decided to have a bash at importing the code. The published code is intended as an example of how such a language might be implemented, but it largely works out of the box. I found a few bugs and typos, but these were easy to find and fix.

TIL Implementation on the Spectrum

The main issue that I encountered at first is that the code relies on the use of the iy Z80 register, which is used by the ROM on the ZX Spectrum and isn’t available for use by programs that use ROM routines or interface with BASIC. Therefore I had to import display and keyboard routines from my games library, and adapt these for text input. The intiial version I created has a bug somewhere which means that symbol shift isn’t working, so I can’t test the defining words containing symbols such as ‘:’ and ‘.’. Setting breakpoints in the keyboard routines is tiresome because the emulator pauses and this locks the keyboard.

However the outer interpreter loop runs fine. The next step is to get compilation working, immediate mode, etc.

Project page

The project page is here and the repository is here.