On Mar 19, 2:02 pm, "John Crane" <jc email> wrote:
> I'm new to Forth and thought it would be a useful addition to my older
8-bit
> machines. I've tried a few Forth's from the Walnut Creek CP/M CD, but
can't
> seem to find one that allows me to load Forth code that was previously
saved
> to a disk file (with a generic text editor). The closest I've found was
> Forth83 (8080 Forth 83 Model V 2.1.0 from June 84) that actually
mentions
> files in the docs. All the others talk about disk blocks - which cause
> screwy behavior (I guess nobody got around to connecting the early
Forth's
> to the disk calls in BDOS).
> I think I must be missing something that's obvious. Because, it seems
to
> me, just loading a text file from disk should be a very simple thing.
OK, so after bru****ng the cobwebs out on the differences between
hForth for CP/M and for DOS, and finding that in this particular case,
it "was neither fish nor fowl, or in a word, red herring" the F83 is
the one that you would want for this.
I have never tried it, but I would expect the following utilities to
compile with some available C compiler for CP/M:
ftp://ftp.taygeta.com/pub/Forth/Tools/4th2txt.c
ftp://ftp.taygeta.com/pub/Forth/Tools/txt24th.c
Usage do***entation is in the source, and even so they are only 3K
source files each, and I guess they use K&R declarations ...
"main(argc,argv)
int argc;
char **argv;"
.... they only use int and char (and char array) data types, and the
only include is:
#include <stdio.h>
.... so I'm thinking they would compile under Small-C.
SO if you have a text editor that you would much rather use (which I
can understand, having used VDE for DOS quite heavily when my home
machine was DOS on a laptop discarded because the hard drive was fubar
and the battery was close to gone) ...
(1) Edit with line numbers on so you'll be able to see where block
boundaries are (you might want a list of multiples of 16 on a
reference index card), and
(2) set your column width to 63 or less ...
.... and you can edit in a text file editor, convert to a block file,
and load that block file in Forth. You can also edit that block file
further while in Forth ... F83 has a very good word source-index
system which makes its straightforward, as well as the full screen
editor, and if its only for doing small fixes even the primitive
command line word editor is usable ... and then convert back to the
text file.
You'll be using the first block as a commentary description and the
second one as a LOAD block ... in F83, I think that CAPACITY 1- is the
last block number for the current block file (but bench test that
first).
If you use those text<->block utilities, the block to text utility has
a command line option to put the block number in |xxxxx| format, which
the text to block utility strips out again if converting. So a handy
trick is to make a large empty text file (just carriage returns),
convert it to a block file, than convert it back with the block
numbering turned on. Then you have a blank text file to work on that
has the block numbers in place.
Of course, the text editor doesn't know those are blocks, so if you
have a macro to copy or cut a whole block from one place to another,
you'd want to run it through that cycle again to get the current block
numbers before setting up a LOAD block. That's an advantage of THRU in
a load block ... the individual BLOCK does not have to know what
block# its in, so you can update that information all in one place.


|