Jump to content
IGNORED

fbForth—TI Forth with File-based Block I/O [Post #1 UPDATED: 06/05/2024]


Lee Stewart

Recommended Posts

1 hour ago, TheBF said:

The 2nd one is better.

 

Thanks.

 

1 hour ago, TheBF said:

Would it be worth noting where idx and lim are stored?

It might help people who try to use R inside a DO LOOP. 

 

Perhaps. I do go into more detail with the description of DO, but I do need to improve it. I will, at the least, add this line:

See DO, I, J, LOOP, and LEAVE for more details, with the most detail at DO.

 

...lee

  • Like 2
Link to comment
Share on other sites

On 8/19/2024 at 4:54 AM, Lee Stewart said:

My proposed new description is

+LOOP( n -- ) selectively controls branching back to the corresponding DO based on n, the loop index idx, and the loop limit lim. The signed increment n is added to idx and the total compared to lim. The branch back to DO occurs until |idx| ≥ |lim|. Upon exiting the loop, the parameters are discarded and execution continues ahead.

 

...lee

Yes, that is much more clearer. I got your book Lee, great work!! I am enjoying the read, as a newbie to FORTH, your descriptions has included the usable FORTH words, this helps the way the syntax and function are laid out in manner that can be understood by someone from a different language programming language perspective. Knowing that you can create NEW words that implement new functions is the bonus I have been looking for, as the Ternary CPU has so many new ways of dealing with LOGIC that a simple language like BASIC, it becomes cumbersome. I have been writing in Q64 basic for a number of years building all the logic directives and checking my logic elements function as described by hardware, besides using spreadsheets that can be used as software versions of hardware.    

 

I am looking at implementing a version of FORTH for my Ternary CPU project, I understand that FORTH is easier to implement hardware directives than just about anything else besides native assembler. For my Ternary Project, I will be creating a triple circular stack, that accommodates the Ternary nature of the basic logic, having 27 (3^3) unary operators and 19683 (3^9) Ternary 2-input logic possibilities, where about 729 (3^6) are non-inverted and usable. I hope to share the ideas behind design on my blog when I have built the TI99 interface for the basic logic elements (already designed). Looking forward to your next book, regards Arto.   

  • Like 3
Link to comment
Share on other sites

11 hours ago, Artoj said:

Yes, that is much more clearer. I got your book Lee, great work!! I am enjoying the read, as a newbie to FORTH, your descriptions has included the usable FORTH words, this helps the way the syntax and function are laid out in manner that can be understood by someone from a different language programming language perspective. Knowing that you can create NEW words that implement new functions is the bonus I have been looking for, as the Ternary CPU has so many new ways of dealing with LOGIC that a simple language like BASIC, it becomes cumbersome. I have been writing in Q64 basic for a number of years building all the logic directives and checking my logic elements function as described by hardware, besides using spreadsheets that can be used as software versions of hardware.    

 

I am looking at implementing a version of FORTH for my Ternary CPU project, I understand that FORTH is easier to implement hardware directives than just about anything else besides native assembler. For my Ternary Project, I will be creating a triple circular stack, that accommodates the Ternary nature of the basic logic, having 27 (3^3) unary operators and 19683 (3^9) Ternary 2-input logic possibilities, where about 729 (3^6) are non-inverted and usable. I hope to share the ideas behind design on my blog when I have built the TI99 interface for the basic logic elements (already designed). Looking forward to your next book, regards Arto.   

Very interesting project.  Your circular stacks are echoing the work of Charles Moore.  His CPUs designs use circular stacks to reduce the need to "DROP" items in the code.

 

I should add that Forth is not limited to what you see in any given implementation. It is really Charles Moore's programming tool kit./instruction set It kind of defies full description. 

 

The Forth Assembler is secret weapon for rapid interactive development of critical routines where speed matters. 

Forth can be rebuilt to use faster "linkage" mechanisms like direct threading or sub-routine threading. (with a code size increase)

The "state of the art" Forth compilers now generate native code with inlining and constant folding. 

 

My most unusual Forth project for TI-99 is actually a weird TMS9900 assembler that uses Forth names for the instructions and treats registers like variables.

It was the only way to get the kind of speed that we see in modern compilers without building a modern compiler. :)

9900 is so "hi-level" that it maps onto the Forth VM very well.

 

I look forward to seeing more of your work.

 

 

 

  • Like 5
Link to comment
Share on other sites

On 6/28/2024 at 7:40 AM, Vorticon said:

 

I never noted TI Forth to be incomplete in any way

 

The TI FORTH release said "it has not undergone the rigorous testing required for a release" or some such. 
 

Leon Tietz, Leslie O'Hagan (third person?) did high quality work on it.  It  was not his first FIG-Forth port.

 

I discovered this in a Mar 83 memo in the TI Records. It assigns Tietz to either 99/8 or TIPC software (not sure which) and praises Tietz as having done "many Forths". Tietz had completed a 990 version that was in use.  (I don't know whether Dave Pitts made his 990 Forth OS while at TI or afterward.) 
 

And somebody did a TMS7000 version released in 1981 (1982?) in Speech Education Module. There was more Forth interest within TI. 

 

 

 

  • Like 3
Link to comment
Share on other sites

On 8/18/2024 at 7:05 PM, Lee Stewart said:

See DO, I, J, LOOP, and LEAVE for more details, with the most detail at DO.

I haven't seen a dictionary do it that way: I do see "See the main entry under DO." Or "refer to the 3rd heading under DO." This is what I see in the books by Eric Partridge. 

Link to comment
Share on other sites

1 hour ago, FarmerPotato said:

I haven't seen a dictionary do it that way: I do see "See the main entry under DO." Or "refer to the 3rd heading under DO." This is what I see in the books by Eric Partridge. 

 

Not sure what you mean here. Are you referring to how the words are defined in the dictionary or how they are described in the glossary?

 

...lee

  • Like 1
Link to comment
Share on other sites

It's fine as Long as all the words are included, which they are.. imho

If it's a website I'd assume there's links.

Plus I'd be more interested in seeing example illustration of how to use each..

Edited by GDMike
Link to comment
Share on other sites

2 hours ago, Lee Stewart said:

 

Not sure what you mean here. Are you referring to how the words are defined in the dictionary or how they are described in the glossary?

 

...lee

Glossary--Just a minor bit of style. I understand you want one place where looping is documented in detail.  "See the main article /heading under DO" is just how I imitate my favorites. Not sure if that article is in the glossary or elsewhere. 
 

By dictionary I meant: a paper book, not code. 

 

 

  • Like 1
Link to comment
Share on other sites

Posted (edited)

Here is another set of changes for the glossary for which I crave your input:

ErrorWords.pdf

 

I deleted all information from the PDF that is not relevant to this post. [I see that I missed deleting ?KEY8, so just ignore it.] These are all of the error-checking words in the kernel that begin with ‘?’. There is some redundancy, but if you are searching for a particular word’s description, it is probably not distracting that nearby words have a lot of identical information, but what do you think?

 

...lee

Edited by Lee Stewart
clarification
Link to comment
Share on other sites

42 minutes ago, Lee Stewart said:

Here is another set of changes for the glossary for which I crave your input:

ErrorWords.pdf 1.72 MB · 2 downloads

 

I deleted all information not relevant to this post. [I see that I missed deleting ?KEY8, so just ignore it.] These are all of the error-checking words in the kernel that begin with ‘?’. There is some redundancy, but if you are searching for a particular word’s description, it is probably not distracting that nearby words have a lot of identical information, but what do you think?

 

...lee

I love this. I remember wondering what were these weird words that start with '?'  when I started trying learn Forth. :) 

 

This might be covered elsewhere but when you mention the word ERROR, you might want to also reference the BLOCK where the error text is held  (?)

 

"ERROR is called to display the name of the offending word, ‘?’, the system message, residing on BLOCK X,  corresponding to msg#, " ...

 

or some such thing. 

Just a thought. 

 

  • Like 1
Link to comment
Share on other sites

1 hour ago, TheBF said:

I love this. I remember wondering what were these weird words that start with '?'  when I started trying learn Forth. :) 

 

This might be covered elsewhere but when you mention the word ERROR, you might want to also reference the BLOCK where the error text is held  (?)

 

"ERROR is called to display the name of the offending word, ‘?’, the system message, residing on BLOCK X,  corresponding to msg#, " ...

 

or some such thing. 

Just a thought. 

 

Though TI Forth expected the  system messages on blocks (screens) #4 and #5 of every Forth disk, fbForth has always had them in RAM (fbForth 1.0) or ROM (fbForth 2.0fbForth 3.0). ;-)

 

...lee

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

In attempting a clearer description for  COMPILE, I am not sure I managed it.

 

Old:

COMPILE   ( --- )    ( IS:<word> )

COMPILE is a compile-only word that will execute when its containing word executes, which means that its containing word must be a compile-only word that executes during compilation, i.e., an immediate word. This effectively defers compilation of the word following COMPILE until the word containing them is executed within the definition of yet another word.

 

When the word containing COMPILE executes during the compilation of a new word, the execution address cfa of the word following COMPILE is copied (compiled) into the dictionary entry for the new words definition. For example,

: WORD1 COMPILE WORD0 ; IMMEDIATE

: WORD2 WORD1 … ;

When WORD2 is compiled, WORD1 executes, which executes COMPILE to place the cfa of WORD0 into the definition of WORD2 .

 

New:

COMPILE   ( — )     ( IS:<word> )

The intended use for COMPILE is to postpone the compiling behavior of a non-immediate word, e.g., WORD0 below, while defining a new word, e.g., WORD1 below. ([COMPILE], q.v., does this for an immediate word.) 

 

COMPILE is a non-immediate, compile-only word that is compiled by INTERPRET into a new colon definition (WORD1), which must be declared “immediate” so that COMPILE can do its intended job of postponing compilation of the ensuing cfa (WORD0) until the definition of the next word (WORD2). WORD0 would normally execute when WORD1 executes during the definition of WORD2, but COMPILE prevents this by compiling WORD0 into WORD2 and skipping past it to the next cfa in WORD1:

: WORD0 ;

: WORD1 COMPILE WORD0 ; IMMEDIATE

: WORD2 WORD1 ;

Suggestions?

 

...lee

  • Like 1
Link to comment
Share on other sites

COMPILE   ( — )     ( IS:<word> )

         COMPILE postpones the behavior of a non-immediate word, e.g., '@'  below, while defining a new word. 

         The word following COMPILE will not be compiled but will itself be "compiled" into new words later. 

The intended use for COMPILE is to allow the programmer to make words that can COMPILE words into another definition. 

COMPILE is in effect removes a "call" to a word by compiling the word into a new definition. 

Words that use COMPILE will normally be IMMEDIATE. 

 

 

Example Usage: 

COMPILE can be used when you want to rename a primitive operations but don't want to call the primitives 

 

: FETCH ( addr -- n) ?COMP COMPILE @ ;  IMMEDIATE

TEST  MYVAR FETCH ;  \ FETCH will be replaced by '@' in this definition

 

e.g., WORD1 below. ([COMPILE], q.v., does this for an immediate word.) 

 

 

It's a hard one for sure. This might be food for thought. I gotta run.

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...