Close

Modifications to eForth/z80

A project log for eForth/z80 modifications

A more hackable eForth/z80

ken-yapKen Yap 08/05/2019 at 11:270 Comments

The first thing I tried to do was to build the Z80 eForth written by Ken Chen. This requires MASM, which is exploited for its macro facility. I wasted some time modifying the assembly code for asz80, from asxxxx. Then I realised I didn't really need a Z80 assembler at this point, merely MASM or a workalike. I found JWASM, which is very close to MASM, is open source, and runs under other OSes, in particular Linux.

I've pushed my small hack to Github, and my README.md partly rendered below explains everything. At this point I haven't written anything original but now the source should be easier to modify, especially the hardware interface part.

Z80 eForth built with JWASM

This directory contains an alternate version of the Z80 eForth. They are the files with lower case names.

The single ASM file has been slightly modified to build with JWASM, an open source derivative of Watcom ASM that runs under several operating systems, instead of MASM. In the process changes were made to allow the assembler source to complete without errors and make it easier to modify:

The modified file builds with JWASM with this command:

jwasm -Fl -bin efz80.z80

No LINK required. The result efz80.BIN is byte for byte identical with EFZ80.COM except for a few locations where a single padding byte due to the EVEN directive resulted in a padding byte of 90H (8086 NOP) for JWASM and 00H for MASM.

Regarding the last bullet point, have you wondered how an 8086 assembler can handle Z80 code? It turns out that all the Z80 code is hand assembled or assembled elsewhere and the opcodes inserted into the source as DBs. MASM or JWASM are used mainly for the MACRO facility. And the ability to generate binaries from source of course. Hence my interest in making the code easier to modify, particularly if you have different serial interface hardware.

Discussions