home .. forth .. colorforth mail list archive ..

Re: [colorforth] Z80 Forth


Hi Jecel,

That's a book I've picked up recently and I have seriously considered following its guidance on a z80 system (or emulator, but the idea of using real hardware still seems more fun). The lore says that if you want to understand Forth you really need to write your own, or at least it seems that everyone who's potty about Forth does write their own. At the moment though I'm resisting, assuming that it will save me some learning time just to dissect CF (which is bound to be far better than anything I could produce myself) instead, but perhaps it would be useful to go z80 for a season. The author suggests that it is feasible to have something running from scratch in a few days. Swings and roundabouts. What would you advise me?

The main trouble I'm finding with Pentium is this gigantic, complicated instruction set, especially working backwards from op codes. Here's one if anyone could shed light on:
: 2/ f8d1 2, ;
Arithmetic shift right.
The op code is D1 F8, which I think must be the assembly instruction SAR EAX,1 but I end up with the opcode D1 38. The manual says the SAR op code is D1 /7, so the reg/opcode field (bits 3-5) is 7 the r/m field (bits 0-2) specifies the register, so is 0 for EAX, but the Mod field (bits 6&7) ... Ah, the Mod field needs to be 3 to address the register, rather than the address held in the register. So F8 is correct.

Anyway, it's taken me ages to get to this point, and you just don't have these problems on a z80 (nor a 68000 from the even smaller experience I had of that). It's slow to work out, and I still marvel at the fact that Charles Moore has actually written for this processor 'sourcelessly'. I suppose there won't be these difficulties on that SEAForth chip.

Jason

I don't think I would ever say that Z80 Forths were the best. The best
book I have ever read about Forth implementation (Loeliger, Threaded
Interpretive Languages, Byte Books, 0-07-038360-x) was dedicated to the
Z80 but that is not the same thing. The 68000 was a far nicer processor
for Forth, for example.

What I do agree with is that Colorforth is great fun, though I am
interested observer (I program in Smalltalk) rather than an active
participant in the community.

-- Jecel




---------------------------------------------------------------------
To unsubscribe, e-mail: colorforth-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: colorforth-help@xxxxxxxxxxxxxxxxxx
Main web page - http://www.colorforth.com