On Apr 21, 2016, at 1:17 PM, Segher Boessenkool wrote:
On Thu, Apr 21, 2016 at 12:26:06PM -0400, Programmingkid wrote:
As Segher had suggested, I executed the boot script one line at a time. This enabled me to see what line failed. The line that is failing is this:
r> here - allot
The message printed after this line is executed is:
"Dictionary space overflow: dicthead=000c3fe4 dictlimit=00080000"
So I decide to find out what value was being allot'ed. Using this code:
r> here - dup ." Calling allot with " . cr allot
The value that is being allocated is 0xa43ef or 672,751. Just for a comparison, I tried my code on Apple's Open Firmware. The value it allocates is 0xffffffd7. So I think the solution might be to increase available memory to OpenBIOS's dictionary.
[ L O O O O N G L I N E S ]
No, the solution is to make R> work in interpret mode. Properly.
Wouldn't we be better off avoiding using R> and >R? Apple's code looks like it only cares about using the return stack as a placeholder for data (correct me if I am wrong on this point). Tarl said if the parsing code uses the return stack, then this boot script would mess it up. So it seems avoiding using the return stack is a logical course of action.
I did try your version of r> and >r. The end result was pretty much the same as my patch. The "Dictionary Space overflow" error message is still printed. This doesn't mean you are wrong, it just means maybe there is more that needs fixing.
And you'll need structure words to work as well. Piling workarounds on top of workarounds won't get you far.
I remember your list of words that you thought had problems:
AHEAD IF THEN BEGIN AGAIN UNTIL CASE ENDCASE DO ?DO LOOP +LOOP
What makes you so sure it is these words that are the problem?
My test for BEGIN AGAIN in interpret mode: begin ." hello world" again
The result was "hello world" being printed over and over again. It seems to work in interpret mode.
The IF tests:
0 if ." false" else ." true" then
1 if ." true" else ." false" then
Both these tests print "true" like they are suppose to.
The do loop test:
decimal 100 0 do ." number: " i . cr loop
The output is the expected list of numbers. number 0 number 1 number 2 ... number 99
BEGIN ... UNTIL tests:
begin ." hello world " 0 until
The output is the expected "hello world" text repeated over and over.
5 begin cr ." hello world " 1 - dup 0= until cr ." end of loop" cr
The output is the expected "hello world repeated five times with the "end of loop" text at the end.
I ran these tests with just this command line: qemu-system-ppc -nographic
It allows me to copy and paste my code into QEMU.