Hi all,
After some more debugging this weekend, I've found that r638 is not the correct fix for resolving backwards branches. Re-reading the OF spec lots of times and searching the internet for information on the Forth control flow stack has now changed my understanding of how this should work.
Currently, OpenBIOS uses 1 stack item per control flow stack item which works fine when executing control flow words directly in the interpreter. However, Fcode evaluation requires slightly different semantics for bbranch and b?branch (since they can be used as part of different control flow words with slightly different behaviours) and so in order for this to work, we also need to know the *type* of a control flow stack item. In particular, we need to know if it is a source address or a dest address in order to be able to resolve nested control flow statements correctly.
Please find attached my current working patch for extending the control flow stack so that each item now takes 2 data stack words: an address, followed by an address type. I have a separate patch for the Fcode evaluator, which when applied in conjunction with this patch actually gets to the point where it attempts to read the file from the ISO image. Nice.
However, since this patch involves some reasonably low level tinkering, I'd like to put it out for review first. Please can people with some Forth experience (e.g. Stefan, Tarl, Laurent) take a look at this and check that it's okay to apply?
ATB,
Mark.