A Forth interpreter for the Sinclair ZX Spectrum, written in Z80 Assembly. The project explores implementing a stack-based programming language on an 8-bit system by leveraging the Z80's native hardware capabilities.
Download the TAP file from itch.io.
forthZX uses the Z80's native hardware stack (SP) as its Forth data stack, eliminating the need for a separate software-managed stack.
Stack operations are performed directly using Z80 instructions such as PUSH and POP.
Since the hardware stack is also used for return addresses, the interpreter carefully manages stack usage. In particular, the parser avoids subroutine calls to prevent return-address operations from interfering with Forth data.
| Command | ZX Spectrum Key | PC Key |
|---|---|---|
+ |
SYMBOL_SHIFT + K | CONTROL + K |
- |
SYMBOL_SHIFT + J | CONTROL + J |
* |
SYMBOL_SHIFT + B | CONTROL + B |
/ |
SYMBOL_SHIFT + V | CONTROL + V |
. |
SYMBOL_SHIFT + M | CONTROL + M |
: |
SYMBOL_SHIFT + Z | CONTROL + Z |
= |
SYMBOL_SHIFT + L | CONTROL + L |
> |
SYMBOL_SHIFT + T | CONTROL + T |
< |
SYMBOL_SHIFT + R | CONTROL + R |
! |
SYMBOL_SHIFT + 1 | CONTROL + 1 |
@ |
SYMBOL_SHIFT + 2 | CONTROL + 2 |
? |
SYMBOL_SHIFT + C | CONTROL + C |
+! |
- | - |
<> |
- | - |
DUP |
- | - |
DROP |
- | - |
SWAP |
- | - |
OVER |
- | - |
ROT |
- | - |
EMIT |
- | - |
AND |
- | - |
OR |
- | - |
INVERT |
- | - |
VARIABLE |
- | - |
IF/ELSE/THEN |
- | - |
DO/LOOP |
- | - |
.S |
- | - |
Press SYMBOL SHIFT or CONTROL only once when entering special characters.
makeThis project is licensed under the BSD 3-Clause License. See the LICENSE file for details.
