X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=adoc%2Fp_0branch.adoc;h=6488d62ab6c305c4c421abd782609db3eaeab75a;hb=97bcab28825fde3e717ac5489b0f3f19e5e3f5db;hp=4f396c3b82e5d3f08b2f3f2a537f45d9827515d2;hpb=656f37efbd89db1b1088281047a9633cf74e92ec;p=rrq%2Frrqforth.git diff --git a/adoc/p_0branch.adoc b/adoc/p_0branch.adoc index 4f396c3..6488d62 100644 --- a/adoc/p_0branch.adoc +++ b/adoc/p_0branch.adoc @@ -1,6 +1,6 @@ -// rrqforth.asm: WORD p_zero_branch,'0BRANCH',fasm +// contorl.asm: WORD p_zero_branch,'0BRANCH',fasm -anchor:p_zero_branch[] +anchor:p_0branch[] === Word: 0BRANCH @@ -10,7 +10,17 @@ Data stack: ( v -- ) "0BRANCH" is a function word that implements execution conditional by means of optionally adding the subsequent branch offset, or not, to -the point of execution. If the value, is 0 then the branch offset is -added, and otherwise execution continues with the cell following the -branch offset in the definition. +the point of execution. If the value, v, is 0 then the branch offset +is added, and otherwise execution continues with the cell following +the branch offset in the definition. +Note that the branch offset is a byte count and each FORTH word of a +definition take up a cell of 8 bytes. The offset is relative to the +cell address immediately subsequent to the offset cell. In other +words, offset 0 is not branching anywhere and an offset of -16 would +make a tight loop back to the branch instruction itself. The latter +would pull data stack values until and including the first non-zero +value. + +See also <>, <>, <>, +<>, <> and <>.