On 4/6/09, Mark Cave-Ayland mark.cave-ayland@siriusit.co.uk wrote:
Hi everyone,
Please find enclosed a patch against current SVN that allows b?branch to work for negative offset branches. With this patch applied, the following output can be seen under openbios-unix on x86 (32-bit):
For the non-branch case (flags is set to -1):
0 > here ok 1 > 10 c, ff c, ff c, ff c, ff c, ok 1 > b1 c, ok 1 > 10 c, aa c, aa c, aa c, aa c, ok 1 > 9d c, ok 1 > 02 c, 16 c, ok 1 > 14 c, f7 c, ok 1 > 02 c, 16 c, ok 1 > 00 c, ok 1 > dup 1 byte-load byte-load: exception caught! ok
For the branch case (flags is set to 0):
0 > here ok 1 > 10 c, 00 c, 00 c, 00 c, 00 c, ok 1 > b1 c, ok 1 > 10 c, aa c, aa c, aa c, aa c, ok 1 > 9d c, ok 1 > 02 c, 16 c, ok 1 > 14 c, f7 c, ok 1 > 02 c, 16 c, ok 1 > 00 c, ok 1 > dup 1 byte-load -55555556 byte-load: exception caught! ok
Note that in terms of docbranch, the branch action being taken is actually the opposite to what you may expect due to the use of setup-tmp-comp (hence the extra invert is required). So as an example, if flags is set to 0 then docbranch does not change the PC, and so we execute the contents of the temporary buffer which contains everything from b(<mark) to b(>resolve). On the other hand, if flags is non-zero then docbranch will branch back to the b(>resolve), and so the temporary buffer contents are ignored.
AFAICT the behaviour is correct from the above examples, but again I'd suggest that someone with more OpenBIOS experience should verify to make sure that this is the right approach.
Thanks, applied.