Hi 4tH-ers!
Back in 1997, when I first put out 4tH because I got tired of emailing copies, I thought the project needed two things to release it to the public:
- An editor (because I had this wild idea Forth needed an editor);
- And a flagship program.
Well, the first one I ripped from FIG (and it still serves well after 30 years) - and the second one was a small adventure game I found as a "type in" in a ZX Spectrum mag. VENTURE.
You can really see here hoe my Forth style changed:
: do-wear \ wear helmet
objects decode
if \ do we want to wear a helmet?
object@ helmet <> if CANNOT exit then
helmet missing? \ do we have a helmet?
if MISSING exit then
helmet? done! \ now put on the helmet
else
IDUNNO
then
;
I'd probably write it nowadays as:
: do-wear
objects decode if
object@ helmet = unless CANNOT ;then
helmet missing? if MISSING ;then helmet? done!
;then IDUNNO
;
But I digress. Anyways, the program is still there after 30 years. In the meanwhile I've used it as a test bed for lots of things, including uBasic/4tH - but that version was a complete rewrite because that interpreter wasn't that capable yet. Like having no strings ;-)
I've watched quite some ZX Spectrum shows on YT lately and I came to realize that uBasic/4tH is not just a match for ZX BASIC - it surpasses it. So this morning I thought, "Why not give it a try?"
Yeah, there were some long variable names, but those were easily replaced. Also - lots of DATA statements, but unless they are very long, I can handle those. Of course, lots of subtle and less subtle bugs had to be squashed, but that's just a matter of patience. It ran.
Now, I've tried to stay as close to the original source as possible. Of course, I had to deal with screen effects and sounds - I had to remove those. I sacrificed an array element to get rid of the 1-numbered ZX BASIC arrays. I also fixed a bug in the original source.
So what's included is the best translation from ZX BASIC to uBasic/4tH I can make. This is the place I started from. Enjoy!
Hans Bezemer