Toddy Forth with ZXpand support

Discussion about ZX80 / ZX81 Software
Post Reply
User avatar
kmurta
Posts: 302
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Toddy Forth with ZXpand support

Post by kmurta »

This is something I should have done some time ago, but I left it in the background. So here it is, a new Toddy Forth version with ZXpand support. And now, when in FAST mode, system automatically switches to SLOW while reading the keyboard (with words KEY and INPUT) and return to FAST as soon as you hit ENTER.

New words added: (S"), S", CMOVE, SLOW, FAST, FLOAD e FSAVE. The words (.") and CSAVE are removed and ." was redefined in terms of S" and TYPE.

As ZXpand is not compatible with the redefinition of characters (UDG), this feature was removed and ASCII characters nonexistent in ZX81 were remapped as follow:
chars.jpg
(48.38 KiB) Downloaded 950 times
To save and load programs and files, there are the words FSAVE and FLOAD. To save a program, use the format:

Code: Select all

S" HANOI" FSAVE
wich will save the program HANOI.P in current directory (like in BASIC, the .P extension is optional). Or

Code: Select all

S" PROGS/HANOI" FSAVE
to save it in the directory PROGS.

And to save a block file (an ASCII source for example) use the format:

Code: Select all

S" PROGS/HANOI.FTH;32768,6300" FSAVE
where 32768 is the start address of block in memory and 6300 is your length.


Likewise, to load files from ZXpand, the options are:

Code: Select all

S" HANOI" FLOAD
to load the program HANOI.P from current directory, or

Code: Select all

S" PROGS/HANOI" FLOAD
to load it from directory PROGS.

And

Code: Select all

S" PROGS/HANOI.FTH;32768" FLOAD
will load the file HANOI.FTH at the address 32768 and you can compile it with

Code: Select all

32768 LOAD

I hope you enjoy and have fun!
Attachments
tForth12.zip
(189.54 KiB) Downloaded 375 times
Last edited by kmurta on Wed May 15, 2013 4:06 am, edited 1 time in total.
1 x ZX81, 2 x TK85 , 1 TK82C, 1 TK95, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org
https://toddysoftware.itch.io/
User avatar
RetroTechie
Posts: 379
Joined: Tue Nov 01, 2011 12:16 am
Location: Hengelo, NL
Contact:

Re: Toddy Forth 1.2 - For use with ZXpand

Post by RetroTechie »

I see there's a list of words (and what they do) included, and even source code, but ehm... no manual? :?:

I'm think of something with a short chapter on "wtf is Forth?", how to get started, how to read that word list, how the ZX81's memory is used, how to input/edit programs, etc.

There's only 2 Forths in my ZX81 software collection, and the reason they are (and not other ZX81 Forths), is that I could find a decent manual for them. For games it's usually not important, but (imho) utillity software is basically useless if it doesn't come with a proper manual. Which is a shame, knowing how much fine-tuning, design work etc might have gone into something like a Forth compiler.

Fwiw: I have no experience with Forth. :( But am very interested in it, wanting to learn it "some day", ;) and the ZX81 seems a good a platform as any for that purpose.
RWAP
Posts: 1348
Joined: Thu May 08, 2008 8:42 am
Location: Stoke-on-Trent, UK
Contact:

Re: Toddy Forth 1.2 - For use with ZXpand

Post by RWAP »

It is good to see continuing development of this software.

It has been many years since I dabbled in Forth and I agree that a manual is lacking at the moment.

Reading through the history of Toddy Forth, I see that it was developed from two earlier ZX81 Forth implementations - one based on Arctic Computing's ZX Forth, and one based on a minimalist forth which appeared in a magazine.

I believe that it follows Fig Forth - maybe some of the tutorials at: http://www.forth.org/tutorials.html would be of assistance - kmurta, are any of these suitable for Toddy Forth? It may also be a good idea to get a copy of Toddy Forth uploaded to that site to broaden its interest base.
User avatar
kmurta
Posts: 302
Joined: Tue Sep 01, 2009 5:04 am
Location: Belo Horizonte - BR
Contact:

Re: Toddy Forth 1.2 - For use with ZXpand

Post by kmurta »

RetroTechie wrote:I see there's a list of words (and what they do) included, and even source code, but ehm... no manual? :?:

I'm think of something with a short chapter on "wtf is Forth?", how to get started, how to read that word list, how the ZX81's memory is used, how to input/edit programs, etc.

There's only 2 Forths in my ZX81 software collection, and the reason they are (and not other ZX81 Forths), is that I could find a decent manual for them. For games it's usually not important, but (imho) utillity software is basically useless if it doesn't come with a proper manual. Which is a shame, knowing how much fine-tuning, design work etc might have gone into something like a Forth compiler.

Fwiw: I have no experience with Forth. :( But am very interested in it, wanting to learn it "some day", ;) and the ZX81 seems a good a platform as any for that purpose.
I understand your opinion, but in fact a proper manual not is indispensable for you to take advantage of Toddy Forth. Most of the words of Toddy Forth are common to others forth and those specific to ZX81 are obvious: CLS, FAST, SLOW, FSAVE, FLOAD. This actual version is for use with ZXpand and you can load/save programs/files with words FLOAD and FSAVE, as I have exposed above. And if you really want to learn forth there are many good documents available on the WEB and I list below some of them where you can get started:

A Beginner's Guide to Forth http://galileo.phys.virginia.edu/classe ... primer.htm

Starting Forth http://home.iae.nl/users/mhx/sf.html

Thinking Forth http://thinking-forth.sourceforge.net/

And so Forth... http://thebeez.home.xs4all.nl/ForthPrim ... rimer.html

and the papers from Brad Rodriguez, that helped me a lot to understand the internal structure of the forth when I was starting with Toddy Forth:

Moving Forth: the original CamelForth articles
Part 1: Design Decisions in the Forth Kernel http://www.bradrodriguez.com/papers/moving1.htm
Part 2: Benchmarks and Case Studies of Forth Kernels http://www.bradrodriguez.com/papers/moving2.htm
Part 3: Demystifying DOES> http://www.bradrodriguez.com/papers/moving3.htm
Part 4: Assemble or Metacompile? http://www.bradrodriguez.com/papers/moving4.htm
Part 5: The Z80 Primitives http://www.bradrodriguez.com/papers/moving5.htm
Part 6: The Z80 High-level Kernel http://www.bradrodriguez.com/papers/moving6.htm

Actually I am working on a new version of Toddy Forth to bring it closer to the standards and the new release probably will come with a little manual that helps the beginners.
1 x ZX81, 2 x TK85 , 1 TK82C, 1 TK95, 1 x Alphacom 32 printer, 1 x ZXpand
ZeXtender board, Joy81 - Programmable Joystick Controller, Turbo Sound 81
http://zx81.eu5.org
https://toddysoftware.itch.io/
User avatar
bbock
Posts: 54
Joined: Wed Jan 12, 2011 7:59 pm

Re: Toddy Forth with ZXpand support

Post by bbock »

Honestly, I really like this quote from "Moving Forth Part 2":
The Z80 is instructive because it is an extreme example of a non- orthogonal CPU.
:)

Bernd
User avatar
Andy Rea
Posts: 1606
Joined: Fri May 09, 2008 2:48 pm
Location: Planet Earth
Contact:

Re: Toddy Forth with ZXpand support

Post by Andy Rea »

Thanks Kmurta for posting he links to some excellent material, i might give forth another go now, who know if i learn enough i may well even dust the Fignition off and use that a little.

Andy
what's that Smell.... smells like fresh flux and solder fumes...
Moggy
Posts: 3231
Joined: Wed Jun 18, 2008 2:00 pm

Re: Toddy Forth with ZXpand support

Post by Moggy »

Andy Rea wrote:Thanks Kmurta for posting he links to some excellent material, i might give forth another go now, who know if i learn enough i may well even dust the Fignition off and use that a little.

Andy

Better still Andy Burn the H4th rom to a 2764 eprom for an authentic old style setup.

I have been playing with Toddy Forth for a while now on a real zeddy and a weakness of it is it lacks an editor, so You have to resort to Wordpad to re-edit Your routines, put them onto SD card (for Xpand) then take it from there. A bit of a mess around, but then Kmurta once said it was meant for emulator use originally.
Also on a real zeddy there was a keyboard debounce problem in the first versions that resulted in more than one letter printed for any given key press unless great care was taken maybe that's now sorted?

With H4th there is an on screen editor and manual it multitasks beautifully but one downside is that it uses it own unique tape routines for load/save, so that counts the Xpand out. :(

One final thought is that whilst Forth is fun to play with there are far too many dialects of it. Read all the books You want and You will find that any USEFUL examples you want to try out either don't work at all because they require system specific changes, or that the words used in examples are not defined in Your implementation of Forth, Toddy may be based on Fig/Camel but some of its vocabulary ,important to Fig/Camel, is missing due possibly to the restraints of the Zeddy. Some of these missing words can be defined or some times a work around is possible, some of Toddy Forths example programs seem to resort to machine code where words are lacking, but I found that when defining Fig Forth words as listed in Fig Forth publications, some words wont compile at all or cause a crash or worse still do nothing even if they do compile.

The answer, I think , is to learn a version of Forth on the Zeddy and not worry too much about book learning as the lack of translatable examples for the Zeddy contained in them can be quite frustrating, and for an even more obscure Forth try getting Jupiter Ace programs to translate/run in any zeddy Forth dialect! :D
Post Reply