trolfs@vax1.tcd.ie (TOMMY) (03/29/89)
Thanks to everyone who replied to my original posting about file handling tips.
However I think I wasn't being very clear. Sorry. What I should have said was
"Does anybody have any BLOCK handling tips?"
The forth I have is called 'C64-forth' (PET-forth is its parent) which does
access the disk directly in blocks. It even has some file handling words.
But as I hope to upgrade to a larger computer (C64, I still love you!), I want
to have a block management extention which I can take with me, so everything
will have to be done through BLOCK.
Here are some examples that I have come across so far for make block
manipulation easier.
: THRU ( n1 n2 ---) 1+ swap do I load loop ;
: +LOAD ( load next block) blk @ 1+ load ;
: FH ( offset --- blk+offset) blk @ + ; ( FH = from here )
eg 3 FH LOAD ( load 3rd block from here )
or 3 FH 5 FH THRU
and one way of not having to remember numbers is
10 CONSTANT BLOCK_STUFF
BLOCK_STUFF LOAD
I know, I know. These are fairly trivial examples. Even though they're handy,
there is still hassel in keeping the blocks organized.
This is the sort of thing I would like.
NEW ( --- next_free_block)
NEW would put number of next free block on stack.
SCREEN nnnnnn ( n --- )
SCREEN would try to allocate block n and create nnnnn, whos run time action
is the put n on the stack (ie constant), however it would have to be stored
in some sort of directory.
So now you could do something like:
NEW SCREEN GRAPHICS
GRAPHICS EDIT
Also, it woulbe nice to be to associate blocks
GRAPHICS ADD NEW SCREEN TURTLE
ADD would some how link TURTLE with GRAPHIC, so that if you load TURTLE it
will load GRAPHIC itself or something like that.
Does anyone have any good ideas on allocating blocks (I was thinking of a sort
of link list affair), and what about associating blocks with each other.That
could be quite powerful ( or maybe not?).
Anyway. Thanks again to everybody who replied. Hope I'm not being a pain.
See yah.
Tommy.
--
Thomas Rolfs.
(trolfs@vax1.tcd.ie)
Dublin,
Ireland.