mrtinb wrote:Hi
I've looked interestingly at forth on my C64 and on the ZX81, but every time I realised that final software would be cumbersome to load. (..) This seems like a useless solution if you want to share your software.
Compared with what? People share Windows-based software all the time. Which requires a 'runtime environment' of GB's+ harddisk space and 100's of MB RAM. This seems to be no problem in most cases.
It just depends on available storage options & how well a system is organized.
Afaik there's basically 2 kinds of Forth implementations:
a) Compiled: upon starting a program, program code gets compiled in-memory into snippets of machine code that do the actual work. This happens near-instantly. Resulting program can reach machine-code like speeds, but there may be some memory overhead because source + compiled program are in memory @ the same time.
b) Interpreted: this works like most BASIC interpreters, where each statement is evaluated and executed one at a time. 100x executed = 100x read & evaluated. But do to Forths' simplicity, the "inner interpreter" loop can be very simple. And thus, quite fast. Not
quite as fast as machine code or compiled Forth, but many times faster than BASIC or other interpreted languages.
No idea what type Toddy Forth is. In both cases if the Forth environment loads from tape, you have the in-memory overhead of that too.
A user would either have to install an EPROM in their computer
That would seem like a 'convenient' method in the case of a ZX81. This could come as a module to plug into the expansion port. Or perhaps an internal 'multi-ROM' with a switch to select between Forth and regular ZX81 BASIC. Again this isn't much different from other systems: iirc, for example with the Philips P2000, its BASIC came in the form of a cartridge. No cartridge, no BASIC.
or first load a forth envionment to run the software.
Inconvenient how? Depends on the size. Say you have a compiled Forth, 3K source compiles into 1K Z80 code, the runtime is 2K, this gets combined into a single 3K binary that loads directly from BASIC. Much, much better than a 10K BASIC program that does the same & runs much slower. So it all depends on the numbers... too bad ZX81 tape storage is so poor.
But if you're working in Forth, it makes sense not to produce BASIC-loadable code, but load the Forth environment first (once!), and then load Forth program(s) into that.
Exactly the same as with BASIC, only now you have a Forth compiler/interpreter rather than a BASIC interpreter in memory.
Somehow Toddy Forth seems to have overcomed this.
Doubtful - it will have to walk one of above paths in order to work.
But there is no documentation on how to create an application from the source.
Like explained... Probably there's some kind of editor built-in, a way to store programs on tape & load them back in, and some "execute" command. Which is all you need.
But lack of documentation is annoying indeed. So far there's only 2 Forth implementations that made it into my ZX81 library (Artic's ZX-Forth and Tree4th/H4th). Both only because I
could find documentation on how to use those. Imho: no docs = no use.
No matter how brilliant the piece of software in question was written.