[OpenBIOS] Found out why replacing '\r' with '\n' works

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sun Jul 17 16:18:22 CEST 2016


On 18/04/16 02:36, Segher Boessenkool wrote:

> On Sun, Apr 17, 2016 at 08:45:31PM -0400, Programmingkid wrote:
>> I implemented another stack that two new words use in place of >r and r> when running code in the bootscript. I see this message with and without the '\r' to '\n' patch:
>>
>>>> Dictionary space overflow: dicthead=000c3fe4 dictlimit=00080000
>> this image is not for this platform
>>
>> This means the implementing another stack did not fix the problem. It appears to make it worse. 
>>
>> Here is the patch:
> 
> Oh my.
> 
> hex
> 20 cells CREATE stash  VARIABLE #stash  #stash off
> : stash-push  stash #stash cells + !  1 stash +! ;
> : stash-pop   -1 stash +!  stash #stash cells + @ ;
> : >r  state @ IF postpone >r EXIT THEN  stash-push ;
> : r>  state @ IF postpone r> EXIT THEN  stash-pop ;
> : r@  state @ IF postpone r@ EXIT THEN  stash-pop dup stash-push ;
> 
> Anyway, I had a quick look at the openbios code and it seems it doesn't
> even support IF and similar structure words in interpretation state
> at all.  That is a little more work (requires a temporary definition, use
> a buffer for that (don't put it at HERE) because you can allocate from
> that temp definition; when you reach THEN that temp definition ends (not
> just at  ;  ); but things can nest, IF ... IF ... THEN ... THEN.)
> 
> It's not too hard but it interacts a little bit with the rest of the Forth
> system, so it needs testing etc.  Maybe next weekend.

This weekend I had a chunk of time to dig into this, and I think I now
have something that works. Looking at the OpenBOOT source, they
reference what they call a pseudo r-stack to enable r-stack words to
execute in interpret mode so I've followed a simlar pattern for OpenBIOS
based upon your work above.

Another interesting part of the patchset was that the original patch to
split on 0d as well as 0a is actually correct, but the regression in
yaboot is caused by a separate bug in evaluate not correctly preserving
the stack across statements split by newlines.

I'll post the patchset shortly, so tests and reviews are welcome. I know
Ben H was really keen to get OS 9 booting under QEMU 2.7 out of the box
if at all possible.


ATB,

Mark.




More information about the OpenBIOS mailing list