Search found 931 matches

by JimBoyd
Sun Mar 29, 2026 10:45 pm
Forum: Forth
Topic: Addressing the stacks
Replies: 5
Views: 797

Re: Addressing the stacks

I've fixed my Forth so RP0 , a user variable, now points to the initial address of the return stack and RP@ returns the address of the top item on the return stack.

With this change I've tried a variation on an idea from M.L.Gassanenko. I wrote a generic stack word, STACK , which iterates through ...
by JimBoyd
Fri Mar 13, 2026 8:39 pm
Forum: Forth
Topic: Addressing the stacks
Replies: 5
Views: 797

Re: Addressing the stacks

RP0 and SP0 are user variables which point to the initial address of their respective stacks. On multitasking systems, each task has its own set of stacks; therefore, RP0 returns a unique address for each task. The same for SP0 . These words, along with RP@ and SP@ can also be used to write ...
by JimBoyd
Mon Mar 02, 2026 8:36 pm
Forum: Forth
Topic: Addressing the stacks
Replies: 5
Views: 797

Addressing the stacks

My Forth, a Forth-83 Standard Forth, has the word SP@ . In "Starting FORTH" SP@ is named 'S .

The stack pointer is fetched by the word 'S (pronounced tick-S).
Since 'S provides the address of the top stack location, the phrase
'S @
fetches the contents of the top of the stack. This operation, of ...
by JimBoyd
Sun Jan 18, 2026 11:24 pm
Forum: Forth
Topic: Fleet Forth design considerations
Replies: 369
Views: 739354

Re: Fleet Forth design considerations


Fleet Forth dictionary and vocabularies.
The structures:
There is only one Dictionary in Fleet Forth. As is true with the Forth Leo Brodie discusses in "Starting Forth", Fleet Forth's vocabularies are independently linked lists which weave through the dictionary.

Each dictionary entry consists of ...
by JimBoyd
Fri Dec 26, 2025 9:05 pm
Forum: Forth
Topic: dawnFORTH: Yet another crude Forth for the 65C02.
Replies: 46
Views: 4634

Re: dawnFORTH: Yet another crude Forth for the 65C02.

I know Pascal-type strings... I've worked with Turbo-Pascal way before I learned C in the 80's... :P
I just think that C-type strings are WAY easier to work with. And are not limited in length. I really do not understand why Charles Moore chose Pascal-type strings over C-type.
Forth's memory ...
by JimBoyd
Fri Dec 26, 2025 8:58 pm
Forum: Forth
Topic: Fleet Forth design considerations
Replies: 369
Views: 739354

Re: Fleet Forth design considerations


I have streamlined the code for Fleet Forth's WITH-WORDS

: WITH-WORDS ( -- NFA )
CONTEXT @
AHEAD
BEGIN
DUP R@ 2>R L>NAME CO R>
CS-SWAP THEN
@ DUP 0=
UNTIL
R> 2DROP ;

The only test to break out of the loop in WITH-WORDS is a test to see if there are no more words in the CONTEXT ...
by JimBoyd
Sun Dec 21, 2025 10:08 pm
Forum: Forth
Topic: Fleet Forth design considerations
Replies: 369
Views: 739354

Re: Fleet Forth design considerations


Some Forths have a word .S which non-destructively displays the contents of the data stack. Fleet Forth also has the word .RS to non-destructively display the contents of the return stack. This word is used in one of the step display words in Fleet Forth's TRACE and in Fleet Forth's (ERR) , an ...
by JimBoyd
Sun Nov 23, 2025 8:55 pm
Forum: Forth
Topic: Not your run of the mill control flow
Replies: 64
Views: 69997

Re: Not your run of the mill control flow

... my own preference would be...

?EXIT \ pop top of stack. exit if true.
?0EXIT \ pop top of stack. exit if false.
... because they both conditionally execute based on TOS (which gets popped), and that's a scenario I associate with the question mark. And the 0 gets added if you wanna reverse ...
by JimBoyd
Sun Nov 23, 2025 8:47 pm
Forum: Forth
Topic: A better ;s
Replies: 0
Views: 2875

A better ;s

One of the words from the Forth-83 Standard in the UNCONTROLLED REFERENCE WORDS section is ;S . It is used to stop interpretation of a block. On some Forth's it can be defined as an alias for EXIT , the runtime compiled by ; (semicolon). This will not work with my Forth. My Forth's INTERPRET ...
by JimBoyd
Mon Nov 10, 2025 12:23 am
Forum: Forth
Topic: Fleet Forth design considerations
Replies: 369
Views: 739354

Re: Fleet Forth design considerations

Fleet Forth has the word DONE? which checks if a key was pressed. If no key was pressed DONE? returns FALSE . If the RUN/STOP key was pressed DONE? returns TRUE . If any other key was pressed DONE? waits for a key press and returns TRUE if the RUN/STOP key is pressed and FALSE otherwise.
I added ...
by JimBoyd
Sun Oct 12, 2025 9:25 pm
Forum: Forth
Topic: Tali Forth for the 65c02
Replies: 283
Views: 135033

Re: Tali Forth for the 65c02


: levels-back r> drop 0 do r> drop loop ;
I think that code is very, very non-portable, because many (pretty much all?) vintage FORTHs keep the loop index and limit on the return stack and would choke on this. The allegation that Tali doesn't choke is mildly impressive.
This version of LEVELS ...
by JimBoyd
Sun Oct 12, 2025 8:54 pm
Forum: Forth
Topic: Tali Forth for the 65c02
Replies: 283
Views: 135033

Re: Tali Forth for the 65c02

As I mentioned previously my own Forth, as well as Scott Ballantyne's Blazin' Forth, also adjusts the limit and index of a DO LOOP to take advantage of a branch on overflow; however, Scott Ballantyne's Blazin' Forth adds $8000 to the limit and subtracts this adjusted limit from the index. The ...
by JimBoyd
Sat Sep 06, 2025 8:43 pm
Forum: Forth
Topic: Fleet Forth design considerations
Replies: 369
Views: 739354

Re: Fleet Forth design considerations

I was not satisfied with two names in the Fleet Forth kernel.
The first name, 'STREAM , implies the address of the input stream. 'STREAM actually returns the address and count.
From the Forth-83 Standard.

The input stream extends from the offset value of >IN to the
size of the input stream ...
by JimBoyd
Sat Sep 06, 2025 8:34 pm
Forum: Forth
Topic: CS-101 problems and their FORTH solutions.
Replies: 93
Views: 57734

Re: CS-101 problems and their FORTH solutions.

Thank you.
I don't think floating point numbers would actually work in this instance. With some of the larger numbers, the floating point errors could accumulate and throw the result off.
An integer quotient is the exact quotient and an integer remainder is the exact remainder.
by JimBoyd
Sun Aug 31, 2025 8:54 pm
Forum: Forth
Topic: CS-101 problems and their FORTH solutions.
Replies: 93
Views: 57734

Re: CS-101 problems and their FORTH solutions.

Not sure if this belongs in the thread "CS-101 problems and their FORTH solutions" or if I should have started a new Forth and mathematics thread. This example involves repetends. It was easier to program than to explain. After the basic introduction I attempt a top down explanation of the code ...